elp-revive / auto-highlight-symbol

Automatic highlighting current symbol minor mode.
GNU General Public License v3.0
52 stars 13 forks source link

The defcustom `ash-modes` should be defaulted to `'(prog-mode)` #27

Closed nordlow closed 10 months ago

nordlow commented 10 months ago

What about defaulting ash-modes to '(prog-mode)?

nordlow commented 10 months ago

Ahh, I just realized that only some modes inherit from prog-mode.

As an alternative solution I thought

(defun ahs-mode-maybe ()
  "Fire up `auto-highlight-symbol-mode' if major-mode in ahs-modes."
  (when (and (not (minibufferp (current-buffer)))
             (memq major-mode ahs-modes))
    (auto-highlight-symbol-mode t)))

could be replaced with

(defun ahs-mode-maybe ()
  "Fire up `auto-highlight-symbol-mode' if major-mode in ahs-modes."
  (when (and (not (minibufferp (current-buffer)))
             (or prog-mode (memq major-mode ahs-modes)))
    (auto-highlight-symbol-mode t)))

but this doesn't work because prog-mode is a group not a variable so I don't see a way to use prog-mode for now so closing this.