Add doom-ui-mode-names for renaming major-modes

This commit is contained in:
Henrik Lissner 2017-05-28 16:12:28 +02:00
parent 5638f509a2
commit e8d454a251
4 changed files with 16 additions and 5 deletions

View file

@ -95,6 +95,19 @@ local value, whether or not it's permanent-local. Therefore, we cycle
show-paren-when-point-inside-paren t)
(show-paren-mode +1)
;; like diminish, but for major-modes. [pedantry intensifies]
(defvar doom-ui-mode-names
'((sh-mode . "sh")
(emacs-lisp-mode "Elisp"))
"An alist mapping major modes to alternative names, which will be set when the
mode is detected.")
(defun doom|set-mode-name ()
"Set the major mode's `mode-name', as dictated by `doom-ui-mode-names'."
(let ((name (assq major-mode doom-ui-mode-names)))
(if name (setq mode-name (cdr name)))))
(add-hook 'after-change-major-mode-hook #'doom|set-mode-name)
;;
;; Bootstrap