This is first of three big naming convention updates that have been a long time coming. With 2.1 on the horizon, all the breaking updates will batched together in preparation for the long haul. In this commit, we do away with the asterix to communicate that a function is an advice function, and we replace it with the '-a' suffix. e.g. doom*shut-up -> doom-shut-up-a doom*recenter -> doom-recenter-a +evil*static-reindent -> +evil--static-reindent-a The rationale behind this change is: 1. Elisp's own formatting/indenting tools would occasionally struggle with | and * (particularly pp and cl-prettyprint). They have no problem with / and :, fortunately. 2. External syntax highlighters (like pygmentize, discord markdown or github markdown) struggle with it, sometimes refusing to highlight code beyond these symbols. 3. * and | are less expressive than - and -- in communicating the intended visibility, versatility and stability of a function. 4. It complicated the regexps we must use to search for them. 5. They were arbitrary and over-complicated to begin with, decided on haphazardly way back when Doom was simply "my private config". Anyhow, like how predicate functions have the -p suffix, we'll adopt the -a suffix for advice functions, -h for hook functions and -fn for variable functions. Other noteable changes: - Replaces advice-{add,remove}! macro with new def-advice! macro. The old pair weren't as useful. The new def-advice! saves on a lot of space. - Removed "stage" assertions to make sure you were using the right macros in the right place. Turned out to not be necessary, we'll employ better checks later.
62 lines
2.2 KiB
EmacsLisp
62 lines
2.2 KiB
EmacsLisp
;;; 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)
|
|
"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))
|
|
(pos (posframe-poshandler-frame-center info)))
|
|
(cons (car pos)
|
|
(truncate (/ (frame-pixel-height parent-frame)
|
|
2)))))
|
|
|
|
(defvar +helm--posframe-buffer nil)
|
|
;;;###autoload
|
|
(defun +helm-posframe-display (buffer &optional _resume)
|
|
"TODO"
|
|
(setq helm--buffer-in-new-frame-p t)
|
|
(let ((solaire-p (bound-and-true-p solaire-mode))
|
|
(params (copy-sequence +helm-posframe-parameters)))
|
|
(let-alist params
|
|
(require 'posframe)
|
|
(posframe-show
|
|
(setq +helm--posframe-buffer buffer)
|
|
:position (point)
|
|
:poshandler +helm-posframe-handler
|
|
:width
|
|
(max (cl-typecase .width
|
|
(integer .width)
|
|
(float (truncate (* (frame-width) .width)))
|
|
(function (funcall .width))
|
|
(t 0))
|
|
.min-width)
|
|
:height
|
|
(max (cl-typecase .height
|
|
(integer .height)
|
|
(float (truncate (* (frame-height) .height)))
|
|
(function (funcall .height))
|
|
(t 0))
|
|
.min-height)
|
|
:override-parameters
|
|
(dolist (p '(width height min-width min-height) params)
|
|
(setq params (delq (assq p params) params)))))
|
|
;;
|
|
(unless (or (null +helm-posframe-text-scale)
|
|
(= +helm-posframe-text-scale 0))
|
|
(with-current-buffer buffer
|
|
(when (and (featurep 'solaire-mode)
|
|
(not solaire-p))
|
|
(solaire-mode +1))
|
|
(text-scale-set +helm-posframe-text-scale)))))
|
|
|
|
;;;###autoload
|
|
(defun +helm|posframe-cleanup ()
|
|
"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.
|
|
(switch-to-buffer +helm--posframe-buffer t)
|
|
;;
|
|
(posframe-delete +helm--posframe-buffer))
|
|
|