Adopt a naming convention for config definitions

This commit is contained in:
Wojciech Kozlowski 2022-04-11 17:37:16 +02:00
parent a3050322ac
commit f8ed569e92

View File

@ -104,7 +104,7 @@
;; Doom already uses whitespace-mode to highlight unexpected indentation. Add
;; some extras by defining an advice function.
(defadvice! +doom-highlight-unwanted-space-h nil
(defadvice! +x-doom--highlight-unwanted-space-a nil
"Add some extra whitespace highlights to doom's opinion"
:after #'doom-highlight-non-default-indentation-h
(when (bound-and-true-p whitespace-mode)
@ -122,7 +122,7 @@
;; Fix git-gutter advice for magit.
(after! (:all git-gutter magit)
;; Update all visible buffers when (un)staging in the magit buffer.
(defadvice! +vc-gutter-update-visible-buffers-h (&rest _)
(defadvice! +x-vc-gutter--update-visible-buffers-a (&rest _)
"Update vc-gutter in all visible buffers."
:after #'magit-stage
:after #'magit-unstage
@ -166,15 +166,16 @@
;; Doom just gives up on the diff visualizer, because it is impossible to work
;; around undo-tree's window management opinions in a consistent way. For now,
;; hack it to work in some sensible way.
(defadvice! +undo-tree-visualizer-show-diff-a (fn &rest args)
(defadvice! +x-undo-tree--visualizer-show-diff-a (fn &rest args)
"Display the undo-tree diff buffer underneath undo-tree's parent buffer."
:around #'undo-tree-visualizer-show-diff
(defadvice! +undo-tree-visualizer-diff-split-window-a (&rest _)
(defadvice! +x-undo-tree--visualizer-show-diff-split-window-a (&rest _)
"Hack `split-window' to open the diff window where we want it."
:filter-args #'split-window
(list (get-buffer-window undo-tree-visualizer-parent-buffer) nil 'below))
(apply fn args)
(advice-remove 'split-window #'+undo-tree-visualizer-diff-split-window-a))
(advice-remove 'split-window
#'+x-undo-tree--visualizer-show-diff-split-window-a))
(setq
;; Don't keep persistent history - that's what git is for.
undo-tree-auto-save-history nil
@ -185,7 +186,7 @@
;; The only thing I actually missed from helm.
(map! (:when (featurep! :completion vertico)
:map vertico-map
"C-l" (defun +vertico-directory-delete-one-word ()
"C-l" (defun +x-vertico/directory-delete-one-word ()
"Delete one directory or word before point."
(interactive)
(vertico-directory-delete-word 1))))
@ -217,12 +218,12 @@
:bind (("C-x C-g" . deadgrep))
:init
(setq deadgrep-project-root-function
(defun +deadgrep-project-root ()
(defun +x-deadgrep-project-root-fn ()
"Provide a base directory for deadgrep."
(read-directory-name "Base directory: " nil default-directory t)))
:config
(map! (:map deadgrep-mode-map
"C-o" (defun +deadgrep-open-result-other-window ()
"C-o" (defun +x-deadgrep/open-result-other-window ()
"Open the result in other window without changing to it."
(interactive)
(save-selected-window (deadgrep-visit-result-other-window)))
@ -262,7 +263,7 @@
;; Highlight lines that are too long in whitespace mode. We set this with a hook
;; after local variables as fill-column is often set through dir-locals.
(add-hook! 'hack-local-variables-hook
(defun +update-whitespace-line-column ()
(defun +x-whitespace--update-whitespace-line-column-h ()
"Change `whitespace-line-column' to that of `fill-column'."
(setq-local whitespace-line-column fill-column)))
@ -284,7 +285,7 @@
;; -----------------------------------------------------------------------------
(map!
"C-M-\\" (defun indent-region-or-buffer ()
"C-M-\\" (defun +x/indent-region-or-buffer ()
"Indent a region if selected, otherwise the whole buffer."
(interactive)
(if (region-active-p)
@ -293,17 +294,17 @@
"C-x k" #'kill-current-buffer
"C-<" (defun scroll-down-one ()
"C-<" (defun +x/scroll-down-one ()
"Scroll text (but not the point) of selected window downward one line."
(interactive)
(let ((scroll-preserve-screen-position nil)) (scroll-down 1)))
"C->" (defun scroll-up-one ()
"C->" (defun +x/scroll-up-one ()
"Scroll text (but not the point) of selected window upward one line."
(interactive)
(let ((scroll-preserve-screen-position nil)) (scroll-up 1)))
"M-Q" (defun unfill-paragraph (&optional region)
"M-Q" (defun +x/unfill-paragraph (&optional region)
"Takes a multi-line paragraph and makes it into a single line of text."
(interactive (progn (barf-if-buffer-read-only) '(t)))
(let ((fill-column (point-max))