mirror of
https://github.com/djcb/mu.git
synced 2024-06-29 07:51:04 +02:00
* mu4e-hdrs.el: fix some of the header-view-split corner cases
This commit is contained in:
parent
edda59bff7
commit
f2bbf744aa
|
@ -99,9 +99,11 @@ headers."
|
||||||
(let* ((docid (plist-get msg :docid))
|
(let* ((docid (plist-get msg :docid))
|
||||||
(point (mu4e--docid-pos docid)))
|
(point (mu4e--docid-pos docid)))
|
||||||
(when point ;; is the message present in this list?
|
(when point ;; is the message present in this list?
|
||||||
|
|
||||||
;; if it's marked, unmark it now
|
;; if it's marked, unmark it now
|
||||||
(when (mu4e-hdrs-docid-is-marked docid)
|
(when (mu4e-hdrs-docid-is-marked docid)
|
||||||
(mu4e-hdrs-mark 'unmark))
|
(mu4e-hdrs-mark 'unmark))
|
||||||
|
|
||||||
;; first, remove the old one (otherwise, we'd have two headers with
|
;; first, remove the old one (otherwise, we'd have two headers with
|
||||||
;; the same docid...
|
;; the same docid...
|
||||||
(mu4e-hdrs-remove-handler docid)
|
(mu4e-hdrs-remove-handler docid)
|
||||||
|
@ -114,16 +116,17 @@ headers."
|
||||||
(when (and viewbuf (buffer-live-p viewbuf))
|
(when (and viewbuf (buffer-live-p viewbuf))
|
||||||
(with-current-buffer viewbuf
|
(with-current-buffer viewbuf
|
||||||
(when (eq docid (plist-get mu4e-current-msg :docid))
|
(when (eq docid (plist-get mu4e-current-msg :docid))
|
||||||
(setq mu4e-current-msg msg)
|
(mu4e-view msg mu4e-hdrs-buffer)))))
|
||||||
;; and re-highlight this message
|
|
||||||
(mu4e-hdrs-highlight docid)))))
|
|
||||||
|
|
||||||
;; now, if this update was about *moving* a message, we don't show it
|
;; now, if this update was about *moving* a message, we don't show it
|
||||||
;; anymore (of course, we cannot be sure if the message really no
|
;; anymore (of course, we cannot be sure if the message really no
|
||||||
;; longer matches the query, but this seem a good heuristic.
|
;; longer matches the query, but this seem a good heuristic.
|
||||||
;; if it was only a flag-change, show the message with its updated flags.
|
;; if it was only a flag-change, show the message with its updated flags.
|
||||||
(unless is-move
|
(unless is-move
|
||||||
(mu4e-hdrs-header-handler msg point)))))))
|
(mu4e-hdrs-header-handler msg point))
|
||||||
|
|
||||||
|
;; attempt to highlight the corresponding line and make it visible
|
||||||
|
(mu4e-hdrs-highlight docid))))))
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e-hdrs-remove-handler (docid)
|
(defun mu4e-hdrs-remove-handler (docid)
|
||||||
|
@ -360,6 +363,7 @@ after the end of the search results."
|
||||||
(make-local-variable 'mu4e-hdrs-proc)
|
(make-local-variable 'mu4e-hdrs-proc)
|
||||||
(make-local-variable 'mu4e-marks-map)
|
(make-local-variable 'mu4e-marks-map)
|
||||||
(make-local-variable 'mu4e-thread-info-map)
|
(make-local-variable 'mu4e-thread-info-map)
|
||||||
|
(make-local-variable 'mu4e--highlighted-docid)
|
||||||
|
|
||||||
(make-local-variable 'global-mode-string)
|
(make-local-variable 'global-mode-string)
|
||||||
(make-local-variable 'hl-line-face)
|
(make-local-variable 'hl-line-face)
|
||||||
|
@ -496,8 +500,7 @@ at (point-max) otherwise. If MSG is not nil, add it as the text-property `msg'."
|
||||||
(propertize
|
(propertize
|
||||||
(concat
|
(concat
|
||||||
(mu4e--docid-cookie docid)
|
(mu4e--docid-cookie docid)
|
||||||
mu4e-hdrs-fringe str "\n")
|
mu4e-hdrs-fringe str "\n") 'docid docid 'msg msg)))))))
|
||||||
'docid docid 'msg msg)))))))
|
|
||||||
|
|
||||||
(defun mu4e-hdrs-remove-header (docid)
|
(defun mu4e-hdrs-remove-header (docid)
|
||||||
"Remove header with DOCID at POINT."
|
"Remove header with DOCID at POINT."
|
||||||
|
@ -766,11 +769,12 @@ docid. Otherwise, return nil."
|
||||||
(with-current-buffer mu4e-hdrs-buffer
|
(with-current-buffer mu4e-hdrs-buffer
|
||||||
(unless (buffer-live-p mu4e-hdrs-buffer)
|
(unless (buffer-live-p mu4e-hdrs-buffer)
|
||||||
(error "Headers buffer is not alive %S" (current-buffer)))
|
(error "Headers buffer is not alive %S" (current-buffer)))
|
||||||
(set-window-point (get-buffer-window mu4e-hdrs-buffer) (point))
|
|
||||||
(let ((succeeded (= 0 (forward-line lines)))
|
(let ((succeeded (= 0 (forward-line lines)))
|
||||||
(docid (mu4e--docid-at-point)))
|
(docid (mu4e--docid-at-point)))
|
||||||
;; trick to move point, even if this function is called when this window
|
;; trick to move point, even if this function is called when this window
|
||||||
;; is not visible
|
;; is not visible
|
||||||
|
(set-window-point (get-buffer-window mu4e-hdrs-buffer) (point))
|
||||||
|
;; attempt to highlight the new line
|
||||||
(mu4e-hdrs-highlight docid)
|
(mu4e-hdrs-highlight docid)
|
||||||
;; return the docid only if the move succeeded
|
;; return the docid only if the move succeeded
|
||||||
(when succeeded docid))))
|
(when succeeded docid))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user