diff options
-rw-r--r-- | eb.el | 41 |
1 files changed, 26 insertions, 15 deletions
@@ -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 () |