wolray / symbol-overlay

Highlight symbols with keymap-enabled overlays
346 stars 42 forks source link

Add new variable symbol-overlay-inhibit-map #55

Closed tarsius closed 5 years ago

tarsius commented 5 years ago

When this is non-nil, then the highlighting overlays don't use symbol-overlay-map.

This is intended for buffers/modes that use the keymap text property for their own purposes. Because this package uses overlays it would always override the text property keymaps of such packages.

I intend to set this in magit-mode for example. Occasionally (i.e. while writing release notes) I highlight certain hashes in logs to keep track of how far I have gotten. I would still like to be able to type RET on such a hash to view its diff but without this kludge that would not be possible.

purcell commented 5 years ago

Yes, this could make sense, but I guess another option would be to add a prefix arg like HIGHLIGHT-ONLY to symbol-overlay-put so that more passive highlighting can easily be done?

purcell commented 5 years ago

Another way to implement your patch would be to not set the keymap in the overlay if it is nil, then users could set the keymap to nil globally or locally if desired. But that's a bit clunky.

I guess what I'm thinking about is the case where someone wants to disable the overlay keymaps globally. I wonder if your patch should instead use defvar instead of defvar-local. The latter seems unnecessarily narrow.

wolray commented 5 years ago

I guess if a user wants to disable the keymap globally he may choose to set the variable globally somewhere in his init.el. So I merged the PR. Thanks.

tarsius commented 5 years ago

Thanks and sorry for not replying earlier. I prefix argument would have been to cumbersome I think. Maybe defvar would have been better, but only slightly--there's a setq-default after all.

purcell commented 5 years ago

Maybe defvar would have been better,

I've fixed that up retrospectively.