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.

  • Why do you want to do something like that? Apr 23 '18 at 6:45
  • 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 before global-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).
    – phils
    Dec 11 '18 at 5:18

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.