这是indexloc提供的服务,不要输入任何密码
Skip to content

Helm resets cursor-type #3

@jclosure

Description

@jclosure

Helm resets the cursor to block every time you enter the helm-minibuffer. This means when you're done in helm, the cursor is reset globally. Here's a description of the cause of the issue: emacs-helm/helm#1198

You can work around this issue with the following:

    ;; this fn ensures that helm doesn't change the cursor when we exit
    (defun helm-keyboard-quit-advice (orig-func &rest args)
      "Reset the cursor-type back to what it was after quitting helm"
      (interactive)
      (deferred:$
        (deferred:wait 3) ; msec
        (deferred:nextc it
          (lambda (x)
            (when (boundp 'cursor-type)
              (setq cursor-type cursor-type)))))
      (apply orig-func args))

    ;; advising all these functions ensures we cover all cases
    (advice-add 'helm-cleanup :around #'helm-keyboard-quit-advice)
    (advice-add 'keyboard-escape-quit :around #'helm-keyboard-quit-advice)
    (advice-add 'keyboard-quit :around #'helm-keyboard-quit-advice)

NOTE: I make use of https://github.com/kiwanami/emacs-deferred, to delay the resetting of the cursor to the expected cursor-type, because keyboard-quit and keyboard-escape-quit cancel all other functionality. So it's nec to apply the fn after the exit completes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions