💥 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

@ -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)))

View file

@ -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