elisp - emacs, flyspell, deactivate "C-." key binding -
i have little problem, have key bindings c-. c-x
or c-. c-m
. after activate flyspell-mode, cannot use these commands. in .emacs file have next 2 lines before
(global-unset-key (kbd "c-.")) (define-key (current-global-map) (kbd "c-.") nil) (global-set-key (kbd "c-. c-l") 'global-linum-mode)
then, c-. c-l
works, not when flyspell-mode activated. command bound c-.
flyspell-auto-correct-word
. tried deactivate follows:
;; first try (defun flyspell-auto-correct-word-disable() (define-key (current-local-map) (kbd "c-.") nil)) (add-hook 'flyspell-mode-hook 'flyspell-auto-correct-word-disable) ;; second try (define-key (current-global-map) [remap flyspell-auto-correct-word] nil)
none of tries work, can do? tried in emacs 23 , 24 , have same issue.
what about:
(eval-after-load "flyspell" '(define-key flyspell-mode-map (kbd "c-.") nil))
your first solution correct, have remember current local map set major mode, not minor modes. best option have directly access flyspell-mode-map
, modify (another option find in minor-mode-map-alist
think needlessly complicated).
also, prefer putting such mode-specific settings within eval-after-load
(which means evaluated once) rather in hook (in case settings evaluated multiple times: each time 1 buffer activates flyspell-mode
). matter of preference , either way fine.
Comments
Post a Comment