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