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

@ -92,7 +92,7 @@
+ [ ] twitter
+ [ ] present
** 2.0.3 [53/81]
** 2.0.3 [54/82]
+ [2/3] Finish module :: feature/jump (go-to-definition that just works)
+ [ ] automatic tag generation
+ [X] global tags support
@ -133,6 +133,7 @@
+ [ ] Fix invisible buffer-info segment in modeline for terminal Emacs
+ [ ] ui/doom-modeline: fix ~0/0~ display in modeline (leftover anzu state)
+ [ ] lang/php: automatic+async rebuild of tags (phpctags)
+ [X] Extract ~mode-name~ setters to ~doom-ui-mode-names~ in core/core-ui
+ [X] nav-flash: blink on focus-in
+ [X] Add ~:textobj~ keyword to ~map!~
+ [X] Make ~doom-refresh-packages~ async

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

View file

@ -21,7 +21,6 @@
(set! :editorconfig :remove 'emacs-lisp-mode)
(defun +emacs-lisp|hook ()
(setq mode-name "Elisp") ; [pedantry intensifies]
(add-hook 'before-save-hook #'delete-trailing-whitespace nil t)
(eldoc-mode +1)

View file

@ -10,9 +10,7 @@
(set! :repl 'sh-mode #'+sh/repl)
(setq sh-indent-after-continuation 'always)
;; [pedantry intensifies]
(add-hook! sh-mode (setq mode-name "sh"))
;; sh-mode has file extensions checks for other shells, but not zsh, so...
(defun +sh|detect-zsh ()
(when (and buffer-file-name (string-match-p "\\.zsh\\'" buffer-file-name))
(sh-set-shell "zsh")))