summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.config/emacs-kj/init.el51
1 files changed, 39 insertions, 12 deletions
diff --git a/emacs/.config/emacs-kj/init.el b/emacs/.config/emacs-kj/init.el
index a8e1c2e..43d42d4 100644
--- a/emacs/.config/emacs-kj/init.el
+++ b/emacs/.config/emacs-kj/init.el
@@ -817,6 +817,7 @@
;;; Window placement
;;; TODO: Test popper.el.
(global-set-key (kbd "C-`") #'window-toggle-side-windows)
+(global-set-key (kbd "M-`") #'kj/popup-toggle-override)
(setq window-sides-slots '(0 0 2 2)) ; 2 right side windows
(setq switch-to-buffer-obey-display-actions t)
(setq switch-to-buffer-in-dedicated-window 'pop)
@@ -826,10 +827,31 @@
;; (add-to-list 'display-buffer-alist
;; '("\\*info" (display-buffer-same-window)))
-(defun kj/popup-buffer (buffer condition)
- (or (s-matches-p (rx (| "*Help*"
+(defvar kj/popup-override nil)
+
+(defun kj/popup-clear-overrides ()
+ (interactive)
+ (dolist (buffer (buffer-list))
+ (with-current-buffer buffer
+ (kill-local-variable 'kj/popup-override))))
+
+(defun kj/popup-toggle-override ()
+ (interactive)
+ (if (local-variable-p 'kj/popup-override)
+ (kill-local-variable 'kj/popup-override)
+ (setq-local kj/popup-override
+ (not (kj/popup-buffer-base (buffer-name)))))
+ (let ((buffer (buffer-name)))
+ (switch-to-prev-buffer)
+ (switch-to-buffer buffer)))
+
+(defun kj/popup-buffer-base (buffer &optional condition)
+ (or
+ (s-matches-p (rx (| "*Help*"
"*info*"
+ (seq "*scratch*")
(seq "*Messages*")
+ (seq "*Backtrace*")
(seq "*eldoc " (* anything) "*")
(seq "*WoMan " (* anything) "*")
(seq "*man " (* anything) "*")
@@ -838,13 +860,19 @@
(seq "*Proced*" (* anything))
(seq "*eshell*" (* anything))
"*Occur*")) buffer)
- (with-current-buffer buffer
- (apply #'derived-mode-p
- '(magit-mode
- compilation-mode
- comint-mode
- Custom-mode ; For customization
- fig-commit-mode)))))
+ (with-current-buffer buffer
+ (apply #'derived-mode-p
+ '(magit-mode
+ compilation-mode
+ comint-mode
+ Custom-mode ; For customization
+ fig-commit-mode)))))
+
+(defun kj/popup-buffer (buffer &optional condition)
+ (with-current-buffer buffer
+ (if (local-variable-p 'kj/popup-override)
+ kj/popup-override
+ (kj/popup-buffer-base buffer condition))))
(setq transient-display-buffer-action
'(display-buffer-in-best-side
@@ -865,9 +893,8 @@
(add-to-list 'display-buffer-alist
`(kj/popup-buffer
- (display-buffer-in-best-side)
- (slot . 0)
- ))
+ (display-buffer-in-best-side)
+ (slot . 0)))
;; Calendar settings.
(setq calendar-week-start-day 1)