Files
.emacs.d/lisp/init-window.el
User 61d09a4625 refactor(config): Update Emacs configuration across multiple modules
- Prefix gptel backend names with "gptel-" for consistency
- Add denote-org-backlinks-for-heading keybinding
- Refine recentf exclusions for org journal files
- Remove org-default-priority setting
- Add gptel and denote backlink buffer rules to ibuffer
- Enable markdown-ts-mode for Emacs 31+ with truncate lines
- Add electric-pair support for equals sign
- Update popper and window management regexes for new buffer names
2026-05-27 04:06:12 +08:00

123 lines
3.9 KiB
EmacsLisp
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
;;; init-window.el --- windows manage packages -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
(use-package popper
:defines
popper-echo-dispatch-actions
:commands
popper-group-by-directory
:hook
(emacs-startup . popper-mode)
:init
(setq popper-reference-buffers
'("\\*Messages\\*"
"Output\\*$" "\\*Pp Eval Output\\*$"
"\\*Compile-Log\\*"
"\\*Completions\\*"
"\\*Warnings\\*"
"\\*Flymake diagnostics.*\\*"
"\\*Async Shell Command\\*"
"\\*Apropos\\*"
"\\*Backtrace\\*"
"\\*prodigy\\*"
"\\*Calendar\\*"
"\\*Holidays\\*"
"\\*Embark Actions\\*"
"\\*Finder\\*"
"\\*Kill Ring\\*"
"\\*Embark Export:.*\\*"
"\\*Edit Annotation.*\\*"
"\\*Flutter\\*"
"\\*Ibuffer\\*"
"Buffers\\*$"
"\\*Geiser Debug\\*"
"\\*gptel-Kimi-Code\\*"
"\\*gptel-agent:.*\\*"
"^magit"
bookmark-bmenu-mode
lsp-bridge-ref-mode
comint-mode
compilation-mode
help-mode helpful-mode
tabulated-list-mode
Buffer-menu-mode
occur-mode
gnus-article-mode devdocs-mode
grep-mode occur-mode rg-mode deadgrep-mode ag-mode pt-mode
ivy-occur-mode ivy-occur-grep-mode
process-menu-mode list-environment-mode cargo-process-mode
youdao-dictionary-mode osx-dictionary-mode fanyi-mode
gptel-mode
ibuffer-mode
"^\\*eshell.*\\*.*$" eshell-mode
".*eshell\\*$"
"^\\*shell.*\\*.*$" shell-mode
"^\\*terminal.*\\*.*$" term-mode
"^\\*vterm.*\\*.*$" vterm-mode
"^\\*eat.*\\*.*$" eat-mode
"\\*DAP Templates\\*$" dap-server-log-mode
"\\*ELP Profiling Restuls\\*" profiler-report-mode
"\\*Flycheck errors\\*$" " \\*Flycheck checker\\*$"
"\\*Paradox Report\\*$" "\\*package update results\\*$" "\\*Package-Lint\\*$"
"\\*[Wo]*Man.*\\*$"
"\\*ert\\*$" overseer-buffer-mode
"\\*gud-debug\\*$"
"\\*lsp-help\\*$" "\\*lsp session\\*$"
"\\*quickrun\\*$"
"\\*tldr\\*$"
"\\*vc-.*\\*$"
"\\*eldoc\\*"
"^\\*elfeed-entry\\*$"
"^\\*macro expansion\\**"
"\\*Agenda Commands\\*" "\\*Org Select\\*" "\\*Capture\\*" "^CAPTURE-.*\\.org*" "^CAPTURE-"
"\\*Gofmt Errors\\*$" "\\*Go Test\\*$" godoc-mode
"\\*docker-containers\\*" "\\*docker-images\\*" "\\*docker-networks\\*" "\\*docker-volumes\\*"
"\\*prolog\\*" inferior-python-mode inf-ruby-mode swift-repl-mode
"\\*rustfmt\\*$" rustic-compilation-mode rustic-cargo-clippy-mode
rustic-cargo-outdated-mode rustic-cargo-test-mode
"^\\*\\[D\\] FILE backlinks for" "^\\*Denote HEADING backlinks for"))
(when (display-grayscale-p)
(setq popper-mode-line
'("[POP]")))
(setq popper-echo-dispatch-actions t)
(setq popper-group-function nil)
:config
(popper-echo-mode 1)
(with-no-warnings
(defun my-popper-fit-window-height (win)
"Determine the height of popup window WIN by fitting it to the buffer's content."
(fit-window-to-buffer
win
(floor (frame-height) 3)
(floor (frame-height) 3)))
(setq popper-window-height #'my-popper-fit-window-height)
(defun popper-close-window-hack (&rest _)
"Close popper window via `C-g'."
;; `C-g' can deactivate region
(when (and (called-interactively-p 'interactive)
(not (region-active-p))
popper-open-popup-alist)
(let ((window (caar popper-open-popup-alist)))
(when (window-live-p window)
(delete-window window)))))
(advice-add #'keyboard-quit :before #'popper-close-window-hack)))
;; es-windos快速管理窗口
(use-package es-windows)
(provide 'init-window)
;;; init-window.el ends here