summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-10-16 22:48:43 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-10-16 22:48:43 +0200
commit00571cbd36b0994154a2230d17505bf4930ce11b (patch)
tree4b47dc4e511128d51b1cf6f2e8697612467424dd
parenta78c835e88316f94544cfaca19fe341b5e7fdb31 (diff)
downloadebsd-00571cbd36b0994154a2230d17505bf4930ce11b.tar.gz
Emacs: Fix buffer layout bug (quit-window)
-rw-r--r--.emacs.d/init.el36
1 files changed, 22 insertions, 14 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 26ef5ff..dc7f931 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -38,7 +38,7 @@
(interactive)
(let ((sexp (list-at-point)))
(unless (string-prefix-p "set" (prin1-to-string (car sexp)))
- (error "Not a set* expression."))
+ (error "Not a set* expression"))
(let ((bounds (thing-at-point-bounds-of-list-at-point))
(max-length 0))
(delete-region (car bounds) (cdr bounds))
@@ -147,7 +147,7 @@
([?\M-f] . [C-right])
([?\M-b] . [C-left])))
(setq exwm-input-global-keys '(("" . exwm-input-send-next-key)))
-(setf (car exwm-input-prefix-keys) ?\C-§)
+(push ?\C-§ exwm-input-prefix-keys)
(setq exwm-manage-force-tiling t)
(exwm-enable)
@@ -196,10 +196,10 @@
(if conf
(progn
(set-window-configuration conf)
- (message "Restored buffer layout."))
+ (message "Restored buffer layout"))
(setf (alist-get (current-buffer) *buffer-layouts*)
(current-window-configuration))
- (message "Set buffer layout."))))
+ (message "Set buffer layout"))))
(defun switch-to-buffer-with-layout ()
"Switch to the window layout associated with a buffer. At the
same time, associate the original buffer with the original
@@ -219,16 +219,23 @@ the only window in the frame."
(when conf
(set-window-configuration conf)
(select-window (get-buffer-window buf))))))
-(defun delete-layouts-before-delete-other-windows (&optional window)
- (when (not *protect-buffer-layouts*)
- (dolist (window (window-list))
- (setf (alist-get (window-buffer window) *buffer-layouts*) nil))))
-(defun delete-layout-before-delete-window (window)
- (when (not *protect-buffer-layouts*)
- (setf (alist-get (window-buffer window) *buffer-layouts*) nil)))
-(advice-add #'delete-other-windows :before #'delete-layouts-before-delete-other-windows)
-(advice-add #'delete-window :before #'delete-layout-before-delete-window)
-(advice-add #'quit-window :before #'delete-layout-before-delete-window)
+(advice-add #'delete-other-windows :before
+ (lambda (&optional window)
+ (when (not *protect-buffer-layouts*)
+ (dolist (window (window-list))
+ (setf (alist-get (window-buffer window) *buffer-layouts*) nil)))))
+(advice-add #'delete-window :before
+ (lambda (&optional window)
+ (when (not window)
+ (setq window (get-buffer-window)))
+ (when (not *protect-buffer-layouts*)
+ (setf (alist-get (window-buffer window) *buffer-layouts*) nil))))
+(advice-add #'quit-window :before
+ (lambda (&optional kill window)
+ (when (not window)
+ (setq window (get-buffer-window)))
+ (when (not *protect-buffer-layouts*)
+ (setf (alist-get (window-buffer window) *buffer-layouts*) nil))))
(set-keys "C-c b" switch-to-buffer-with-layout
"C-c n" restore-buffer-layout)
@@ -330,6 +337,7 @@ the only window in the frame."
(awk-mode . "awk")
(other . "bsd"))))
'(helm-always-two-windows t)
+ '(mouse-autoselect-window t)
'(org-support-shift-select t)
'(package-selected-packages
(quote