💥 revise hook/var fns naming convention (2/2)

This is second of three big naming convention changes. In this commit,
we change the naming conventions for hook functions and variable
functions:

1. Replace the bar | to indicate a hook function with a -h suffix, e.g.

     doom|init-ui -> doom-init-ui-h
     doom|run-local-var-hooks -> doom-run-local-var-hooks-h

2. And add a -fn suffix for functions meant to be set on variables,
   e.g.

     (setq magit-display-buffer-function #'+magit-display-buffer-fn)

See ccf327f8 for the reasoning behind these changes.
This commit is contained in:
Henrik Lissner 2019-07-18 15:27:20 +02:00
parent 51d3b1b424
commit 149b2617b0
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
58 changed files with 521 additions and 517 deletions

View file

@ -106,7 +106,7 @@ if it's callable, `apropos' otherwise."
;;; Hooks
;;;###autoload
(defun +emacs-lisp|extend-imenu ()
(defun +emacs-lisp-extend-imenu-h ()
"Improve imenu support in `emacs-lisp-mode', including recognition for Doom's API."
(setq imenu-generic-expression
`(("Section" "^[ \t]*;;;;*[ \t]+\\([^\n]+\\)" 1)
@ -125,7 +125,7 @@ if it's callable, `apropos' otherwise."
("Types" "^\\s-*(\\(cl-def\\(?:struct\\|type\\)\\|def\\(?:class\\|face\\|group\\|ine-\\(?:condition\\|error\\|widget\\)\\|package\\|struct\\|t\\(?:\\(?:hem\\|yp\\)e\\)\\)\\)\\s-+'?\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)" 2))))
;;;###autoload
(defun +emacs-lisp|reduce-flycheck-errors-in-emacs-config ()
(defun +emacs-lisp-reduce-flycheck-errors-in-emacs-config-h ()
"Remove `emacs-lisp-checkdoc' checker and reduce `emacs-lisp' checker
verbosity when editing a file in `doom-private-dir' or `doom-emacs-dir'."
(when (and (bound-and-true-p flycheck-mode)

View file

@ -34,6 +34,9 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
("add-hook" "remove-hook")
("add-hook!" "remove-hook!")))
;; TODO
(put 'add-hook 'lisp-indent-function 'defun)
(setq-hook! 'emacs-lisp-mode-hook
tab-width 2
;; shorter name in modeline
@ -51,12 +54,12 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
rainbow-delimiters-mode
highlight-quoted-mode
;; initialization
+emacs-lisp|extend-imenu))
+emacs-lisp-extend-imenu-h))
;; Flycheck's two emacs-lisp checkers produce a *lot* of false positives in
;; emacs configs, so we disable `emacs-lisp-checkdoc' and reduce the
;; `emacs-lisp' checker's verbosity.
(add-hook 'flycheck-mode-hook #'+emacs-lisp|reduce-flycheck-errors-in-emacs-config)
(add-hook 'flycheck-mode-hook #'+emacs-lisp-reduce-flycheck-errors-in-emacs-config-h)
;; Special fontification for elisp
(font-lock-add-keywords

View file

@ -803,9 +803,9 @@ compelling reason, so..."
auto-fill-mode ; hard line wrapping
;; `show-paren-mode' causes flickering with indentation margins made by
;; `org-indent-mode', so we turn off show-paren-mode altogether
doom|disable-show-paren-mode
doom-disable-show-paren-mode-h
;; Shows a lot of false positives, so...
doom|disable-show-trailing-whitespace
doom-disable-show-trailing-whitespace-h
+org|enable-auto-reformat-tables
+org|enable-auto-update-cookies

View file

@ -50,8 +50,8 @@ called.")
sp-point-before-same-p))
;; Affects pyenv and conda
(advice-add #'pythonic-activate :after-while #'+modeline|update-env-in-all-windows)
(advice-add #'pythonic-deactivate :after #'+modeline|clear-env-in-all-windows)
(advice-add #'pythonic-activate :after-while #'+modeline-update-env-in-all-windows-h)
(advice-add #'pythonic-deactivate :after #'+modeline-clear-env-in-all-windows-h)
(setq-hook! 'python-mode-hook tab-width python-indent-offset))
@ -165,8 +165,8 @@ called.")
:after python
:init
(when (featurep! :ui modeline)
(add-hook 'pyvenv-post-activate-hooks #'+modeline|update-env-in-all-windows)
(add-hook 'pyvenv-pre-deactivate-hooks #'+modeline|clear-env-in-all-windows))
(add-hook 'pyvenv-post-activate-hooks #'+modeline-update-env-in-all-windows-h)
(add-hook 'pyvenv-pre-deactivate-hooks #'+modeline-clear-env-in-all-windows-h))
:config
(add-hook 'hack-local-variables-hook #'pyvenv-track-virtualenv)
(add-to-list 'global-mode-string

View file

@ -10,11 +10,11 @@
;; happen once.
;;
;; rust-mode is still required for `racer'.
(defun +rust|init ()
"Switch to `rustic-mode', if it's available."
(when (require 'rustic nil t)
(rustic-mode)))
(add-hook 'rust-mode-hook #'+rust|init)
(add-hook 'rust-mode-hook
(defun +rust-init-h ()
"Switch to `rustic-mode', if it's available."
(when (require 'rustic nil t)
(rustic-mode))))
(set-docsets! '(rust-mode rustic-mode) "Rust")
(when (featurep! +lsp)