summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2016-05-26 10:51:58 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-05-26 10:51:58 +0200
commit655fb3396799082838f80cd04006fffe27e0e1f7 (patch)
tree4f51d044791bd482436d5c8862593f44be337d9e
parent4c58ee0a4b0bd6305df51c1e73c8a2226ed58041 (diff)
downloadorg-mode-655fb3396799082838f80cd04006fffe27e0e1f7.tar.gz
org-agenda: Effectively preserve persistent bulk marks
* lisp/org-agenda.el (org-agenda-change-all-lines): Preserve bulk mark overlay when replacing an entry. Reported-by: Jesse Johnson <holocronweaver@gmail.com> <http://permalink.gmane.org/gmane.emacs.orgmode/107299>
-rw-r--r--lisp/org-agenda.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 908190d..9a368f1 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8943,11 +8943,18 @@ If FORCE-TAGS is non nil, the car of it returns the new tags."
done-face (org-get-at-bol 'done-face))
(beginning-of-line 1)
(cond
- ((equal new "")
- (and (looking-at ".*\n?") (replace-match "")))
+ ((equal new "") (delete-region (point) (line-beginning-position 2)))
((looking-at ".*")
- (replace-match new t t)
- (beginning-of-line 1)
+ ;; When replacing the whole line, preserve bulk mark
+ ;; overlay, if any.
+ (let ((mark (catch :overlay
+ (dolist (o (overlays-in (point) (+ 2 (point))))
+ (when (eq (overlay-get o 'type)
+ 'org-marked-entry-overlay)
+ (throw :overlay o))))))
+ (replace-match new t t)
+ (beginning-of-line)
+ (when mark (move-overlay mark (point) (+ 2 (point)))))
(add-text-properties (point-at-bol) (point-at-eol) props)
(when fixface
(add-text-properties