mediawiki-el icon indicating copy to clipboard operation
mediawiki-el copied to clipboard

Stomps all over the local keymap if outline-minor-mode is enabled (or disabled)

Open phil-s opened this issue 4 years ago • 5 comments

(add-hook 'outline-minor-mode-hook 'mediawiki-outline-magic-keys) is really bad.

mediawiki-outline-magic-keys calls local-set-key for a bunch of key sequences. That's usually the major mode keymap, which is shared amongst all buffers in that mode whether or not outline-minor-mode (let alone mediawiki-mode) is enabled in any given buffer, and which persists for future buffers using that major mode as well.

And because the global outline-minor-mode-hook was used, this clobbering happens again in future, even if you'd re-bound the keys manually, until you figure out what was causing it.

And this all happens from simply loading mediawiki.el.

I suggest creating a new buffer-local minor mode for the desired key bindings, and then only enabling that mode in the specific buffers where you want it.

phil-s avatar Jul 07 '20 23:07 phil-s

Excellent points. I'll look at fixing this soon.

hexmode avatar Jul 07 '20 23:07 hexmode

Could you see if this is fixed in the latest master?

hexmode avatar Jul 11 '20 01:07 hexmode

No, the current master is commit 05aab5ce3b4708dd12e6e33dfab390a9c19dcabf and we can see that nothing has changed: https://github.com/hexmode/mediawiki-el/blob/05aab5ce3b4708dd12e6e33dfab390a9c19dcabf/mediawiki.el#L1917-L1932

phil-s avatar Jul 11 '20 02:07 phil-s

ah, thanks for showing me.

hexmode avatar Jul 11 '20 03:07 hexmode

Ouch, this is really bad. It just bit me by breaking outshine-mode, and confused the hell out of me until I traced it to this package. I suggest simply removing that add-hook line as a quick fix, but yeah, these keys absolutely must be moved to their own map. In the mean time I'm going to have to uninstall this package unfortunately.

aspiers avatar Aug 25 '20 15:08 aspiers