-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
global mode? #11
Comments
I suppose the reason is that it's only designed (and tested) to be used during coding. As you found out yourself (#10), it won't work in all buffers, and I have no idea what would happen in other special buffers. I don't want to add a global mode unless somebody has an idea how to limit it to reasonably compatible buffers. |
I use this code: (setq highlight-symbol-disable '())
(add-hook 'after-change-major-mode-hook
(lambda ()
(if (null (memql major-mode highlight-symbol-disable))
(highlight-symbol-mode)))) If I will need to disable the mode for some buffers I just append the name of that major mode to the list. |
Hi, thanks for your answer! But sometimes it is not enough to detect an incompatible environment by just looking at the major-mode. E.g. M-x list-colors-display or M-x list-faces-display uses Help major mode, but you don't want to always disable highlight-symbol in Help mode in general. Also, it seems more high-level to define a proper global-mode than using hooks. Therefore I currently use: (defun highlight-symbol-mode-on () (define-globalized-minor-mode (global-highlight-symbol-mode 1) Best regards, /Stefan Guath On 24 feb 2014, at 23:07, Jakub Jankiewicz [email protected] wrote:
|
It would be great if you could add @luciferasm code |
I don't think a manual list of incompatible modes and buffer names is safe enough to ship. I think that only works if customized for the actual user. A whitelist approach might work, though. |
in emacs 24 you can use |
(defun my-hls-hook ()
(when (featurep 'highlight-symbol)
(highlight-symbol-mode t)
(highlight-symbol-nav-mode t)
))
(add-hook 'find-file-hook 'my-hls-hook) |
I always use highlight-symbol globally, and have therefore added the usual:
(defun highlight-symbol-mode-on () (highlight-symbol-mode 1))
(define-globalized-minor-mode global-highlight-symbol-mode highlight-symbol-mode highlight-symbol-mode-on)
in order to just enable it globally with
(global-highlight-symbol-mode 1)
Is there a reason why this standard global construct is left out?
The text was updated successfully, but these errors were encountered: