Created
September 24, 2014 16:52
-
-
Save kaz-yos/73df324c2e514a44d37b to your computer and use it in GitHub Desktop.
Solution for "Buffer named *helm* not found" issue on invoking emacsclient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Handle *helm* buffer not found issue 2014-09-24 | |
;; It is caused by helm--maybe-update-keymap remaining in post-command-hook. | |
;; helm--maybe-update-keymap requires *helm* to be present. | |
;; It should be remove-hook'ed, but it does not happen when doing *.Rnw editing. | |
;; The main problem is emacsclient hits this error and die. | |
;; Magit uses emacsclient for COMMIT messages, so it does not work. | |
;; | |
;; Define a function to remove helm--maybe-update-keymap from post-command-hook | |
(defun remove-helm--maybe-update-keymap () | |
(remove-hook 'post-command-hook 'helm--maybe-update-keymap)) | |
;; | |
;; This function should be called before helm--maybe-update-keymap is used. | |
;; | |
;; Candidate hooks for making this happen. | |
;; server-done-hook Hook run when done editing a buffer for the Emacs server. | |
;; server-mode-hook Hook run after entering or leaving `server-mode'. | |
;; server-switch-hook Hook run when switching to a buffer for the Emacs server. | |
;; server-visit-hook Hook run when visiting a file for the Emacs server. | |
;; | |
(add-hook 'server-done-hook 'remove-helm--maybe-update-keymap) | |
(add-hook 'server-mode-hook 'remove-helm--maybe-update-keymap) | |
(add-hook 'server-switch-hook 'remove-helm--maybe-update-keymap) | |
(add-hook 'server-visit-hook 'remove-helm--maybe-update-keymap) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment