* mu4e: fix target == nil case in mu4e-mark-set (thanks to Jonas Bernoulli)
Previously when TARGET was nil, point was moved which changed the region that is later used to determine the messages to be marked.
This commit is contained in:
@ -177,15 +177,17 @@ otherwise return nil."
|
|||||||
(defun mu4e-mark-set (mark &optional target)
|
(defun mu4e-mark-set (mark &optional target)
|
||||||
"Mark the header at point, or, if region is active, mark all
|
"Mark the header at point, or, if region is active, mark all
|
||||||
headers in the region. Optionally, provide TARGET (for moves)."
|
headers in the region. Optionally, provide TARGET (for moves)."
|
||||||
|
(unless target
|
||||||
|
(setq target (mu4e~mark-get-target mark target)))
|
||||||
(if (not (use-region-p))
|
(if (not (use-region-p))
|
||||||
;; single message
|
;; single message
|
||||||
(mu4e-mark-at-point mark (or target (mu4e~mark-get-target mark target)))
|
(mu4e-mark-at-point mark target)
|
||||||
;; mark all messages in the region.
|
;; mark all messages in the region.
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(let ((cant-go-further) (eor (region-end)))
|
(let ((cant-go-further) (eor (region-end)))
|
||||||
(goto-char (region-beginning))
|
(goto-char (region-beginning))
|
||||||
(while (and (<= (point) eor) (not cant-go-further))
|
(while (and (<= (point) eor) (not cant-go-further))
|
||||||
(mu4e-mark-at-point mark (or target (mu4e~mark-get-target mark target)))
|
(mu4e-mark-at-point mark target)
|
||||||
(setq cant-go-further (not (mu4e-headers-next))))))))
|
(setq cant-go-further (not (mu4e-headers-next))))))))
|
||||||
|
|
||||||
(defun mu4e-mark-restore (docid)
|
(defun mu4e-mark-restore (docid)
|
||||||
|
|||||||
Reference in New Issue
Block a user