💥 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
|
@ -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)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue