Is it possible to have a global prettify-symbols-alist that other modes add to? A lot of major modes override prettify-symbols-alist instead of pushing into it. One solution I thought of is to push the global entries in a hook that runs after the buffer and its mode have initialized. I don't know of such a hook, unfortunately.
1 Answer
Modes usually inherit from each other. For example, java-mode
inherits from prog-mode
which inherits from fundamental-mode
. Similarly, many modes inherit from special-mode
. If you add a function to both fundamental-mode-hook
and special-mode-hook
, you should already cover many major modes.
after-change-major-mode-hook
is exactly the hook you are looking for. Globalized modes also act there, so if you needed to do this beforeglobal-prettify-symbols-mode
has enabled its buffer-local mode (which I think you probably do, although I haven't tested), then you would want to add to the hook after enabling that global mode (or otherwise manipulate the order).