* mu4e: improve buffer killing / switching behavior. less intrusive for other windows.
This commit is contained in:
@ -1025,16 +1025,7 @@ current window. "
|
||||
(insert (propertize "Waiting for message..."
|
||||
'face 'mu4e-system-face 'intangible t))
|
||||
(mu4e~proc-view docid mu4e-view-show-images))))
|
||||
|
||||
(defun mu4e~headers-quit-buffer ()
|
||||
"Quit the headers view and return to the main view."
|
||||
(interactive)
|
||||
(unless (eq major-mode 'mu4e-headers-mode)
|
||||
(error "Must be in mu4e-headers-mode (%S)" major-mode))
|
||||
(mu4e-mark-handle-when-leaving)
|
||||
(mu4e-quit-buffer)
|
||||
(mu4e~main-view))
|
||||
|
||||
|
||||
(defun mu4e-headers-rerun-search ()
|
||||
"Rerun the search for the last search expression."
|
||||
(interactive)
|
||||
@ -1162,5 +1153,33 @@ region if there is a region, then move to the next message."
|
||||
(mu4e-mark-for-move-set)
|
||||
(mu4e-headers-next))
|
||||
|
||||
(defun mu4e~headers-quit-buffer ()
|
||||
"Quit the mu4e-headers buffer. This is a rather complex function; to
|
||||
ensure we don't disturb other windows."
|
||||
(interactive)
|
||||
(unless (eq major-mode 'mu4e-headers-mode)
|
||||
(error "Must be in mu4e-headers-mode (%S)" major-mode))
|
||||
(mu4e-mark-handle-when-leaving)
|
||||
(let ((curbuf (current-buffer)) (curwin (selected-window))
|
||||
(headers-visible))
|
||||
(walk-windows
|
||||
(lambda (win)
|
||||
;; if we find a view window connect to this one, kill it
|
||||
(when (eq mu4e~headers-view-win win)
|
||||
(delete-window win)
|
||||
(setq mu4e~headers-view-win nil))
|
||||
;; and kill any _other_ (non-selected) window that shows the current
|
||||
;; buffer
|
||||
(when
|
||||
(and
|
||||
(eq curbuf (window-buffer win)) ;; does win show curbuf?
|
||||
(not (eq curwin win)) ;; but it's not the curwin?
|
||||
(not (one-window-p))) ;; and not the last one on the frame?
|
||||
(delete-window win)))) ;; delete it!
|
||||
;; now, all *other* windows should be gone. kill ourselves, and return
|
||||
;; to the main view
|
||||
(kill-buffer)
|
||||
(mu4e~main-view)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(provide 'mu4e-headers)
|
||||
|
||||
Reference in New Issue
Block a user