💥 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:
parent
51d3b1b424
commit
149b2617b0
58 changed files with 521 additions and 517 deletions
|
@ -24,7 +24,7 @@
|
|||
|
||||
(define-key cfw:calendar-mode-map "q" #'+calendar/quit)
|
||||
|
||||
(add-hook 'cfw:calendar-mode-hook #'doom|mark-buffer-as-real)
|
||||
(add-hook 'cfw:calendar-mode-hook #'doom-mark-buffer-as-real-h)
|
||||
(add-hook 'cfw:calendar-mode-hook 'hide-mode-line-mode)
|
||||
|
||||
(advice-add #'cfw:render-button :override #'+calendar*cfw:render-button))
|
||||
|
|
|
@ -121,10 +121,9 @@
|
|||
:defer t
|
||||
:config
|
||||
(setq company-dict-dir (expand-file-name "dicts" doom-private-dir))
|
||||
(defun +company|enable-project-dicts (mode &rest _)
|
||||
"Enable per-project dictionaries."
|
||||
(if (symbol-value mode)
|
||||
(add-to-list 'company-dict-minor-mode-list mode nil #'eq)
|
||||
(setq company-dict-minor-mode-list (delq mode company-dict-minor-mode-list))))
|
||||
(add-hook 'doom-project-hook #'+company|enable-project-dicts))
|
||||
|
||||
(add-hook 'doom-project-hook
|
||||
(defun +company--enable-project-dicts-h (mode &rest _)
|
||||
"Enable per-project dictionaries."
|
||||
(if (symbol-value mode)
|
||||
(add-to-list 'company-dict-minor-mode-list mode nil #'eq)
|
||||
(setq company-dict-minor-mode-list (delq mode company-dict-minor-mode-list))))))
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
;;; completion/helm/autoload/posframe.el -*- lexical-binding: t; -*-
|
||||
|
||||
(add-hook 'helm-cleanup-hook #'+helm|posframe-cleanup)
|
||||
|
||||
;;;###autoload
|
||||
(defun +helm-poshandler-frame-center-near-bottom (info)
|
||||
(defun +helm-poshandler-frame-center-near-bottom-fn (info)
|
||||
"Display the child frame in the center of the frame, slightly closer to the
|
||||
bottom, which is easier on the eyes on big displays."
|
||||
(let ((parent-frame (plist-get info :parent-frame))
|
||||
|
@ -14,7 +12,7 @@ bottom, which is easier on the eyes on big displays."
|
|||
|
||||
(defvar +helm--posframe-buffer nil)
|
||||
;;;###autoload
|
||||
(defun +helm-posframe-display (buffer &optional _resume)
|
||||
(defun +helm-posframe-display-fn (buffer &optional _resume)
|
||||
"TODO"
|
||||
(setq helm--buffer-in-new-frame-p t)
|
||||
(let ((solaire-p (bound-and-true-p solaire-mode))
|
||||
|
@ -52,7 +50,7 @@ bottom, which is easier on the eyes on big displays."
|
|||
(text-scale-set +helm-posframe-text-scale)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +helm|posframe-cleanup ()
|
||||
(defun +helm-posframe-cleanup-h ()
|
||||
"TODO"
|
||||
;; Ensure focus is properly returned to the underlying window, by forcing a
|
||||
;; chance in buffer/window focus. This gives the modeline a chance to refresh.
|
||||
|
@ -60,3 +58,4 @@ bottom, which is easier on the eyes on big displays."
|
|||
;;
|
||||
(posframe-delete +helm--posframe-buffer))
|
||||
|
||||
(add-hook 'helm-cleanup-hook #'+helm-posframe-cleanup-h)
|
||||
|
|
|
@ -11,8 +11,7 @@ silently ignored.
|
|||
This falls back to git-grep (then grep) if none of these available.")
|
||||
|
||||
;; Posframe (requires +childframe)
|
||||
(defvar +helm-posframe-handler
|
||||
#'+helm-poshandler-frame-center-near-bottom
|
||||
(defvar +helm-posframe-handler #'+helm-poshandler-frame-center-near-bottom-fn
|
||||
"The function that determines the location of the childframe. It should return
|
||||
a cons cell representing the X and Y coordinates. See
|
||||
`posframe-poshandler-frame-center' as a reference.")
|
||||
|
@ -113,12 +112,12 @@ be negative.")
|
|||
(set-popup-rule! "^\\*helm" :vslot -100 :size 0.22 :ttl nil)
|
||||
|
||||
;; Hide the modeline
|
||||
(defun +helm|hide-mode-line (&rest _)
|
||||
(defun +helm--hide-mode-line (&rest _)
|
||||
(with-current-buffer (helm-buffer-get)
|
||||
(unless helm-mode-line-string
|
||||
(hide-mode-line-mode +1))))
|
||||
(add-hook 'helm-after-initialize-hook #'+helm|hide-mode-line)
|
||||
(advice-add #'helm-display-mode-line :override #'+helm|hide-mode-line)
|
||||
(add-hook 'helm-after-initialize-hook #'+helm--hide-mode-line)
|
||||
(advice-add #'helm-display-mode-line :override #'+helm--hide-mode-line)
|
||||
(advice-add #'helm-ag-show-status-default-mode-line :override #'ignore)
|
||||
|
||||
;; Use helpful instead of describe-* to display documentation
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; completion/ido/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defun +ido|init ()
|
||||
(defun +ido-init-h ()
|
||||
(setq ido-ignore-buffers
|
||||
'("\\` " "^\\*ESS\\*" "^\\*Messages\\*" "^\\*Help\\*" "^\\*Buffer"
|
||||
"^\\*.*Completions\\*$" "^\\*Ediff" "^\\*tramp" "^\\*cvs-"
|
||||
|
@ -52,7 +52,7 @@
|
|||
(crm-custom-mode +1)
|
||||
|
||||
;;
|
||||
(remove-hook 'ido-setup-hook #'+ido|init))
|
||||
(remove-hook 'ido-setup-hook #'+ido-init-h))
|
||||
|
||||
;;
|
||||
(add-hook 'ido-setup-hook #'+ido|init)
|
||||
(add-hook 'ido-setup-hook #'+ido-init-h)
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
;;;###if (featurep! +childframe)
|
||||
|
||||
;;;###autoload
|
||||
(defun +ivy-display-at-frame-center-near-bottom (str)
|
||||
(defun +ivy-display-at-frame-center-near-bottom-fn (str)
|
||||
"TODO"
|
||||
(ivy-posframe--display str #'+ivy-poshandler-frame-center-near-bottom))
|
||||
(ivy-posframe--display str #'+ivy-poshandler-frame-center-near-bottom-fn))
|
||||
|
||||
;;;###autoload
|
||||
(defun +ivy-poshandler-frame-center-near-bottom (info)
|
||||
(defun +ivy-poshandler-frame-center-near-bottom-fn (info)
|
||||
"TODO"
|
||||
(let ((parent-frame (plist-get info :parent-frame))
|
||||
(pos (posframe-poshandler-frame-center info)))
|
||||
|
|
|
@ -77,19 +77,18 @@ immediately runs it on the current candidate (ending the ivy session)."
|
|||
|
||||
;; Ensure a jump point is registered before jumping to new locations with ivy
|
||||
(defvar +ivy--origin nil)
|
||||
|
||||
(defun +ivy|record-position-maybe ()
|
||||
(defun +ivy--record-position-maybe-fn ()
|
||||
(with-ivy-window
|
||||
(setq +ivy--origin (point-marker))))
|
||||
(setq ivy-hooks-alist '((t . +ivy|record-position-maybe)))
|
||||
(setq ivy-hooks-alist '((t . +ivy--record-position-maybe-fn)))
|
||||
|
||||
(defun +ivy|set-jump-point-maybe ()
|
||||
(when (and (markerp +ivy--origin)
|
||||
(not (equal (with-ivy-window (point-marker)) +ivy--origin)))
|
||||
(with-current-buffer (marker-buffer +ivy--origin)
|
||||
(better-jumper-set-jump +ivy--origin)))
|
||||
(setq +ivy--origin nil))
|
||||
(add-hook 'minibuffer-exit-hook #'+ivy|set-jump-point-maybe)
|
||||
(add-hook 'minibuffer-exit-hook
|
||||
(defun +ivy--set-jump-point-maybe-h ()
|
||||
(when (and (markerp +ivy--origin)
|
||||
(not (equal (with-ivy-window (point-marker)) +ivy--origin)))
|
||||
(with-current-buffer (marker-buffer +ivy--origin)
|
||||
(better-jumper-set-jump +ivy--origin)))
|
||||
(setq +ivy--origin nil)))
|
||||
|
||||
(after! yasnippet
|
||||
(add-to-list 'yas-prompt-functions #'+ivy-yas-prompt nil #'eq))
|
||||
|
@ -277,11 +276,13 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
|
|||
(min-height . ,ivy-height)))
|
||||
|
||||
;; default to posframe display function
|
||||
(setf (alist-get t ivy-posframe-display-functions-alist) #'+ivy-display-at-frame-center-near-bottom)
|
||||
(setf (alist-get t ivy-posframe-display-functions-alist)
|
||||
#'+ivy-display-at-frame-center-near-bottom-fn)
|
||||
|
||||
;; posframe doesn't work well with async sources
|
||||
(dolist (fn '(swiper counsel-ag counsel-grep counsel-git-grep))
|
||||
(setf (alist-get fn ivy-posframe-display-functions-alist) #'ivy-display-function-fallback)))
|
||||
(setf (alist-get fn ivy-posframe-display-functions-alist)
|
||||
#'ivy-display-function-fallback)))
|
||||
|
||||
|
||||
(def-package! flx
|
||||
|
|
|
@ -47,10 +47,10 @@
|
|||
;; Smartparens' navigation feature is neat, but does not justify how
|
||||
;; expensive it is. It's also less useful for evil users. This may need to
|
||||
;; be reactivated for non-evil users though. Needs more testing!
|
||||
(defun doom|disable-smartparens-navigate-skip-match ()
|
||||
(setq sp-navigate-skip-match nil
|
||||
sp-navigate-consider-sgml-tags nil))
|
||||
(add-hook 'after-change-major-mode-hook #'doom|disable-smartparens-navigate-skip-match)
|
||||
(add-hook 'after-change-major-mode-hook
|
||||
(defun doom-disable-smartparens-navigate-skip-match-h ()
|
||||
(setq sp-navigate-skip-match nil
|
||||
sp-navigate-consider-sgml-tags nil)))
|
||||
|
||||
;; Autopair quotes more conservatively; if I'm next to a word/before another
|
||||
;; quote, I likely don't want to open a new pair.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
(defalias '+literate/reload #'doom/reload)
|
||||
|
||||
;;;###autoload
|
||||
(defun +literate|recompile-maybe ()
|
||||
(defun +literate-recompile-maybe-h ()
|
||||
"Recompile config.org if we're editing an org file in our DOOMDIR.
|
||||
|
||||
We assume any org file in `doom-private-dir' is connected to your literate
|
||||
|
|
|
@ -46,4 +46,4 @@ byte-compiled from.")
|
|||
|
||||
;; Recompile our literate config if we modify it
|
||||
(after! org
|
||||
(add-hook 'after-save-hook #'+literate|recompile-maybe))
|
||||
(add-hook 'after-save-hook #'+literate-recompile-maybe-h))
|
||||
|
|
|
@ -192,7 +192,7 @@ more information on modifiers."
|
|||
(funcall orig-fn char)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil*fix-dabbrev-in-minibuffer ()
|
||||
(defun +evil--fix-dabbrev-in-minibuffer-h ()
|
||||
"Make `try-expand-dabbrev' from `hippie-expand' work in minibuffer. See
|
||||
`he-dabbrev-beg', so we need to redefine syntax for '/'."
|
||||
(set-syntax-table (let* ((table (make-syntax-table)))
|
||||
|
|
|
@ -36,9 +36,9 @@ directives. By default, this only recognizes C directives.")
|
|||
;; more vim-like behavior
|
||||
evil-symbol-word-search t
|
||||
;; cursor appearance
|
||||
evil-default-cursor '+evil-default-cursor
|
||||
evil-default-cursor '+evil-default-cursor-fn
|
||||
evil-normal-state-cursor 'box
|
||||
evil-emacs-state-cursor '(box +evil-emacs-cursor)
|
||||
evil-emacs-state-cursor '(box +evil-emacs-cursor-fn)
|
||||
evil-insert-state-cursor 'bar
|
||||
evil-visual-state-cursor 'hollow
|
||||
;; must be set before evil/evil-collection is loaded
|
||||
|
@ -53,11 +53,11 @@ directives. By default, this only recognizes C directives.")
|
|||
(advice-add #'help-with-tutorial :after (lambda (&rest _) (evil-emacs-state +1)))
|
||||
|
||||
;; Done in a hook to ensure the popup rules load as late as possible
|
||||
(defun +evil|init-popup-rules ()
|
||||
(set-popup-rules!
|
||||
'(("^\\*evil-registers" :size 0.3)
|
||||
("^\\*Command Line" :size 8))))
|
||||
(add-hook 'doom-init-modules-hook #'+evil|init-popup-rules)
|
||||
(add-hook 'doom-init-modules-hook
|
||||
(defun +evil--init-popup-rules-h ()
|
||||
(set-popup-rules!
|
||||
'(("^\\*evil-registers" :size 0.3)
|
||||
("^\\*Command Line" :size 8)))))
|
||||
|
||||
;; Change the cursor color in emacs state. We do it this roundabout way
|
||||
;; instead of changing `evil-default-cursor' (or `evil-emacs-state-cursor') so
|
||||
|
@ -65,19 +65,17 @@ directives. By default, this only recognizes C directives.")
|
|||
(defvar +evil--default-cursor-color "#ffffff")
|
||||
(defvar +evil--emacs-cursor-color "#ff9999")
|
||||
|
||||
(defun +evil|update-cursor-color ()
|
||||
(setq +evil--default-cursor-color (face-background 'cursor)
|
||||
+evil--emacs-cursor-color (face-foreground 'warning)))
|
||||
(add-hook 'doom-load-theme-hook #'+evil|update-cursor-color)
|
||||
(add-hook 'doom-load-theme-hook
|
||||
(defun +evil-update-cursor-color-h ()
|
||||
(setq +evil--default-cursor-color (face-background 'cursor)
|
||||
+evil--emacs-cursor-color (face-foreground 'warning))))
|
||||
|
||||
(defun +evil-default-cursor ()
|
||||
(defun +evil-default-cursor-fn ()
|
||||
(evil-set-cursor-color +evil--default-cursor-color))
|
||||
(defun +evil-emacs-cursor ()
|
||||
(defun +evil-emacs-cursor-fn ()
|
||||
(evil-set-cursor-color +evil--emacs-cursor-color))
|
||||
|
||||
(defun +evil|update-shift-width ()
|
||||
(setq evil-shift-width tab-width))
|
||||
(add-hook 'after-change-major-mode-hook #'+evil|update-shift-width)
|
||||
(setq-hook! 'after-change-major-mode-hook evil-shift-width tab-width)
|
||||
|
||||
|
||||
;; --- keybind fixes ----------------------
|
||||
|
@ -86,26 +84,26 @@ directives. By default, this only recognizes C directives.")
|
|||
;; `evil-delete' in wgrep buffers.
|
||||
(define-key wgrep-mode-map [remap evil-delete] #'+evil-delete))
|
||||
|
||||
(defun +evil|disable-highlights ()
|
||||
"Disable ex search buffer highlights."
|
||||
(when (evil-ex-hl-active-p 'evil-ex-search)
|
||||
(evil-ex-nohighlight)
|
||||
t))
|
||||
(add-hook 'doom-escape-hook #'+evil|disable-highlights)
|
||||
(add-hook 'doom-escape-hook
|
||||
(defun +evil-disable-ex-highlights-h ()
|
||||
"Disable ex search buffer highlights."
|
||||
(when (evil-ex-hl-active-p 'evil-ex-search)
|
||||
(evil-ex-nohighlight)
|
||||
t)))
|
||||
|
||||
|
||||
;; --- evil hacks -------------------------
|
||||
(defun +evil|display-vimlike-save-message ()
|
||||
"Shorter, vim-esque save messages."
|
||||
(message "\"%s\" %dL, %dC written"
|
||||
(if buffer-file-name
|
||||
(file-relative-name (file-truename buffer-file-name) (doom-project-root))
|
||||
(buffer-name))
|
||||
(count-lines (point-min) (point-max))
|
||||
(buffer-size)))
|
||||
(unless noninteractive
|
||||
(setq save-silently t)
|
||||
(add-hook 'after-save-hook #'+evil|display-vimlike-save-message))
|
||||
(add-hook 'after-save-hook
|
||||
(defun +evil-display-vimlike-save-message-h ()
|
||||
"Shorter, vim-esque save messages."
|
||||
(message "\"%s\" %dL, %dC written"
|
||||
(if buffer-file-name
|
||||
(file-relative-name (file-truename buffer-file-name) (doom-project-root))
|
||||
(buffer-name))
|
||||
(count-lines (point-min) (point-max))
|
||||
(buffer-size)))))
|
||||
;; Make ESC (from normal mode) the universal escaper. See `doom-escape-hook'.
|
||||
(advice-add #'evil-force-normal-state :after #'+evil-escape-a)
|
||||
;; Don't move cursor when indenting
|
||||
|
@ -116,7 +114,7 @@ directives. By default, this only recognizes C directives.")
|
|||
(advice-add #'evil-ex-replace-special-filenames :override #'+evil-resolve-vim-path-a)
|
||||
|
||||
;; make `try-expand-dabbrev' (from `hippie-expand') work in minibuffer
|
||||
(add-hook 'minibuffer-inactive-mode-hook #'+evil--fix-dabbrev-in-minibuffer-a)
|
||||
(add-hook 'minibuffer-inactive-mode-hook #'+evil--fix-dabbrev-in-minibuffer-h)
|
||||
|
||||
;; Focus and recenter new splits
|
||||
(advice-add #'evil-window-split :override #'+evil-window-split-a)
|
||||
|
@ -201,20 +199,20 @@ directives. By default, this only recognizes C directives.")
|
|||
:hook ((ruby-mode enh-ruby-mode) . embrace-ruby-mode-hook)
|
||||
:hook (emacs-lisp-mode . embrace-emacs-lisp-mode-hook)
|
||||
:hook ((lisp-mode emacs-lisp-mode clojure-mode racket-mode)
|
||||
. +evil|embrace-lisp-mode-hook)
|
||||
:hook ((org-mode LaTeX-mode) . +evil|embrace-latex-mode-hook)
|
||||
. +evil-embrace-lisp-mode-hook-h)
|
||||
:hook ((org-mode LaTeX-mode) . +evil-embrace-latex-mode-hook-h)
|
||||
:hook ((c++-mode rust-mode rustic-mode csharp-mode java-mode swift-mode typescript-mode)
|
||||
. +evil|embrace-angle-bracket-modes-hook)
|
||||
. +evil-embrace-angle-bracket-modes-hook-h)
|
||||
:init
|
||||
(after! evil-surround
|
||||
(evil-embrace-enable-evil-surround-integration))
|
||||
:config
|
||||
(setq evil-embrace-show-help-p nil)
|
||||
|
||||
(defun +evil|embrace-latex-mode-hook ()
|
||||
(defun +evil-embrace-latex-mode-hook-h ()
|
||||
(embrace-add-pair-regexp ?l "\\[a-z]+{" "}" #'+evil--embrace-latex))
|
||||
|
||||
(defun +evil|embrace-lisp-mode-hook ()
|
||||
(defun +evil-embrace-lisp-mode-hook-h ()
|
||||
(push (cons ?f (make-embrace-pair-struct
|
||||
:key ?f
|
||||
:read-function #'+evil--embrace-elisp-fn
|
||||
|
@ -222,7 +220,7 @@ directives. By default, this only recognizes C directives.")
|
|||
:right-regexp ")"))
|
||||
embrace--pairs-list))
|
||||
|
||||
(defun +evil|embrace-angle-bracket-modes-hook ()
|
||||
(defun +evil-embrace-angle-bracket-modes-hook-h ()
|
||||
(set (make-local-variable 'evil-embrace-evil-surround-keys)
|
||||
(delq ?< evil-embrace-evil-surround-keys))
|
||||
(push (cons ?< (make-embrace-pair-struct
|
||||
|
@ -260,11 +258,11 @@ directives. By default, this only recognizes C directives.")
|
|||
(def-package! evil-exchange
|
||||
:commands evil-exchange
|
||||
:config
|
||||
(defun +evil|escape-exchange ()
|
||||
(when evil-exchange--overlays
|
||||
(evil-exchange-cancel)
|
||||
t))
|
||||
(add-hook 'doom-escape-hook #'+evil|escape-exchange))
|
||||
(add-hook 'doom-escape-hook
|
||||
(defun +evil--escape-exchange-h ()
|
||||
(when evil-exchange--overlays
|
||||
(evil-exchange-cancel)
|
||||
t))))
|
||||
|
||||
|
||||
(def-package! evil-snipe
|
||||
|
|
|
@ -39,13 +39,13 @@
|
|||
;; disable evil-escape in evil-mc; causes unwanted text on invocation
|
||||
(add-to-list 'evil-mc-incompatible-minor-modes 'evil-escape-mode nil #'eq)
|
||||
|
||||
(defun +multiple-cursors|escape-multiple-cursors ()
|
||||
"Clear evil-mc cursors and restore state."
|
||||
(when (evil-mc-has-cursors-p)
|
||||
(evil-mc-undo-all-cursors)
|
||||
(evil-mc-resume-cursors)
|
||||
t))
|
||||
(add-hook 'doom-escape-hook #'+multiple-cursors|escape-multiple-cursors)
|
||||
(add-hook 'doom-escape-hook
|
||||
(defun +multiple-cursors-escape-multiple-cursors-h ()
|
||||
"Clear evil-mc cursors and restore state."
|
||||
(when (evil-mc-has-cursors-p)
|
||||
(evil-mc-undo-all-cursors)
|
||||
(evil-mc-resume-cursors)
|
||||
t)))
|
||||
|
||||
;; Forward declare these so that ex completion and evil-mc support is
|
||||
;; recognized before the autoloaded functions are loaded.
|
||||
|
@ -71,30 +71,30 @@
|
|||
(defvar +mc--compat-evil-prev-state nil)
|
||||
(defvar +mc--compat-mark-was-active nil)
|
||||
|
||||
(defun +multiple-cursors|compat-switch-to-emacs-state ()
|
||||
(when (and (bound-and-true-p evil-mode)
|
||||
(not (memq evil-state '(insert emacs))))
|
||||
(setq +mc--compat-evil-prev-state evil-state)
|
||||
(when (region-active-p)
|
||||
(setq +mc--compat-mark-was-active t))
|
||||
(let ((mark-before (mark))
|
||||
(point-before (point)))
|
||||
(evil-emacs-state 1)
|
||||
(when (or +mc--compat-mark-was-active (region-active-p))
|
||||
(goto-char point-before)
|
||||
(set-mark mark-before)))))
|
||||
(add-hook 'multiple-cursors-mode-enabled-hook #'+multiple-cursors|compat-switch-to-emacs-state)
|
||||
(add-hook 'multiple-cursors-mode-enabled-hook
|
||||
(defun +multiple-cursors-compat-switch-to-emacs-state-h ()
|
||||
(when (and (bound-and-true-p evil-mode)
|
||||
(not (memq evil-state '(insert emacs))))
|
||||
(setq +mc--compat-evil-prev-state evil-state)
|
||||
(when (region-active-p)
|
||||
(setq +mc--compat-mark-was-active t))
|
||||
(let ((mark-before (mark))
|
||||
(point-before (point)))
|
||||
(evil-emacs-state 1)
|
||||
(when (or +mc--compat-mark-was-active (region-active-p))
|
||||
(goto-char point-before)
|
||||
(set-mark mark-before))))))
|
||||
|
||||
(defun +multiple-cursors|compat-back-to-previous-state ()
|
||||
(when +mc--compat-evil-prev-state
|
||||
(unwind-protect
|
||||
(case +mc--compat-evil-prev-state
|
||||
((normal visual) (evil-force-normal-state))
|
||||
(t (message "Don't know how to handle previous state: %S"
|
||||
+mc--compat-evil-prev-state)))
|
||||
(setq +mc--compat-evil-prev-state nil)
|
||||
(setq +mc--compat-mark-was-active nil))))
|
||||
(add-hook 'multiple-cursors-mode-disabled-hook #'+multiple-cursors|compat-back-to-previous-state)
|
||||
(add-hook 'multiple-cursors-mode-disabled-hook
|
||||
(defun +multiple-cursors-compat-back-to-previous-state-h ()
|
||||
(when +mc--compat-evil-prev-state
|
||||
(unwind-protect
|
||||
(case +mc--compat-evil-prev-state
|
||||
((normal visual) (evil-force-normal-state))
|
||||
(t (message "Don't know how to handle previous state: %S"
|
||||
+mc--compat-evil-prev-state)))
|
||||
(setq +mc--compat-evil-prev-state nil)
|
||||
(setq +mc--compat-mark-was-active nil)))))
|
||||
|
||||
;; When running edit-lines, point will return (position + 1) as a result of
|
||||
;; how evil deals with regions
|
||||
|
@ -106,10 +106,10 @@
|
|||
(goto-char (1- (point)))
|
||||
(push-mark (1- (mark))))))
|
||||
|
||||
(defun +multiple-cursors|evil-compat-rect-switch-state ()
|
||||
(if rectangular-region-mode
|
||||
(+multiple-cursors|compat-switch-to-emacs-state)
|
||||
(setq +mc--compat-evil-prev-state nil)))
|
||||
(add-hook 'rectangular-region-mode-hook '+multiple-cursors|evil-compat-rect-switch-state)
|
||||
(add-hook 'rectangular-region-mode-hook
|
||||
(defun +multiple-cursors-evil-compat-rect-switch-state-h ()
|
||||
(if rectangular-region-mode
|
||||
(+multiple-cursors-compat-switch-to-emacs-state-h)
|
||||
(setq +mc--compat-evil-prev-state nil))))
|
||||
|
||||
(defvar mc--default-cmds-to-run-once nil)))
|
||||
|
|
|
@ -41,20 +41,20 @@
|
|||
(global-git-commit-mode +1)
|
||||
(set-yas-minor-mode! 'git-commit-mode)
|
||||
|
||||
(defun +vc|enforce-git-commit-conventions ()
|
||||
"See https://chris.beams.io/posts/git-commit/"
|
||||
(setq fill-column 72
|
||||
git-commit-summary-max-length 50
|
||||
git-commit-style-convention-checks '(overlong-summary-line non-empty-second-line)))
|
||||
(add-hook 'git-commit-mode-hook #'+vc|enforce-git-commit-conventions)
|
||||
(add-hook 'git-commit-mode-hook
|
||||
(defun +vc--enforce-git-commit-conventions-h ()
|
||||
"See https://chris.beams.io/posts/git-commit/"
|
||||
(setq fill-column 72
|
||||
git-commit-summary-max-length 50
|
||||
git-commit-style-convention-checks '(overlong-summary-line non-empty-second-line))))
|
||||
|
||||
(defun +vc|start-in-insert-state-maybe ()
|
||||
"Start git-commit-mode in insert state if in a blank commit message,
|
||||
(add-hook 'git-commit-setup-hook
|
||||
(defun +vc--start-in-insert-state-maybe ()
|
||||
"Start git-commit-mode in insert state if in a blank commit message,
|
||||
otherwise in default state."
|
||||
(when (and (bound-and-true-p evil-mode)
|
||||
(bobp) (eolp))
|
||||
(evil-insert-state)))
|
||||
(add-hook 'git-commit-setup-hook #'+vc|start-in-insert-state-maybe))
|
||||
(when (and (bound-and-true-p evil-mode)
|
||||
(bobp) (eolp))
|
||||
(evil-insert-state)))))
|
||||
|
||||
(after! vc-annotate
|
||||
(set-popup-rules!
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
(evil-change-to-initial-state))
|
||||
(goto-char (point-max)))
|
||||
(with-current-buffer (pop-to-buffer eshell-buffer)
|
||||
(doom|mark-buffer-as-real)
|
||||
(doom-mark-buffer-as-real-h)
|
||||
(if (eq major-mode 'eshell-mode)
|
||||
(run-hooks 'eshell-mode-hook)
|
||||
(eshell-mode))
|
||||
|
|
|
@ -73,7 +73,7 @@ You should use `set-eshell-alias!' to change this.")
|
|||
eshell-error-if-no-glob t)
|
||||
|
||||
;; Consider eshell buffers real
|
||||
(add-hook 'eshell-mode-hook #'doom|mark-buffer-as-real)
|
||||
(add-hook 'eshell-mode-hook #'doom-mark-buffer-as-real-h)
|
||||
|
||||
;; Keep track of open eshell buffers
|
||||
(add-hook 'eshell-mode-hook #'+eshell|init)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;;; term/shell/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###package shell
|
||||
(add-hook 'shell-mode-hook #'doom|mark-buffer-as-real)
|
||||
(add-hook 'shell-mode-hook #'doom-mark-buffer-as-real-h)
|
||||
(add-hook 'shell-mode-hook #'hide-mode-line-mode)
|
||||
|
|
|
@ -36,7 +36,7 @@ If prefix ARG, recreate the term buffer."
|
|||
(goto-char (point-max)))
|
||||
(setenv "PROOT" (or (doom-project-root) default-directory))
|
||||
(with-current-buffer buffer
|
||||
(doom|mark-buffer-as-real)
|
||||
(doom-mark-buffer-as-real-h)
|
||||
(multi-term-internal))
|
||||
(unless (window-live-p window)
|
||||
(when-let (window
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
multi-term-switch-after-close 'PREVIOUS)
|
||||
|
||||
;;;###package term
|
||||
(add-hook 'term-mode-hook #'doom|mark-buffer-as-real)
|
||||
(add-hook 'term-mode-hook #'doom-mark-buffer-as-real-h)
|
||||
(add-hook 'term-mode-hook #'hide-mode-line-mode)
|
||||
|
|
|
@ -33,7 +33,7 @@ If prefix ARG is non-nil, recreate vterm buffer in the current project's root."
|
|||
(setenv "PROOT" (or (doom-project-root) default-directory))
|
||||
(let ((buffer (get-buffer-create buffer-name)))
|
||||
(with-current-buffer buffer
|
||||
(doom|mark-buffer-as-real)
|
||||
(doom-mark-buffer-as-real-h)
|
||||
(vterm-mode))
|
||||
(pop-to-buffer buffer)))))
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
:config
|
||||
(set-popup-rule! "^vterm" :size 0.25 :vslot -4 :select t :quit nil :ttl 0)
|
||||
|
||||
(add-hook 'vterm-mode-hook #'doom|mark-buffer-as-real)
|
||||
(add-hook 'vterm-mode-hook #'doom-mark-buffer-as-real-h)
|
||||
;; Automatically kill buffer when vterm exits.
|
||||
(add-to-list 'vterm-exit-functions (lambda (buffer) (if buffer (kill-buffer buffer))))
|
||||
;; Modeline serves no purpose in vterm
|
||||
|
|
|
@ -23,15 +23,15 @@
|
|||
(def-package! lsp-ui
|
||||
:hook (lsp-mode . lsp-ui-mode)
|
||||
:init
|
||||
(defun +lsp|init-ui-flycheck-or-flymake ()
|
||||
"Sets up flymake-mode or flycheck-mode, depending on `lsp-prefer-flymake'."
|
||||
(unless (eq :none lsp-prefer-flymake)
|
||||
(if (and (not (version< emacs-version "26.1"))
|
||||
lsp-prefer-flymake)
|
||||
(lsp--flymake-setup))
|
||||
(require 'lsp-ui-flycheck)
|
||||
(lsp-ui-flycheck-enable t)))
|
||||
(add-hook 'lsp-ui-mode-hook #'+lsp|init-ui-flycheck-or-flymake)
|
||||
(add-hook 'lsp-ui-mode-hook
|
||||
(defun +lsp-init-ui-flycheck-or-flymake-h ()
|
||||
"Sets up flymake-mode or flycheck-mode, depending on `lsp-prefer-flymake'."
|
||||
(unless (eq :none lsp-prefer-flymake)
|
||||
(if (and (not (version< emacs-version "26.1"))
|
||||
lsp-prefer-flymake)
|
||||
(lsp--flymake-setup))
|
||||
(require 'lsp-ui-flycheck)
|
||||
(lsp-ui-flycheck-enable t))))
|
||||
:config
|
||||
(setq lsp-prefer-flymake nil
|
||||
lsp-ui-doc-max-height 8
|
||||
|
@ -52,11 +52,11 @@
|
|||
:init
|
||||
;; Make sure that `company-capf' is disabled since it is incompatible with
|
||||
;; `company-lsp' (see lsp-mode#884)
|
||||
(defun +lsp|init-company ()
|
||||
(if (not (bound-and-true-p company-mode))
|
||||
(add-hook 'company-mode-hook #'+lsp|init-company t t)
|
||||
(setq-local company-backends
|
||||
(add-hook 'lsp-mode-hook
|
||||
(defun +lsp-init-company-h ()
|
||||
(if (not (bound-and-true-p company-mode))
|
||||
(add-hook 'company-mode-hook #'+lsp-init-company-h t t)
|
||||
(setq-local company-backends
|
||||
(cons 'company-lsp
|
||||
(remq 'company-capf company-backends)))
|
||||
(remove-hook 'company-mode-hook #'+lsp|init-company t)))
|
||||
(add-hook 'lsp-mode-hook #'+lsp|init-company))
|
||||
(remove-hook 'company-mode-hook #'+lsp-init-company-h t)))))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; tools/magit/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +magit-display-buffer (buffer)
|
||||
(defun +magit-display-buffer-fn (buffer)
|
||||
"Marries `magit-display-buffer-fullcolumn-most-v1' with
|
||||
`magit-display-buffer-same-window-except-diff-v1', except:
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ It is passed a user and repository name.")
|
|||
;; 2. The status screen isn't buried when viewing diffs or logs from the
|
||||
;; status screen.
|
||||
(setq transient-display-buffer-action '(display-buffer-below-selected)
|
||||
magit-display-buffer-function #'+magit-display-buffer)
|
||||
magit-display-buffer-function #'+magit-display-buffer-fn)
|
||||
(set-popup-rule! "^\\(?:\\*magit\\|magit:\\| \\*transient\\*\\)" :ignore t)
|
||||
|
||||
;; Add --tags switch
|
||||
|
@ -40,11 +40,11 @@ It is passed a user and repository name.")
|
|||
"-p" '("-t" "Fetch all tags" ("-t" "--tags")))
|
||||
|
||||
;; so magit buffers can be switched to (except for process buffers)
|
||||
(defun +magit-buffer-p (buf)
|
||||
(with-current-buffer buf
|
||||
(and (derived-mode-p 'magit-mode)
|
||||
(not (eq major-mode 'magit-process-mode)))))
|
||||
(add-to-list 'doom-real-buffer-functions #'+magit-buffer-p nil #'eq)
|
||||
(add-hook 'doom-real-buffer-functions
|
||||
(defun +magit-buffer-p (buf)
|
||||
(with-current-buffer buf
|
||||
(and (derived-mode-p 'magit-mode)
|
||||
(not (eq major-mode 'magit-process-mode))))))
|
||||
|
||||
;; properly kill leftover magit buffers on quit
|
||||
(define-key magit-status-mode-map [remap magit-mode-bury-buffer] #'+magit/quit)
|
||||
|
|
|
@ -102,7 +102,7 @@ PLIST can have the following properties:
|
|||
;;
|
||||
;;; Bootstrap
|
||||
|
||||
(defun +doom-dashboard|init ()
|
||||
(defun +doom-dashboard-init-h ()
|
||||
"Initializes Doom's dashboard."
|
||||
(unless noninteractive
|
||||
;; Ensure the dashboard becomes Emacs' go-to buffer when there's nothing
|
||||
|
@ -112,19 +112,19 @@ PLIST can have the following properties:
|
|||
(when (equal (buffer-name) "*scratch*")
|
||||
(set-window-buffer nil (doom-fallback-buffer))
|
||||
(if (daemonp)
|
||||
(add-hook 'after-make-frame-functions #'+doom-dashboard|reload-frame)
|
||||
(add-hook 'after-make-frame-functions #'+doom-dashboard-reload-frame-h)
|
||||
(+doom-dashboard-reload)))
|
||||
;; Ensure the dashboard is up-to-date whenever it is switched to or resized.
|
||||
(add-hook 'window-configuration-change-hook #'+doom-dashboard|resize)
|
||||
(add-hook 'window-size-change-functions #'+doom-dashboard|resize)
|
||||
(add-hook 'doom-switch-buffer-hook #'+doom-dashboard|reload-maybe)
|
||||
(add-hook 'delete-frame-functions #'+doom-dashboard|reload-frame)
|
||||
(add-hook 'window-configuration-change-hook #'+doom-dashboard-resize-h)
|
||||
(add-hook 'window-size-change-functions #'+doom-dashboard-resize-h)
|
||||
(add-hook 'doom-switch-buffer-hook #'+doom-dashboard-reload-maybe-h)
|
||||
(add-hook 'delete-frame-functions #'+doom-dashboard-reload-frame-h)
|
||||
;; `persp-mode' integration: update `default-directory' when switching perspectives
|
||||
(add-hook 'persp-created-functions #'+doom-dashboard|record-project)
|
||||
(add-hook 'persp-activated-functions #'+doom-dashboard|detect-project)
|
||||
(add-hook 'persp-before-switch-functions #'+doom-dashboard|record-project)))
|
||||
(add-hook 'persp-created-functions #'+doom-dashboard--persp-record-project-h)
|
||||
(add-hook 'persp-activated-functions #'+doom-dashboard--persp-detect-project-h)
|
||||
(add-hook 'persp-before-switch-functions #'+doom-dashboard--persp-record-project-h)))
|
||||
|
||||
(add-hook 'doom-init-ui-hook #'+doom-dashboard|init)
|
||||
(add-hook 'doom-init-ui-hook #'+doom-dashboard-init-h)
|
||||
|
||||
|
||||
;;
|
||||
|
@ -148,7 +148,7 @@ PLIST can have the following properties:
|
|||
collect (cons car nil) into alist
|
||||
finally do (setq fringe-indicator-alist alist))
|
||||
;; Ensure point is always on a button
|
||||
(add-hook 'post-command-hook #'+doom-dashboard|reposition-point nil t))
|
||||
(add-hook 'post-command-hook #'+doom-dashboard-reposition-point-h nil t))
|
||||
|
||||
(define-key! +doom-dashboard-mode-map
|
||||
[left-margin mouse-1] #'ignore
|
||||
|
@ -185,7 +185,7 @@ PLIST can have the following properties:
|
|||
;;
|
||||
;;; Hooks
|
||||
|
||||
(defun +doom-dashboard|reposition-point ()
|
||||
(defun +doom-dashboard-reposition-point-h ()
|
||||
"Trap the point in the buttons."
|
||||
(when (region-active-p)
|
||||
(setq deactivate-mark t)
|
||||
|
@ -198,7 +198,7 @@ PLIST can have the following properties:
|
|||
(progn (goto-char (point-min))
|
||||
(forward-button 1))))
|
||||
|
||||
(defun +doom-dashboard|reload-maybe ()
|
||||
(defun +doom-dashboard-reload-maybe-h ()
|
||||
"Reload the dashboard or its state.
|
||||
|
||||
If this isn't a dashboard buffer, move along, but record its `default-directory'
|
||||
|
@ -214,14 +214,14 @@ If this is the dashboard buffer, reload it completely."
|
|||
(setq +doom-dashboard--last-cwd default-directory)
|
||||
(+doom-dashboard-update-pwd))))
|
||||
|
||||
(defun +doom-dashboard|reload-frame (_frame)
|
||||
(defun +doom-dashboard-reload-frame-h (_frame)
|
||||
"Reload the dashboard after a brief pause. This is necessary for new frames,
|
||||
whose dimensions may not be fully initialized by the time this is run."
|
||||
(when (timerp +doom-dashboard--reload-timer)
|
||||
(cancel-timer +doom-dashboard--reload-timer)) ; in case this function is run rapidly
|
||||
(setq +doom-dashboard--reload-timer (run-with-timer 0.1 nil #'+doom-dashboard-reload t)))
|
||||
|
||||
(defun +doom-dashboard|resize (&rest _)
|
||||
(defun +doom-dashboard-resize-h (&rest _)
|
||||
"Recenter the dashboard, and reset its margins and fringes."
|
||||
(let (buffer-list-update-hook
|
||||
window-configuration-change-hook
|
||||
|
@ -247,20 +247,20 @@ whose dimensions may not be fully initialized by the time this is run."
|
|||
2))))
|
||||
?\n)))))))))
|
||||
|
||||
(defun +doom-dashboard|detect-project (&rest _)
|
||||
(defun +doom-dashboard--persp-detect-project-h (&rest _)
|
||||
"Check for a `last-project-root' parameter in the perspective, and set the
|
||||
dashboard's `default-directory' to it if it exists.
|
||||
|
||||
This and `+doom-dashboard|record-project' provides `persp-mode' integration with
|
||||
This and `+doom-dashboard--persp-record-project-h' provides `persp-mode' integration with
|
||||
the Doom dashboard. It ensures that the dashboard is always in the correct
|
||||
project (which may be different across perspective)."
|
||||
(when (bound-and-true-p persp-mode)
|
||||
(when-let (pwd (persp-parameter 'last-project-root))
|
||||
(+doom-dashboard-update-pwd pwd))))
|
||||
|
||||
(defun +doom-dashboard|record-project (&optional persp &rest _)
|
||||
(defun +doom-dashboard--persp-record-project-h (&optional persp &rest _)
|
||||
"Record the last `doom-project-root' for the current perspective. See
|
||||
`+doom-dashboard|detect-project' for more information."
|
||||
`+doom-dashboard--persp-detect-project-h' for more information."
|
||||
(when (bound-and-true-p persp-mode)
|
||||
(set-persp-parameter
|
||||
'last-project-root (doom-project-root)
|
||||
|
@ -305,9 +305,9 @@ controlled by `+doom-dashboard-pwd-policy'."
|
|||
(erase-buffer)
|
||||
(run-hooks '+doom-dashboard-functions)
|
||||
(goto-char pt)
|
||||
(+doom-dashboard|reposition-point))
|
||||
(+doom-dashboard|resize)
|
||||
(+doom-dashboard|detect-project)
|
||||
(+doom-dashboard-reposition-point-h))
|
||||
(+doom-dashboard-resize-h)
|
||||
(+doom-dashboard--persp-detect-project-h)
|
||||
(+doom-dashboard-update-pwd)
|
||||
(current-buffer)))))
|
||||
|
||||
|
@ -387,7 +387,7 @@ controlled by `+doom-dashboard-pwd-policy'."
|
|||
(propertize
|
||||
(+doom-dashboard--center
|
||||
+doom-dashboard--width
|
||||
(doom|display-benchmark 'return))
|
||||
(doom-display-benchmark-h 'return))
|
||||
'face 'font-lock-comment-face)
|
||||
"\n"))
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
"A list of quit messages, picked randomly by `+doom-quit'. Taken from
|
||||
http://doom.wikia.com/wiki/Quit_messages and elsewhere.")
|
||||
|
||||
(defun +doom-quit (&rest _)
|
||||
(defun +doom-quit-fn (&rest _)
|
||||
(doom-quit-p
|
||||
(format "%s Quit?"
|
||||
(nth (random (length +doom-quit-messages))
|
||||
+doom-quit-messages))))
|
||||
|
||||
;;
|
||||
(setq confirm-kill-emacs #'+doom-quit)
|
||||
(setq confirm-kill-emacs #'+doom-quit-fn)
|
||||
|
|
|
@ -44,15 +44,16 @@
|
|||
(def-package! solaire-mode
|
||||
:defer t
|
||||
:init
|
||||
(defun +doom|solaire-mode-swap-bg-maybe ()
|
||||
(when-let (rule (assq doom-theme +doom-solaire-themes))
|
||||
(require 'solaire-mode)
|
||||
(when (cdr rule)
|
||||
(solaire-mode-swap-bg)
|
||||
(with-eval-after-load 'ansi-color
|
||||
(when-let (color (face-background 'default))
|
||||
(setf (aref ansi-color-names-vector 0) color))))))
|
||||
(add-hook 'doom-load-theme-hook #'+doom|solaire-mode-swap-bg-maybe t)
|
||||
(add-hook 'doom-load-theme-hook
|
||||
(defun +doom--solaire-mode-swap-bg-maybe-h ()
|
||||
(when-let (rule (assq doom-theme +doom-solaire-themes))
|
||||
(require 'solaire-mode)
|
||||
(when (cdr rule)
|
||||
(solaire-mode-swap-bg)
|
||||
(with-eval-after-load 'ansi-color
|
||||
(when-let (color (face-background 'default))
|
||||
(setf (aref ansi-color-names-vector 0) color))))))
|
||||
'append)
|
||||
:config
|
||||
;; fringe can become unstyled when deleting or focusing frames
|
||||
(add-hook 'focus-in-hook #'solaire-mode-reset)
|
||||
|
@ -67,7 +68,7 @@
|
|||
;; the hl-line face, hl-line's highlight bleeds into the rest of the window
|
||||
;; after eob.
|
||||
(when EMACS26+
|
||||
(defun +doom--line-range ()
|
||||
(defun +doom--line-range-fn ()
|
||||
(cons (line-beginning-position)
|
||||
(cond ((let ((eol (line-end-position)))
|
||||
(and (= eol (point-max))
|
||||
|
@ -77,21 +78,21 @@
|
|||
(= (line-end-position 2) (point-max)))
|
||||
(line-end-position))
|
||||
((line-beginning-position 2)))))
|
||||
(setq hl-line-range-function #'+doom--line-range))
|
||||
(setq hl-line-range-function #'+doom--line-range-fn))
|
||||
|
||||
;; Because fringes can't be given a buffer-local face, they can look odd, so
|
||||
;; we remove them in the minibuffer and which-key popups (they serve no
|
||||
;; purpose there anyway).
|
||||
(defun +doom|disable-fringes-in-minibuffer (&rest _)
|
||||
(set-window-fringes (minibuffer-window) 0 0 nil))
|
||||
(add-hook 'solaire-mode-hook #'+doom|disable-fringes-in-minibuffer)
|
||||
(add-hook 'solaire-mode-hook
|
||||
(defun +doom-disable-fringes-in-minibuffer-h (&rest _)
|
||||
(set-window-fringes (minibuffer-window) 0 0 nil)))
|
||||
|
||||
(def-advice! +doom--no-fringes-in-which-key-buffer-a (&rest _)
|
||||
:after 'which-key--show-buffer-side-window
|
||||
(+doom--disable-fringes-in-minibuffer-h)
|
||||
(+doom-disable-fringes-in-minibuffer-h)
|
||||
(set-window-fringes (get-buffer-window which-key--buffer) 0 0 nil))
|
||||
|
||||
(add-hook! '(minibuffer-setup-hook window-configuration-change-hook)
|
||||
#'+doom|disable-fringes-in-minibuffer)
|
||||
#'+doom-disable-fringes-in-minibuffer-h)
|
||||
|
||||
(solaire-global-mode +1))
|
||||
|
|
|
@ -10,6 +10,15 @@
|
|||
|
||||
;; Use a more primitive todo-keyword detection method in major modes that
|
||||
;; don't use/have a valid syntax table entry for comments.
|
||||
(add-hook!
|
||||
(pug-mode haml-mode)
|
||||
#'+hl-todo|use-face-detection))
|
||||
(add-hook! '(pug-mode-hook haml-mode-hook)
|
||||
(defun +hl-todo--use-face-detection-h ()
|
||||
"Use a different, more primitive method of locating todo keywords."
|
||||
(set (make-local-variable 'hl-todo-keywords)
|
||||
'(((lambda (limit)
|
||||
(let (case-fold-search)
|
||||
(and (re-search-forward hl-todo-regexp limit t)
|
||||
(memq 'font-lock-comment-face (doom-enlist (get-text-property (point) 'face))))))
|
||||
(1 (hl-todo-get-face) t t))))
|
||||
(when hl-todo-mode
|
||||
(hl-todo-mode -1)
|
||||
(hl-todo-mode +1)))))
|
||||
|
|
|
@ -6,10 +6,8 @@
|
|||
(setq highlight-indent-guides-method 'character)
|
||||
:config
|
||||
(add-hook 'focus-in-hook #'highlight-indent-guides-auto-set-faces)
|
||||
|
||||
(defun +indent-guides|disable-maybe ()
|
||||
(when highlight-indent-guides-mode
|
||||
(highlight-indent-guides-mode -1)))
|
||||
;; `highlight-indent-guides' breaks in these modes
|
||||
(add-hook 'visual-line-mode-hook #'+indent-guides|disable-maybe)
|
||||
(add-hook 'org-indent-mode-hook #'+indent-guides|disable-maybe))
|
||||
(add-hook! '(visual-line-mode-hook org-indent-mode-hook)
|
||||
(defun +indent-guides-disable-maybe-h ()
|
||||
(when highlight-indent-guides-mode
|
||||
(highlight-indent-guides-mode -1)))))
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
(defvar +modeline--old-bar-height nil)
|
||||
;;;###autoload
|
||||
(defun +modeline|resize-for-font ()
|
||||
(defun +modeline--resize-for-font-h ()
|
||||
"Adjust the modeline's height when the font size is changed by
|
||||
`doom/increase-font-size' or `doom/decrease-font-size'.
|
||||
|
||||
|
@ -33,7 +33,7 @@ Meant for `doom-change-font-size-hook'."
|
|||
(unless EMACS26+ (doom-modeline-refresh-bars))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +modeline|update-env-in-all-windows (&rest _)
|
||||
(defun +modeline-update-env-in-all-windows-h (&rest _)
|
||||
"Update version strings in all buffers."
|
||||
(dolist (window (window-list))
|
||||
(with-selected-window window
|
||||
|
@ -41,7 +41,7 @@ Meant for `doom-change-font-size-hook'."
|
|||
(force-mode-line-update))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +modeline|clear-env-in-all-windows (&rest _)
|
||||
(defun +modeline-clear-env-in-all-windows-h (&rest _)
|
||||
"Blank out version strings in all buffers."
|
||||
(dolist (buffer (buffer-list))
|
||||
(with-current-buffer buffer
|
||||
|
|
|
@ -32,17 +32,17 @@
|
|||
(add-hook 'doom-modeline-mode-hook #'size-indication-mode) ; filesize in modeline
|
||||
(add-hook 'doom-modeline-mode-hook #'column-number-mode) ; cursor column in modeline
|
||||
|
||||
(add-hook 'doom-change-font-size-hook #'+modeline|resize-for-font)
|
||||
(add-hook 'doom-change-font-size-hook #'+modeline--resize-for-font-h)
|
||||
(add-hook 'doom-load-theme-hook #'doom-modeline-refresh-bars)
|
||||
|
||||
(add-hook '+doom-dashboard-mode-hook #'doom-modeline-set-project-modeline)
|
||||
|
||||
(defun +modeline|hide-in-non-status-buffer ()
|
||||
"Show minimal modeline in magit-status buffer, no modeline elsewhere."
|
||||
(if (eq major-mode 'magit-status-mode)
|
||||
(doom-modeline-set-project-modeline)
|
||||
(hide-mode-line-mode)))
|
||||
(add-hook 'magit-mode-hook #'+modeline|hide-in-non-status-buffer)
|
||||
(add-hook 'magit-mode-hook
|
||||
(defun +modeline--hide-in-non-status-buffer-h ()
|
||||
"Show minimal modeline in magit-status buffer, no modeline elsewhere."
|
||||
(if (eq major-mode 'magit-status-mode)
|
||||
(doom-modeline-set-project-modeline)
|
||||
(hide-mode-line-mode))))
|
||||
|
||||
;; Remove unused segments & extra padding
|
||||
(doom-modeline-def-modeline 'main
|
||||
|
|
|
@ -24,17 +24,16 @@ or triggered from one of `+nav-flash-exclude-commands'."
|
|||
(setq +nav-flash--last-point (cons (point-marker) (selected-window)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +nav-flash|delayed-blink-cursor (&rest _)
|
||||
(defun +nav-flash-delayed-blink-cursor-h (&rest _)
|
||||
"Like `+nav-flash-blink-cursor', but links after a tiny pause, in case it
|
||||
isn't clear at run-time if the point will be in the correct window/buffer (like
|
||||
for `org-follow-link-hook')."
|
||||
(run-at-time 0.1 nil #'+nav-flash|blink-cursor))
|
||||
(run-at-time 0.1 nil #'+nav-flash-blink-cursor-h))
|
||||
|
||||
;;;###autoload
|
||||
(defalias '+nav-flash|blink-cursor #'+nav-flash-blink-cursor)
|
||||
(defalias '+nav-flash-blink-cursor-h #'+nav-flash-blink-cursor)
|
||||
;;;###autoload
|
||||
(defalias '+nav-flash|blink-cursor-maybe #'+nav-flash-blink-cursor-maybe)
|
||||
|
||||
(defalias '+nav-flash-blink-cursor-maybe-h #'+nav-flash-blink-cursor-maybe)
|
||||
;;;###autoload
|
||||
(defalias '+nav-flash-blink-cursor-a #'+nav-flash-blink-cursor-maybe)
|
||||
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
(add-hook!
|
||||
'(imenu-after-jump-hook better-jumper-post-jump-hook
|
||||
counsel-grep-post-action-hook dumb-jump-after-jump-hook)
|
||||
#'+nav-flash|blink-cursor-maybe)
|
||||
#'+nav-flash-blink-cursor-maybe-h)
|
||||
|
||||
(add-hook 'doom-switch-window-hook #'+nav-flash|blink-cursor-maybe)
|
||||
(add-hook 'doom-switch-window-hook #'+nav-flash-blink-cursor-maybe-h)
|
||||
|
||||
;; `org'
|
||||
(add-hook 'org-follow-link-hook #'+nav-flash|delayed-blink-cursor)
|
||||
(add-hook 'org-follow-link-hook #'+nav-flash-delayed-blink-cursor-h)
|
||||
|
||||
;; `saveplace'
|
||||
(advice-add #'save-place-find-file-hook :after #'+nav-flash-blink-cursor-a)
|
||||
|
|
|
@ -42,14 +42,13 @@
|
|||
(after! winner
|
||||
(add-to-list 'winner-boring-buffers neo-buffer-name))
|
||||
|
||||
;; The cursor always sits at bol. `+neotree*fix-cursor' and
|
||||
;; `+neotree*indent-cursor' change that behavior, so that the cursor is always
|
||||
;; on the first non-blank character on the line, in the neo buffer.
|
||||
(defun +neotree*fix-cursor (&rest _)
|
||||
(with-current-buffer neo-global--buffer
|
||||
(+neotree*indent-cursor)))
|
||||
(add-hook 'neo-enter-hook #'+neotree*fix-cursor)
|
||||
|
||||
;; The cursor always sits at bol. `+neotree--fix-cursor-h' and
|
||||
;; `+neotree--indent-cursor-a' change that behavior so that the cursor is
|
||||
;; always on the first non-blank character on the line, in the neo buffer.
|
||||
(add-hook 'neo-enter-hook
|
||||
(defun +neotree--fix-cursor-h (&rest _)
|
||||
(with-current-buffer neo-global--buffer
|
||||
(+neotree*indent-cursor))))
|
||||
(def-advice! +neotree--indent-cursor-a (&rest _)
|
||||
:after '(neotree-next-line neotree-previous-line)
|
||||
(beginning-of-line)
|
||||
|
|
|
@ -22,34 +22,34 @@ to the right fringe.")
|
|||
(def-package! git-gutter
|
||||
:commands (git-gutter:revert-hunk git-gutter:stage-hunk)
|
||||
:init
|
||||
(defun +vc-gutter|init-maybe ()
|
||||
"Enable `git-gutter-mode' in the current buffer.
|
||||
(add-hook! '(text-mode-hook prog-mode-hook conf-mode-hook)
|
||||
(defun +vc-gutter-init-maybe-h ()
|
||||
"Enable `git-gutter-mode' in the current buffer.
|
||||
|
||||
If the buffer doesn't represent an existing file, `git-gutter-mode's activation
|
||||
is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||
(when (or +vc-gutter-in-remote-files
|
||||
(not (file-remote-p (or buffer-file-name default-directory))))
|
||||
(if (not buffer-file-name)
|
||||
(add-hook 'after-save-hook #'+vc-gutter|init-maybe nil t)
|
||||
(when (and (vc-backend buffer-file-name)
|
||||
(progn
|
||||
(require 'git-gutter)
|
||||
(not (memq major-mode git-gutter:disabled-modes))))
|
||||
(if (and (display-graphic-p)
|
||||
(require 'git-gutter-fringe nil t))
|
||||
(progn
|
||||
(setq-local git-gutter:init-function #'git-gutter-fr:init)
|
||||
(setq-local git-gutter:view-diff-function #'git-gutter-fr:view-diff-infos)
|
||||
(setq-local git-gutter:clear-function #'git-gutter-fr:clear)
|
||||
(setq-local git-gutter:window-width -1))
|
||||
(setq-local git-gutter:init-function 'nil)
|
||||
(setq-local git-gutter:view-diff-function #'git-gutter:view-diff-infos)
|
||||
(setq-local git-gutter:clear-function #'git-gutter:clear-diff-infos)
|
||||
(setq-local git-gutter:window-width 1))
|
||||
(git-gutter-mode +1)
|
||||
(remove-hook 'after-save-hook #'+vc-gutter|init-maybe t)))))
|
||||
(add-hook! (text-mode prog-mode conf-mode)
|
||||
#'+vc-gutter|init-maybe)
|
||||
(when (or +vc-gutter-in-remote-files
|
||||
(not (file-remote-p (or buffer-file-name default-directory))))
|
||||
(if (not buffer-file-name)
|
||||
(add-hook 'after-save-hook #'+vc-gutter-init-maybe-h nil t)
|
||||
(when (and (vc-backend buffer-file-name)
|
||||
(progn
|
||||
(require 'git-gutter)
|
||||
(not (memq major-mode git-gutter:disabled-modes))))
|
||||
(if (and (display-graphic-p)
|
||||
(require 'git-gutter-fringe nil t))
|
||||
(progn
|
||||
(setq-local git-gutter:init-function #'git-gutter-fr:init)
|
||||
(setq-local git-gutter:view-diff-function #'git-gutter-fr:view-diff-infos)
|
||||
(setq-local git-gutter:clear-function #'git-gutter-fr:clear)
|
||||
(setq-local git-gutter:window-width -1))
|
||||
(setq-local git-gutter:init-function 'nil)
|
||||
(setq-local git-gutter:view-diff-function #'git-gutter:view-diff-infos)
|
||||
(setq-local git-gutter:clear-function #'git-gutter:clear-diff-infos)
|
||||
(setq-local git-gutter:window-width 1))
|
||||
(git-gutter-mode +1)
|
||||
(remove-hook 'after-save-hook #'+vc-gutter-init-maybe-h t))))))
|
||||
|
||||
;; standardize default fringe width
|
||||
(if (fboundp 'fringe-mode) (fringe-mode '4))
|
||||
:config
|
||||
|
@ -58,16 +58,15 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
|||
;; Update git-gutter on focus (in case I was using git externally)
|
||||
(add-hook 'focus-in-hook #'git-gutter:update-all-windows)
|
||||
|
||||
(defun +vc-gutter|update (&rest _)
|
||||
"Refresh git-gutter on ESC. Return nil to prevent shadowing other
|
||||
(add-hook! :append '(doom-escape-hook doom-switch-window-hook)
|
||||
(defun +vc-gutter-update-h (&rest _)
|
||||
"Refresh git-gutter on ESC. Return nil to prevent shadowing other
|
||||
`doom-escape-hook' hooks."
|
||||
(when git-gutter-mode
|
||||
(ignore (git-gutter))))
|
||||
(add-hook 'doom-escape-hook #'+vc-gutter|update t)
|
||||
|
||||
(when git-gutter-mode
|
||||
(ignore (git-gutter)))))
|
||||
;; update git-gutter when using magit commands
|
||||
(advice-add #'magit-stage-file :after #'+vc-gutter|update)
|
||||
(advice-add #'magit-unstage-file :after #'+vc-gutter|update))
|
||||
(advice-add #'magit-stage-file :after #'+vc-gutter-update-h)
|
||||
(advice-add #'magit-unstage-file :after #'+vc-gutter-update-h))
|
||||
|
||||
|
||||
;; subtle diff indicators in the fringe
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue