diff --git a/core/core-ui.el b/core/core-ui.el index 72a9ca02e..d70ee1cf9 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -17,12 +17,6 @@ "Fallback font for unicode glyphs. Is ignored if :feature unicode is active. Expects a `font-spec'.") -(defvar doom-major-mode-names - '((sh-mode . "sh") - (emacs-lisp-mode . "Elisp")) - "An alist mapping major modes symbols to strings (or functions that will -return a string). This changes the 'long' name of a major-mode, allowing for -shorter major mode name in the mode-line. See `doom|set-mode-name'.") ;; (defvar doom-init-ui-hook nil @@ -419,14 +413,6 @@ frame's window-system, the theme will be reloaded.") (add-hook! '(doom-init-ui-hook minibuffer-setup-hook window-configuration-change-hook) #'doom|no-fringes-in-minibuffer) -(defun doom|set-mode-name () - "Set the major mode's `mode-name', as dictated by `doom-major-mode-names'." - (when-let* ((name (cdr (assq major-mode doom-major-mode-names)))) - (setq mode-name - (cond ((functionp name) (funcall name)) - ((stringp name) name) - ((error "'%s' isn't a valid name for %s" name major-mode)))))) - (defun doom|protect-visible-buffer () "Don't kill the current buffer if it is visible in another window (bury it instead). Meant for `kill-buffer-query-functions'." @@ -441,7 +427,6 @@ instead). Meant for `kill-buffer-query-functions'." "Initialize Doom's user interface by applying all its advice and hooks." (add-to-list 'kill-buffer-query-functions #'doom|protect-fallback-buffer nil #'eq) (add-to-list 'kill-buffer-query-functions #'doom|protect-visible-buffer nil #'eq) - (add-hook 'after-change-major-mode-hook #'doom|set-mode-name) (add-hook 'after-change-major-mode-hook #'doom|highlight-non-default-indentation) (add-hook 'compilation-filter-hook #'doom|apply-ansi-color-to-compilation-buffer) (run-hook-wrapped 'doom-init-ui-hook #'doom-try-run-hook)) diff --git a/core/test/test-core-ui.el b/core/test/test-core-ui.el index eedc64a1d..d3d3a1ecf 100644 --- a/core/test/test-core-ui.el +++ b/core/test/test-core-ui.el @@ -2,27 +2,6 @@ ;;; ../core/test/test-core-ui.el (describe "core/ui" - (describe "doom|set-mode-name" - :var (doom-major-mode-names after-change-major-mode-hook) - (before-all - (setq doom-major-mode-names - '((text-mode . "abc") - (lisp-mode . (lambda () "xyz")) - (js-mode . t)) - after-change-major-mode-hook '(doom|set-mode-name))) - - (it "changes `mode-name' to match a given string" - (text-mode) - (expect mode-name :to-equal "abc")) - - (it "changes `mode-name' to the result of a function" - (lisp-mode) - (expect mode-name :to-equal "xyz")) - - (it "should fail if given an invalid name" - (expect (js-mode) :to-throw 'error))) - - (describe "doom|protect-visible-buffer" :var (kill-buffer-query-functions wconf a b) (before-each diff --git a/modules/lang/emacs-lisp/config.el b/modules/lang/emacs-lisp/config.el index 9c500bfb3..c8e2f6ca1 100644 --- a/modules/lang/emacs-lisp/config.el +++ b/modules/lang/emacs-lisp/config.el @@ -47,6 +47,9 @@ ("add-hook" "remove-hook") ("add-hook!" "remove-hook!"))) + ;; [pedantry intensifies] + (setq-hook! 'emacs-lisp-mode-hook mode-name "Elisp") + ;; variable-width indentation is superior in elisp (add-to-list 'doom-detect-indentation-excluded-modes 'emacs-lisp-mode nil #'eq) diff --git a/modules/lang/sh/config.el b/modules/lang/sh/config.el index e73738fca..b61562948 100644 --- a/modules/lang/sh/config.el +++ b/modules/lang/sh/config.el @@ -19,6 +19,9 @@ (setq sh-indent-after-continuation 'always) + ;; [pedantry intensifies] + (setq-hook! 'sh-mode-hook mode-name "sh") + ;; recognize function names with dashes in them (add-to-list 'sh-imenu-generic-expression '(sh (nil "^\\s-*function\\s-+\\([[:alpha:]_-][[:alnum:]_-]*\\)\\s-*\\(?:()\\)?" 1)