commit e19d9a0d01451e45a560a5bec579b06848082d31 parent 615b14698085c2f2327ae3ab59f3d24347ddcbf3 Author: Vincent Demeester <vincent@sbr.pm> Date: Wed, 3 Jul 2024 09:39:14 +0200 tools/emacs: exploring some embark stuff Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
M | tools/emacs/config/config-completion.el | | | 22 | +++++++++++++++++++--- |
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/tools/emacs/config/config-completion.el b/tools/emacs/config/config-completion.el @@ -83,7 +83,7 @@ The symbol at point is added to the future history." (:map embark-identifier-map ("D" . dictionary-lookup-definition)) :custom - (embark-quit-after-action nil) + (embark-quit-after-action t) (prefix-help-command #'embark-prefix-help-command) (embark-indicators '(embark-minimal-indicator embark-highlight-indicator @@ -113,10 +113,26 @@ The symbol at point is added to the future history." (interactive "P") (with-current-buffer "*Messages*" (goto-char (1- (point-max))) - (embark-act arg)))) + (embark-act arg))) + + (defmacro ct/embark-display-in-side-window (side) + `(defun ,(intern (concat "display-in-side-window--" (symbol-name side))) (&optional buffer) + (interactive "b") + (when-let* ((buffer (or buffer (current-buffer))) + (display-buffer-overriding-action '((display-buffer-in-side-window) + (dedicated . t) + (side . ,side) + (window-parameters . ((no-delete-other-windows . t)))))) + (display-buffer buffer)))) + (define-key embark-buffer-map (kbd "s b") (ct/embark-display-in-side-window bottom)) + (define-key embark-buffer-map (kbd "s l") (ct/embark-display-in-side-window left)) + (define-key embark-buffer-map (kbd "s r") (ct/embark-display-in-side-window right)) +) (use-package embark-consult - :unless noninteractive) + :unless noninteractive + :hook + (embark-collect-mode . consult-preview-at-point-mode)) (use-package emacs :unless noninteractive