mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-12-01 20:46:12 +01:00
7792c69d95
Signed-off-by: magic_rb <magic_rb@redalder.org>
82 lines
2.9 KiB
Org Mode
82 lines
2.9 KiB
Org Mode
:PROPERTIES:
|
|
:ID: 45da0115-42c7-4a9a-9288-c5d840a69b92
|
|
:END:
|
|
#+title: Popper
|
|
#+filetags: emacs-load
|
|
|
|
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
|
|
#
|
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
Enable ~popper~, a better version of ~popwin~, which might actually work. It groups popups by context and allows you to specify their exact positioning, or even a custom display function. It also seems to be better at restoring the previous layout.
|
|
|
|
#+NAME: popper
|
|
#+BEGIN_SRC emacs-lisp
|
|
(use-package popper
|
|
:straight (popper :type git :host github :repo "karthink/popper")
|
|
:config
|
|
(setq popper--reference-names nil
|
|
popper--reference-modes nil
|
|
popper--reference-predicates nil)
|
|
(setq popper-reference-buffers
|
|
'("\\*Messages\\*"
|
|
"\\*Warnings\\*"
|
|
"\\*Error\\*"
|
|
"Output\\*$"
|
|
"\\*HS-Error\\*"
|
|
"\\*lsp-help\\*"
|
|
"^\\*Ement compose.*\\*$"
|
|
"^\\*Org Export Dispatcher\\*$"
|
|
"^\\*Org Select\\*$"
|
|
"^\\*R:[^\\*]+\\*$"
|
|
haskell-interactive-mode
|
|
help-mode
|
|
compilation-mode
|
|
rustic-compilation-mode))
|
|
(popper-mode +1))
|
|
#+END_SRC
|
|
|
|
Add a [[id:db1d0122-58d6-4dec-84f6-afcb52937fc7][consult]] source for popped buffers.
|
|
|
|
#+begin_src emacs-lisp
|
|
(with-eval-after-load 'consult
|
|
(setq magic_rb/consult-source-popper
|
|
`(:name "popper"
|
|
:narrow ?P
|
|
:category buffer
|
|
:face consult-buffer
|
|
:history buffer-name-history
|
|
:state consult--buffer-state
|
|
:items
|
|
(lambda ()
|
|
(let ((group-name (when popper-group-function
|
|
(with-current-buffer buf (funcall popper-group-function)))))
|
|
(mapcar #'buffer-name
|
|
(append
|
|
(mapcar #'cdr (alist-get group-name popper-buried-popup-alist))
|
|
(mapcar #'cdr (alist-get group-name popper-open-popup-alist))))))))
|
|
|
|
(add-to-list 'consult-buffer-sources 'magic_rb/consult-source-popper 'append))
|
|
#+end_src
|
|
|
|
Force user buffer switching to also obey ~display-buffer-alist~.
|
|
|
|
#+begin_src emacs-lisp
|
|
(setq switch-to-buffer-obey-display-actions t)
|
|
#+end_src
|
|
|
|
Set almost all popups to ~meow-motion-mode~, except for [[id:986ca7a5-d225-49bb-9e35-f2dffafe8aee][Org Mode]] popups and [[id:8fbb19be-bb8d-4fef-8a6a-9d5a3f5d06ec][Vterm]].
|
|
|
|
#+begin_src emacs-lisp :tangle no
|
|
(defun magic_rb/popper-meow-motion (buf &optional _act)
|
|
(with-current-buffer buf
|
|
(when
|
|
(and (popper-popup-p buf)
|
|
(not (equal major-mode 'vterm-mode))
|
|
(not ement-room-compose-buffer))
|
|
(meow-normal-mode) (meow-motion-mode))))
|
|
|
|
(advice-add 'popper-display-control-p :after 'magic_rb/popper-meow-motion)
|
|
#+end_src
|
|
|