Popup windows
This commit is contained in:
@@ -56,4 +56,99 @@
|
|||||||
("<left>" winner-undo "winner undo")
|
("<left>" winner-undo "winner undo")
|
||||||
("<right>" winner-redo "winner redo")))))
|
("<right>" winner-redo "winner redo")))))
|
||||||
|
|
||||||
|
(use-package popper
|
||||||
|
:custom
|
||||||
|
(popper-group-function #'popper-group-by-directory)
|
||||||
|
(popper-echo-dispatch-actions t)
|
||||||
|
h :bind (:map popper-mode-map
|
||||||
|
("C-h z" . popper-toggle)
|
||||||
|
("C-<tab>" . popper-cycle)
|
||||||
|
("C-M-<tab>" . popper-toggle-type))
|
||||||
|
:hook (emacs-startup . popper-echo-mode)
|
||||||
|
:init
|
||||||
|
(setq popper-mode-line ""
|
||||||
|
popper-reference-buffers
|
||||||
|
'("\\*Messages\\*$"
|
||||||
|
"Output\\*$" "\\*Pp Eval Output\\*$"
|
||||||
|
"^\\*eldoc.*\\*$"
|
||||||
|
"\\*Compile-Log\\*$"
|
||||||
|
"\\*Completions\\*$"
|
||||||
|
"\\*Warnings\\*$"
|
||||||
|
"\\*Async Shell Command\\*$"
|
||||||
|
"\\*Apropos\\*$"
|
||||||
|
"\\*Backtrace\\*$"
|
||||||
|
"\\*Calendar\\*$"
|
||||||
|
"\\*Fd\\*$" "\\*Find\\*$" "\\*Finder\\*$"
|
||||||
|
"\\*Kill Ring\\*$"
|
||||||
|
"\\*Embark \\(Collect\\|Live\\):.*\\*$"
|
||||||
|
|
||||||
|
bookmark-bmenu-mode
|
||||||
|
comint-mode
|
||||||
|
compilation-mode
|
||||||
|
help-mode helpful-mode
|
||||||
|
tabulated-list-mode
|
||||||
|
Buffer-menu-mode
|
||||||
|
|
||||||
|
flymake-diagnostics-buffer-mode
|
||||||
|
|
||||||
|
gnus-article-mode devdocs-mode
|
||||||
|
grep-mode occur-mode rg-mode
|
||||||
|
osx-dictionary-mode fanyi-mode
|
||||||
|
"^\\*gt-result\\*$" "^\\*gt-log\\*$"
|
||||||
|
|
||||||
|
"^\\*Process List\\*$" process-menu-mode
|
||||||
|
list-environment-mode cargo-process-mode
|
||||||
|
|
||||||
|
"^\\*.*eat.*\\*.*$"
|
||||||
|
"^\\*.*eshell.*\\*.*$"
|
||||||
|
"^\\*.*shell.*\\*.*$"
|
||||||
|
"^\\*.*terminal.*\\*.*$"
|
||||||
|
"^\\*.*vterm[inal]*.*\\*.*$"
|
||||||
|
|
||||||
|
"\\*DAP Templates\\*$" dap-server-log-mode
|
||||||
|
"\\*ELP Profiling Restuls\\*" profiler-report-mode
|
||||||
|
"\\*package update results\\*$" "\\*Package-Lint\\*$"
|
||||||
|
"\\*[Wo]*Man.*\\*$"
|
||||||
|
"\\*ert\\*$" overseer-buffer-mode
|
||||||
|
"\\*gud-debug\\*$"
|
||||||
|
"\\*lsp-help\\*$" "\\*lsp session\\*$"
|
||||||
|
"\\*quickrun\\*$"
|
||||||
|
"\\*tldr\\*$"
|
||||||
|
"\\*vc-.*\\**"
|
||||||
|
"\\*diff-hl\\**"
|
||||||
|
"^\\*macro expansion\\**"
|
||||||
|
|
||||||
|
"\\*Agenda Commands\\*" "\\*Org Select\\*" "\\*Capture\\*" "^CAPTURE-.*\\.org*"
|
||||||
|
"\\*Gofmt Errors\\*$" "\\*Go Test\\*$" godoc-mode
|
||||||
|
"\\*docker-.+\\*"
|
||||||
|
"\\*prolog\\*" inferior-python-mode inf-ruby-mode swift-repl-mode
|
||||||
|
"\\*rustfmt\\*$" rustic-compilation-mode rustic-cargo-clippy-mode
|
||||||
|
rustic-cargo-outdated-mode rustic-cargo-run-mode rustic-cargo-test-mode))
|
||||||
|
:config
|
||||||
|
(with-no-warnings
|
||||||
|
(defun my-popper-fit-window-height (win)
|
||||||
|
"Adjust the height of popup window WIN to fit the buffer's content."
|
||||||
|
(let ((desired-height (floor (/ (frame-height) 3))))
|
||||||
|
(fit-window-to-buffer win desired-height desired-height)))
|
||||||
|
(setq popper-window-height #'my-popper-fit-window-height)
|
||||||
|
|
||||||
|
(defun popper-close-window-hack (&rest _args)
|
||||||
|
"Close popper window via `C-g'."
|
||||||
|
(when (and ; (called-interactively-p 'interactive)
|
||||||
|
(not (region-active-p))
|
||||||
|
popper-open-popup-alist)
|
||||||
|
(let ((window (caar popper-open-popup-alist))
|
||||||
|
(buffer (cdar popper-open-popup-alist)))
|
||||||
|
(when (and (window-live-p window)
|
||||||
|
(buffer-live-p buffer)
|
||||||
|
(not (with-current-buffer buffer
|
||||||
|
(derived-mode-p 'eshell-mode
|
||||||
|
'shell-mode
|
||||||
|
'term-mode
|
||||||
|
'vterm-mode))))
|
||||||
|
(delete-window window)))))
|
||||||
|
(advice-add #'keyboard-quit :before #'popper-close-window-hack)))
|
||||||
|
|
||||||
|
|
||||||
(provide 'init-window)
|
(provide 'init-window)
|
||||||
|
;;; init-window.el ends here
|
||||||
|
|||||||
Reference in New Issue
Block a user