nschum / highlight-symbol.el

Emacs: automatic and manual symbol highlighting
http://nschum.de/src/emacs/highlight-symbol/
274 stars 41 forks source link

Add highlight-symbol-nav-mode-hook #41

Closed zw963 closed 7 years ago

zw963 commented 8 years ago

Hi, I occur some issue about the default

(defvar highlight-symbol-nav-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map "\M-n" 'highlight-symbol-next)
    (define-key map "\M-p" 'highlight-symbol-prev)
    map)
  "Keymap for `highlight-symbol-nav-mode'.")

I personal heavily use M-n M-p shortcut bind to other function, I don't hope this hotkey to be changed by this mode, so I binding to others key.

But, I have no idea to unset M-n, M-p, I need something like this to do the trick

(add-hook 'highlight-symbol-nav-mode-hook
          '(lambda ()
               (local-unset-key [(meta n)])
               (loal-unset-key [(meta p)]
             ))

Thanks.

felipeochoa commented 7 years ago

I think the following (untested) should work:

(with-eval-after-load 'highlight-symbol
  (define-key highlight-symbol-nav-mode-map (kbd "M-n") nil)
  (define-key highlight-symbol-nav-mode-map (kbd "M-p") nil))
zw963 commented 7 years ago

@felipeochoa , Yes, it worked very well, I change it to that so long ago.

Just forget to close this issue.

thanks.