5

Just out of curiosity, why isn't emacs-lisp-mode derived from lisp-mode? Instead, both are derived from prog-mode.

It seems to me that there is a natural hierarchical relationship that should exist. Is the current situation simply a case of historical accident, or is there a good reason that emacs-lisp-mode should not derived from lisp-mode?

Drew
  • 75,699
  • 9
  • 109
  • 225
Tianxiang Xiong
  • 3,848
  • 16
  • 27

1 Answers1

7

Because lisp-mode is actually meant to be the major mode for Common-Lisp. Emacs-Lisp and Common-Lisp are closely related but neither is a superset of the other, so they should both derive from the same parent mode but not from each-other.

We could probably introduce a lispish-mode as a parent of all major modes for Lisp-like languages, but I'm not completely sure how much they could/should share (should it accomodate Scheme as well? Clojure?)

Stefan
  • 26,154
  • 3
  • 46
  • 84
  • Interesting. It does make it difficult to make some Lisp-specific modifications, however. For example, if I want to use `prettify-symbols-mode` for all Lisps to display `lambda` as the single Greek letter, what hook should I add this functionality to? If I add it to `prog-mode-hook`, it will affect non-Lisp languages too (which is not a big deal). – Tianxiang Xiong Dec 07 '15 at 06:05
  • 1
    There's nothing wrong with adding it to both `emacs-lisp-mode-hook` and `lisp-mode-hook`. – phils Dec 07 '15 at 06:18
  • @TianxiangXiong: I'd say using `prettify-symbols-mode` to display `lambda` as an actual lambda makes sense for languages that use `lambda`, this includes several but not all lisps (for example Clojure and Arc don't use lambda) and also includes some other languages, such as Python. – Omar Dec 08 '15 at 20:48
  • Note that `prettify-symbols-mode` is a *global* minor mode. So it's something that gets enabled and applies to *all* modes at the same time. Which symbols get prettified is specified independently by each major mode. – Stefan Dec 09 '15 at 03:34