fix(emacs-lisp): backport mode-name from 28+

In Emacs 28+, the mode-name in emacs-lisp-mode is "ELisp/X" (where X = d
or l depending on lexical-binding). I find this much more useful than
"Emacs-Lisp" in <=27.x or our static replacement "Elisp".
This commit is contained in:
Henrik Lissner 2022-10-28 02:47:02 +02:00
parent a0ccb6b95b
commit d39ec50bb7
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -56,13 +56,25 @@ See `+emacs-lisp-non-package-mode' for details.")
;; unreadable. Since Emacs' lisp indenter doesn't respect this variable it's ;; unreadable. Since Emacs' lisp indenter doesn't respect this variable it's
;; safe to ignore this setting otherwise. ;; safe to ignore this setting otherwise.
tab-width 8 tab-width 8
;; shorter name in modeline
mode-name "Elisp"
;; Don't treat autoloads or sexp openers as outline headers, we have ;; Don't treat autoloads or sexp openers as outline headers, we have
;; hideshow for that. ;; hideshow for that.
outline-regexp +emacs-lisp-outline-regexp outline-regexp +emacs-lisp-outline-regexp
outline-level #'+emacs-lisp-outline-level) outline-level #'+emacs-lisp-outline-level)
;; DEPRECATED: Remove when 27.x support is dropped.
(when (< emacs-major-version 28)
;; As of Emacs 28+, `emacs-lisp-mode' uses a shorter label in the mode-line
;; ("ELisp/X", where X = l or d, depending on `lexical-binding'). In <=27,
;; it uses "Emacs-Lisp". The former is more useful, so I backport it:
(setq-hook! 'emacs-lisp-mode-hook
mode-name `("ELisp"
(lexical-binding (:propertize "/l"
help-echo "Using lexical-binding mode")
(:propertize "/d"
help-echo "Using old dynamic scoping mode"
face warning
mouse-face mode-line-highlight)))))
;; Fixed indenter that intends plists sensibly. ;; Fixed indenter that intends plists sensibly.
(advice-add #'calculate-lisp-indent :override #'+emacs-lisp--calculate-lisp-indent-a) (advice-add #'calculate-lisp-indent :override #'+emacs-lisp--calculate-lisp-indent-a)