aboutsummaryrefslogtreecommitdiff
path: root/eb.el
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-30 01:54:45 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-30 01:54:45 +0200
commit16ba8f3ae15363e921fca0e97f5c89cf12987b21 (patch)
tree358ba833e9e076cba297c32ec56ad7091b01621f /eb.el
parent530a0eba427d3a817e2dd97cba120f100104d984 (diff)
downloadEpisodeBrowser-16ba8f3ae15363e921fca0e97f5c89cf12987b21.tar.gz
eb.el: Fix eb--fleeting--window-hook.
Diffstat (limited to 'eb.el')
-rw-r--r--eb.el41
1 files changed, 26 insertions, 15 deletions
diff --git a/eb.el b/eb.el
index 70bdde1..7ca810a 100644
--- a/eb.el
+++ b/eb.el
@@ -66,23 +66,34 @@
(setq eb--fleeting--window (and eb--fleeting-minor-mode (get-buffer-window))))
(add-hook 'pre-command-hook #'eb--fleeting--pre-command-hook)
-(defun eb--fleeting--window-hook ()
- (when (and eb--fleeting--buffer
- eb--fleeting--window)
- (if (and (equal eb--fleeting--window (selected-window))
- (not (equal eb--fleeting--buffer (window-buffer))))
- (progn
- (with-current-buffer eb--fleeting--buffer
+(define-key global-map [f12] (lambda () (interactive) (message "%s" eb--fleeting--buffer)))
+
+(defun eb--fleeting--window-hook (&rest r)
+ (let ((fleeting-buffer eb--fleeting--buffer)
+ (fleeting-window eb--fleeting--window)
+ (buffer (window-buffer))
+ (window (selected-window)))
+ (when (and fleeting-buffer fleeting-window)
+ (if (and (equal fleeting-window window)
+ (equal fleeting-buffer buffer))
+ (with-current-buffer fleeting-buffer
(eb--fleeting-minor-mode -1))
- (bury-buffer eb--fleeting--buffer)
- (let ((new-buffer (window-buffer)))
- (select-window (eb--fleeting--main-window eb--fleeting--buffer eb--fleeting--window))
- (switch-to-buffer new-buffer))
- (delete-window eb--fleeting--window))
- (when (not (get-buffer-window eb--fleeting--buffer))
- (with-current-buffer eb--fleeting--buffer
- (eb--fleeting-minor-mode -1))))))
+ (if (and (equal fleeting-window window)
+ (not (equal fleeting-buffer buffer)))
+ (progn
+ (with-current-buffer fleeting-buffer
+ (eb--fleeting-minor-mode -1))
+ (bury-buffer fleeting-buffer)
+ (setq eb--fleeting--window nil)
+ (select-window (eb--fleeting--main-window fleeting-buffer fleeting-window))
+ (switch-to-buffer buffer)
+ (delete-window fleeting-window))
+ (if (get-buffer-window fleeting-buffer)
+ (delete-window fleeting-window)
+ (with-current-buffer fleeting-buffer
+ (eb--fleeting-minor-mode -1))))))))
(add-hook 'window-configuration-change-hook #'eb--fleeting--window-hook)
+(add-hook 'window-selection-change-functions #'eb--fleeting--window-hook)
;;;###autoload
(defun eb-quit-or-bury ()