commit 676b6b534ae324449e59996b7ec30a89dc25a1e6
parent e3d858d0aac7b93a5665d4b5f5490970fece1465
Author: andsy10 <andsy1016@gmail.com>
Date: Sun, 23 Aug 2026 02:08:10 +0800
Reorganize functions into their respective modules
Diffstat:
10 files changed, 254 insertions(+), 283 deletions(-)
diff --git a/lisp/init-base.el b/lisp/init-base.el
@@ -279,11 +279,17 @@
:straight nil
:init
(setq speedbar-window-default-width 30)
- :config
- (if (boundp 'speedbar-prefer-window)
- (setq speedbar-prefer-window t))
- (setq speedbar-use-images nil)
+ (defun my-speedbar ()
+ "Run `speedbar-get-focus' if current buffer is not speedbar, otherwise run `speedbar'"
+ (interactive)
+ (if (not (boundp 'speedbar-buffer))
+ (speedbar)
+ (if (eq (current-buffer) speedbar-buffer)
+ (speedbar)
+ (speedbar-get-focus))))
+
+ :config
(defun my-speedbar-line-expanded-p ()
"Return non-nil if the speedbar line at point is expanded."
(save-excursion
@@ -296,7 +302,11 @@
(interactive)
(if (my-speedbar-line-expanded-p)
(speedbar-contract-line)
- (speedbar-expand-line))))
+ (speedbar-expand-line)))
+
+ (if (boundp 'speedbar-prefer-window)
+ (setq speedbar-prefer-window t))
+ (setq speedbar-use-images nil))
(provide 'init-base)
;;; init-base.el ends here
diff --git a/lisp/init-completion.el b/lisp/init-completion.el
@@ -28,6 +28,56 @@
;; search and navigation
(use-package consult
:config
+ (defun my-consult-git-grep-project ()
+ "Run `consult-git-grep' in current project's root."
+ (interactive)
+ (when-let* ((proj (project-current t)))
+ (consult-git-grep (project-root proj))))
+
+ (defun consult-colors-emacs (color)
+ "Show a list of all supported colors for a particular frame.
+
+You can insert the name (default), or insert or kill the hexadecimal or RGB
+value of the selected COLOR."
+ (interactive
+ (list (consult--read (list-colors-duplicates (defined-colors))
+ :prompt "Emacs color: "
+ :require-match t
+ :category 'color
+ :history '(:input consult-colors-history))))
+ (insert color))
+
+ (defun consult-directory-externally (file)
+ "Open FILE externally using the default application of the system."
+ (interactive "fOpen externally: ")
+ (if (and (eq system-type 'windows-nt)
+ (fboundp 'w32-shell-execute))
+ (shell-command-to-string
+ (encode-coding-string
+ (replace-regexp-in-string "/" "\\\\"
+ (format "explorer.exe %s"
+ (file-name-directory
+ (expand-file-name file))))
+ 'gbk))
+ (call-process (pcase system-type
+ ('darwin "open")
+ ('cygwin "cygstart")
+ (_ "xdg-open"))
+ nil 0 nil
+ (file-name-directory (expand-file-name file)))))
+
+ (defun my-open-current-directory ()
+ "Open current directory in default file explorer."
+ (interactive)
+ (consult-directory-externally default-directory))
+
+ (defun consult-fd-home ()
+ "Search for all files in home folder use fd."
+ (interactive)
+ (let ((consult-fd-args "fd -H -I -i -c never --full-path")
+ (default-directory "~/"))
+ (consult-fd)))
+
;; set locate arguments
(cond
(*is-windows*
diff --git a/lisp/init-dired.el b/lisp/init-dired.el
@@ -33,6 +33,16 @@
:init
(dirvish-override-dired-mode)
:config
+ (defun my-dirvish-layout-toggle ()
+ "Toggle layout using first recipe in `dirvish-layout-recipes' instead of
+fallback."
+ (interactive)
+ (let ((dv (dirvish-curr)))
+ (unless dv (user-error "Not a dirvish buffer"))
+ (unless (dv-curr-layout dv)
+ (setf (dv-ff-layout dv) (car dirvish-layout-recipes)))
+ (dirvish-layout-toggle)))
+
(require 'vc)
(if (or *is-mac* *is-android*)
diff --git a/lisp/init-exwm.el b/lisp/init-exwm.el
@@ -142,7 +142,39 @@
(with-eval-after-load 'consult
(unless (memq 'xdg-launcher-consult-source consult-buffer-sources)
(setq consult-buffer-sources
- (append consult-buffer-sources '(xdg-launcher-consult-source)))))))
+ (append consult-buffer-sources '(xdg-launcher-consult-source))))))
+
+ (defun reboot ()
+ "Execute loginctl reboot command."
+ (interactive)
+ (eshell-command "loginctl reboot"))
+
+ (defun poweroff ()
+ "Execute loginctl poweroff command"
+ (interactive)
+ (eshell-command "loginctl poweroff"))
+
+ (defun suspend ()
+ "Execute loginctl suspend command"
+ (interactive)
+ (eshell-command "loginctl suspend"))
+
+ (defun my-desktop-init ()
+ "Launch something for linux desktop."
+ (interactive)
+ (unless (zerop (shell-command "pgrep -x mihomo"))
+ (start-process-shell-command "mihomo" nil "mihomo -d ~/.config/mihomo/"))
+ (start-process-shell-command "xrandr-refresh" nil "xrandr --output DP-4 --mode 2560x1440 --rate 165.00")
+ (start-process-shell-command "xinput" nil "xinput set-prop 12 'libinput Accel Speed' -0.45"))
+
+ (defun restart-fcitx5 ()
+ "Kill and restart fcitx5, to fix random issues in exwm."
+ (interactive)
+ (if (zerop (shell-command "pgrep fcitx5"))
+ (progn
+ (eshell-command "pkill fcitx5")
+ (eshell-command "fcitx5 -d"))
+ (eshell-command "fcitx5 -d"))))
(when *is-mac*
;; launcher
diff --git a/lisp/init-gptel.el b/lisp/init-gptel.el
@@ -147,7 +147,14 @@ explanations, no quotes, no punctuation, no file extension."
gptel-magit-backend (gptel-get-backend "gptel-Kimi-Code-magit"))))
;; pi
-(use-package pi-coding-agent)
+(use-package pi-coding-agent
+ :config
+ (defun my-pi-coding-agent ()
+ "Run `pi-coding-agent' in project root."
+ (interactive)
+ (when-let* ((proj (project-current t))
+ (default-directory (project-root proj)))
+ (pi-coding-agent))))
(provide 'init-gptel)
;;; init-gptel.el ends here
diff --git a/lisp/init-kbd-func.el b/lisp/init-kbd-func.el
@@ -35,15 +35,6 @@
(interactive)
(message "Emacs loaded in %s." (emacs-init-time)))
-(defun my-speedbar ()
- "Run `speedbar-get-focus' if current buffer is not speedbar, otherwise run `speedbar'"
- (interactive)
- (if (not (boundp 'speedbar-buffer))
- (speedbar)
- (if (eq (current-buffer) speedbar-buffer)
- (speedbar)
- (speedbar-get-focus))))
-
(defun my-straight-packages-count ()
"Count how many straight.el package are currently installed."
(interactive)
@@ -55,82 +46,6 @@
(dolist (item (hash-table-keys straight--profile-cache))
(insert (format "- %s\n" item))))
-(defun my-elfeed-search-show-entry-other-window ()
- "Like `elfeed-search-show-entry' but show the elfeed entry buffer in another window."
- (interactive)
- (let ((display-buffer-alist '(("\\*elfeed-entry\\*"
- (display-buffer-reuse-window
- display-buffer-pop-up-window)))))
- (call-interactively #'elfeed-search-show-entry)))
-
-(defun my-elfeed-search-preview-other-window ()
- "Preview currently selected elfeed entry in another window."
- (interactive)
- (let ((display-buffer-alist '(("\\*elfeed-entry\\*"
- (display-buffer-reuse-window
- display-buffer-pop-up-window))))
- (current-prefix-arg '(4)))
- (call-interactively #'elfeed-search-show-entry)))
-
-(defun my-jinx-smart-toggle ()
- "Toggle jinx-mode smartly.
-Disable jinx-mode if it's enable and global-jinx-mode is disable ,
-otherwise toggle global-jinx-mode."
- (interactive)
- (unless (featurep 'jinx)
- (require 'jinx))
- (let ((local-on (bound-and-true-p jinx-mode))
- (global-on (bound-and-true-p global-jinx-mode)))
- (cond
- ((and local-on (not global-on))
- (message "disable jinx-mode in current buffer")
- (jinx-mode -1))
- (t
- (if global-on
- (progn
- (message "disable global-jinx-mode")
- (global-jinx-mode -1))
- (progn
- (message "enable global-jinx-mode")
- (global-jinx-mode 1)))))))
-
-(defun popper-toggle-type-delete-other-window()
- "Toggle type of popper window and delete other window."
- (interactive)
- (popper-toggle-type)
- (delete-other-windows))
-
-(defun consult-directory-externally (file)
- "Open FILE externally using the default application of the system."
- (interactive "fOpen externally: ")
- (if (and (eq system-type 'windows-nt)
- (fboundp 'w32-shell-execute))
- (shell-command-to-string
- (encode-coding-string
- (replace-regexp-in-string "/" "\\\\"
- (format "explorer.exe %s"
- (file-name-directory
- (expand-file-name file))))
- 'gbk))
- (call-process (pcase system-type
- ('darwin "open")
- ('cygwin "cygstart")
- (_ "xdg-open"))
- nil 0 nil
- (file-name-directory (expand-file-name file)))))
-
-(defun my-open-current-directory ()
- "Open current directory in default file explorer."
- (interactive)
- (consult-directory-externally default-directory))
-
-(defun consult-fd-home ()
- "Search for all files in home folder use fd."
- (interactive)
- (let ((consult-fd-args "fd -H -I -i -c never --full-path")
- (default-directory "~/"))
- (consult-fd)))
-
(defun org-cycle-parent-subtree()
"Cycle parent org subtree."
(interactive)
@@ -141,35 +56,6 @@ otherwise toggle global-jinx-mode."
(org-back-to-heading)
(org-cycle)))
-(defun my-denote-journal-path-to-existing-entry (&optional date interval)
- "Return the path of current denote journal if it exists, otherwise return nil."
- (require 'denote-journal)
- (let* ((internal-date
- (denote-journal--date-in-interval-p (or date (current-time)) interval))
- (files (denote-journal--get-entry internal-date interval)))
- (if files
- (denote-journal-select-file-prompt files))))
-
-(defun my-denote-journal-open-entry ()
- "Open current denote-journal entry if it exists."
- (interactive)
- (if (my-denote-journal-path-to-existing-entry)
- (find-file (my-denote-journal-path-to-existing-entry))
- (message "No journal for today yet")))
-
-(defun my-denote-open-metanote ()
- "Open denote metanote in org directory"
- (interactive)
- (find-file
- (concat org-directory "/20260508T220745==metanote--all-my-metanotes__org.org")))
-
-(defun my-denote-find-file ()
- "Find file use denote-file-prompt."
- (interactive)
- (let* ((denote-excluded-files-regexp "=journal\\|=archive")
- (file (denote-file-prompt)))
- (find-file file)))
-
(defun my-blog-find-file ()
"Find blog file use denote-file-prompt."
(interactive)
@@ -183,27 +69,6 @@ otherwise toggle global-jinx-mode."
(interactive)
(consult-grep my-blog-directory))
-(defun my-denote-find-backlink-with-location ()
- "Like `denote-find-backlink-with-location' but with consult preview."
- (interactive)
- (when-let* ((current-file buffer-file-name)
- (id (or (denote-retrieve-filename-identifier current-file)
- (user-error "The current file does not have a Denote identifier")))
- (files (denote-directory-files nil :omit-current :text-only))
- (fetcher (lambda () (xref-matches-in-files id files))))
- (consult-xref fetcher nil)))
-
-(defun my-denote-org-find-backlink-for-heading-with-location ()
- "Like `denote-org-backlinks-for-heading' but with consult preview."
- (interactive)
- (unless (featurep 'denote-org)
- (require 'denote-org))
- (when-let* ((heading-id (or (denote-org--get-file-id-and-heading-id-or-context)
- (user-error "The current file does not have a denote identifier")))
- (files (denote-directory-files nil :omit-current :text-only))
- (fetcher (lambda () (xref-matches-in-files heading-id files))))
- (consult-xref fetcher nil)))
-
(defun my-org-table-align-all ()
"Ajust all table in current buffer."
(interactive)
@@ -240,143 +105,5 @@ otherwise toggle global-jinx-mode."
(interactive)
(my-push-with-timestamp my-blog-directory))
-(defun my-org-tree-slide-start ()
- "Start `org-tree-slide'."
- (interactive)
- (when (eq major-mode 'org-mode)
- (setq-local header-line-format nil
- mode-line-format nil
- cursor-type 'hbar
- olivetti-body-width 100)
- (blink-cursor-mode -1)
- (cnfonts-increase-fontsize 3)
- (hl-line-mode 'toggle)
- (read-only-mode 1)
- (jinx-mode -1)
- (org-tree-slide-mode 1)))
-
-(defun my-org-tree-slide-stop ()
- "Stop `org-tree-slide'."
- (interactive)
- (when (and (eq major-mode 'org-mode) (memq 'org-tree-slide-mode local-minor-modes))
- (org-mode-restart)
- (blink-cursor-mode 1)
- (cnfonts-decrease-fontsize 3)
- (hl-line-mode 1)
- (read-only-mode -1)
- (jinx-mode 1)
- (org-tree-slide-mode -1)))
-
-(defun my-dirvish-layout-toggle ()
- "Toggle layout using first recipe in `dirvish-layout-recipes' instead of
-fallback."
- (interactive)
- (let ((dv (dirvish-curr)))
- (unless dv (user-error "Not a dirvish buffer"))
- (unless (dv-curr-layout dv)
- (setf (dv-ff-layout dv) (car dirvish-layout-recipes)))
- (dirvish-layout-toggle)))
-
-(defun my-magit-toggle-parent-section ()
- "Toggle parent magit section."
- (interactive)
- (magit-section-up)
- (magit-section-toggle (magit-section-at)))
-
-(defun my-persp-remove-marked-ibuffers ()
- "Remove marked buffers from perspective."
- (interactive)
- (let ((buffers (ibuffer-get-marked-buffers)))
- (dolist (buf buffers)
- (persp-remove-buffer buf))))
-
-(defun my-persp-add-marked-ibuffers (persp-name)
- "Add marked buffers to perspective."
- (interactive
- (list (completing-read "Perspective: "
- (persp-names)
- nil nil)))
- (let ((buffers (ibuffer-get-marked-buffers)))
- (persp-switch persp-name)
- (dolist (buf buffers)
- (persp-add-buffer buf))))
-
-(defun my-persp-set-marked-ibuffers (persp-name)
- "Set marked buffers to perspective."
- (interactive
- (list (completing-read "Perspective: "
- (persp-names)
- nil nil)))
- (let ((buffers (ibuffer-get-marked-buffers)))
- (persp-switch persp-name)
- (dolist (buf buffers)
- (persp-set-buffer buf))))
-
-(defun my-gptel-agent-project ()
- "Run `gptel-agent' in current project's root (by run it with prefix
-argument)."
- (interactive)
- (let ((current-prefix-arg '-))
- (call-interactively #'gptel-agent)))
-
-(defun my-pi-coding-agent ()
- "Run `pi-coding-agent' in project root."
- (interactive)
- (when-let* ((proj (project-current t))
- (default-directory (project-root proj)))
- (pi-coding-agent)))
-
-(defun my-consult-git-grep-project ()
- "Run `consult-git-grep' in current project's root."
- (interactive)
- (when-let* ((proj (project-current t)))
- (consult-git-grep (project-root proj))))
-
-(defun consult-colors-emacs (color)
- "Show a list of all supported colors for a particular frame.
-
-You can insert the name (default), or insert or kill the hexadecimal or RGB
-value of the selected COLOR."
- (interactive
- (list (consult--read (list-colors-duplicates (defined-colors))
- :prompt "Emacs color: "
- :require-match t
- :category 'color
- :history '(:input consult-colors-history))))
- (insert color))
-
-(when *is-linux*
- (defun reboot ()
- "Execute loginctl reboot command."
- (interactive)
- (eshell-command "loginctl reboot"))
-
- (defun poweroff ()
- "Execute loginctl poweroff command"
- (interactive)
- (eshell-command "loginctl poweroff"))
-
- (defun suspend ()
- "Execute loginctl suspend command"
- (interactive)
- (eshell-command "loginctl suspend"))
-
- (defun my-desktop-init ()
- "Launch something for linux desktop."
- (interactive)
- (unless (zerop (shell-command "pgrep -x mihomo"))
- (start-process-shell-command "mihomo" nil "mihomo -d ~/.config/mihomo/"))
- (start-process-shell-command "xrandr-refresh" nil "xrandr --output DP-4 --mode 2560x1440 --rate 165.00")
- (start-process-shell-command "xinput" nil "xinput set-prop 12 'libinput Accel Speed' -0.45"))
-
- (defun restart-fcitx5 ()
- "Kill and restart fcitx5, to fix random issues in exwm."
- (interactive)
- (if (zerop (shell-command "pgrep fcitx5"))
- (progn
- (eshell-command "pkill fcitx5")
- (eshell-command "fcitx5 -d"))
- (eshell-command "fcitx5 -d"))))
-
(provide 'init-kbd-func)
;;; init-kbd-func.el ends here
diff --git a/lisp/init-kbd.el b/lisp/init-kbd.el
@@ -105,7 +105,7 @@
(general-def
:prefix "C-c t"
"f" #'flycheck-mode
- "j" #'my-jinx-smart-toggle
+ "j" #'jinx-mode
"g" #'gptel-mode
"h" #'global-diff-hl-mode)
diff --git a/lisp/init-org.el b/lisp/init-org.el
@@ -99,6 +99,40 @@
(after-init . denote-rename-buffer-mode)
(dired-mode . denote-dired-mode)
:init
+ (defun my-denote-find-file ()
+ "Find file use denote-file-prompt."
+ (interactive)
+ (let* ((denote-excluded-files-regexp "=journal\\|=archive")
+ (file (denote-file-prompt)))
+ (find-file file)))
+
+ (defun my-denote-open-metanote ()
+ "Open denote metanote in org directory"
+ (interactive)
+ (find-file
+ (concat org-directory "/20260508T220745==metanote--all-my-metanotes__org.org")))
+
+ (defun my-denote-find-backlink-with-location ()
+ "Like `denote-find-backlink-with-location' but with consult preview."
+ (interactive)
+ (when-let* ((current-file buffer-file-name)
+ (id (or (denote-retrieve-filename-identifier current-file)
+ (user-error "The current file does not have a Denote identifier")))
+ (files (denote-directory-files nil :omit-current :text-only))
+ (fetcher (lambda () (xref-matches-in-files id files))))
+ (consult-xref fetcher nil)))
+
+ (defun my-denote-org-find-backlink-for-heading-with-location ()
+ "Like `denote-org-backlinks-for-heading' but with consult preview."
+ (interactive)
+ (unless (featurep 'denote-org)
+ (require 'denote-org))
+ (when-let* ((heading-id (or (denote-org--get-file-id-and-heading-id-or-context)
+ (user-error "The current file does not have a denote identifier")))
+ (files (denote-directory-files nil :omit-current :text-only))
+ (fetcher (lambda () (xref-matches-in-files heading-id files))))
+ (consult-xref fetcher nil)))
+
(setq denote-directory org-directory)
(setq denote-org-store-link-to-heading 'context
denote-prompts '(title signature keywords))
@@ -125,7 +159,23 @@
(use-package denote-journal
:hook
(calendar-mode . denote-journal-calendar-mode)
- :config
+ :init
+ (defun my-denote-journal-path-to-existing-entry (&optional date interval)
+ "Return the path of current denote journal if it exists, otherwise return nil."
+ (require 'denote-journal)
+ (let* ((internal-date
+ (denote-journal--date-in-interval-p (or date (current-time)) interval))
+ (files (denote-journal--get-entry internal-date interval)))
+ (if files
+ (denote-journal-select-file-prompt files))))
+
+ (defun my-denote-journal-open-entry ()
+ "Open current denote-journal entry if it exists."
+ (interactive)
+ (if (my-denote-journal-path-to-existing-entry)
+ (find-file (my-denote-journal-path-to-existing-entry))
+ (message "No journal for today yet")))
+
(setq denote-journal-directory (expand-file-name "journal" denote-directory))
(setq denote-journal-keyword nil)
(setq denote-journal-signature "journal")
@@ -241,7 +291,34 @@
"* GAME %?\n%T" :empty-lines 1))))
;; presentation
-(use-package org-tree-slide)
+(use-package org-tree-slide
+ :init
+ (defun my-org-tree-slide-start ()
+ "Start `org-tree-slide'."
+ (interactive)
+ (when (eq major-mode 'org-mode)
+ (setq-local header-line-format nil
+ mode-line-format nil
+ cursor-type 'hbar
+ olivetti-body-width 100)
+ (blink-cursor-mode -1)
+ (cnfonts-increase-fontsize 3)
+ (hl-line-mode 'toggle)
+ (read-only-mode 1)
+ (jinx-mode -1)
+ (org-tree-slide-mode 1)))
+
+ (defun my-org-tree-slide-stop ()
+ "Stop `org-tree-slide'."
+ (interactive)
+ (when (and (eq major-mode 'org-mode) (memq 'org-tree-slide-mode local-minor-modes))
+ (org-mode-restart)
+ (blink-cursor-mode 1)
+ (cnfonts-decrease-fontsize 3)
+ (hl-line-mode 1)
+ (read-only-mode -1)
+ (jinx-mode 1)
+ (org-tree-slide-mode -1))))
;; Chinese calendar
(use-package cal-china-x
diff --git a/lisp/init-package.el b/lisp/init-package.el
@@ -100,6 +100,35 @@ _a_ : all dwim
:hook
(after-init . persp-mode)
:config
+ (defun my-persp-remove-marked-ibuffers ()
+ "Remove marked buffers from perspective."
+ (interactive)
+ (let ((buffers (ibuffer-get-marked-buffers)))
+ (dolist (buf buffers)
+ (persp-remove-buffer buf))))
+
+ (defun my-persp-add-marked-ibuffers (persp-name)
+ "Add marked buffers to perspective."
+ (interactive
+ (list (completing-read "Perspective: "
+ (persp-names)
+ nil nil)))
+ (let ((buffers (ibuffer-get-marked-buffers)))
+ (persp-switch persp-name)
+ (dolist (buf buffers)
+ (persp-add-buffer buf))))
+
+ (defun my-persp-set-marked-ibuffers (persp-name)
+ "Set marked buffers to perspective."
+ (interactive
+ (list (completing-read "Perspective: "
+ (persp-names)
+ nil nil)))
+ (let ((buffers (ibuffer-get-marked-buffers)))
+ (persp-switch persp-name)
+ (dolist (buf buffers)
+ (persp-set-buffer buf))))
+
(setq persp-switch-to-buffer-behavior 'switch)
(with-eval-after-load 'consult
(consult-customize consult-source-buffer :hidden t :default nil)
@@ -114,6 +143,12 @@ _a_ : all dwim
;; magit
(use-package magit
:config
+ (defun my-magit-toggle-parent-section ()
+ "Toggle parent magit section."
+ (interactive)
+ (magit-section-up)
+ (magit-section-toggle (magit-section-at)))
+
(setq magit-bind-magit-project-status nil)
(unless *is-windows*
(setq magit-diff-refine-hunk 'all)))
@@ -279,6 +314,23 @@ _a_ : all dwim
;; elfeed
(use-package elfeed
:config
+ (defun my-elfeed-search-show-entry-other-window ()
+ "Like `elfeed-search-show-entry' but show the elfeed entry buffer in another window."
+ (interactive)
+ (let ((display-buffer-alist '(("\\*elfeed-entry\\*"
+ (display-buffer-reuse-window
+ display-buffer-pop-up-window)))))
+ (call-interactively #'elfeed-search-show-entry)))
+
+ (defun my-elfeed-search-preview-other-window ()
+ "Preview currently selected elfeed entry in another window."
+ (interactive)
+ (let ((display-buffer-alist '(("\\*elfeed-entry\\*"
+ (display-buffer-reuse-window
+ display-buffer-pop-up-window))))
+ (current-prefix-arg '(4)))
+ (call-interactively #'elfeed-search-show-entry)))
+
(setq elfeed-curl-timeout 600)
(setq-default elfeed-search-filter ""))
diff --git a/lisp/init-window.el b/lisp/init-window.el
@@ -113,6 +113,12 @@
(kill-local-variable 'window--sides-shown)))
(advice-add #'popper-raise-popup :after #'my-popper-clear-sides-shown)
+ (defun popper-toggle-type-delete-other-window()
+ "Toggle type of popper window and delete other window."
+ (interactive)
+ (popper-toggle-type)
+ (delete-other-windows))
+
(defun popper-close-window-hack (&rest _)
"Close popper window via `C-g'."
;; `C-g' can deactivate region