summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Wahl <marcowahlsoft@gmail.com>2019-03-21 15:46:13 +0100
committerMarco Wahl <marcowahlsoft@gmail.com>2019-03-21 20:54:24 +0100
commit5bee2fc955b7723490ecad6e6f76107277cb702a (patch)
tree086b315233a632c6822be6fb265d0e527957d4d7
parentd588274878241e4d37aac186a6d92110ba2a3711 (diff)
downloadorg-mode-5bee2fc955b7723490ecad6e6f76107277cb702a.tar.gz
org-agenda: Show the candidate for the kill
* lisp/org-agenda.el (org-agenda-kill): Display the subtree candidate for the kill with confirmation question.
-rw-r--r--lisp/org-agenda.el24
1 files changed, 15 insertions, 9 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index baf9c8d..2ccf3a0 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8477,7 +8477,7 @@ Point is in the buffer where the item originated.")
(buffer (marker-buffer marker))
(pos (marker-position marker))
(type (org-get-at-bol 'type))
- dbeg dend (n 0) conf)
+ dbeg dend (n 0))
(org-with-remote-undo buffer
(with-current-buffer buffer
(save-excursion
@@ -8489,14 +8489,20 @@ Point is in the buffer where the item originated.")
dend (min (point-max) (1+ (point-at-eol)))))
(goto-char dbeg)
(while (re-search-forward "^[ \t]*\\S-" dend t) (setq n (1+ n)))))
- (setq conf (or (eq t org-agenda-confirm-kill)
- (and (numberp org-agenda-confirm-kill)
- (> n org-agenda-confirm-kill))))
- (and conf
- (not (y-or-n-p
- (format "Delete entry with %d lines in buffer \"%s\"? "
- n (buffer-name buffer))))
- (error "Abort"))
+ (when (or (eq t org-agenda-confirm-kill)
+ (and (numberp org-agenda-confirm-kill)
+ (> n org-agenda-confirm-kill)))
+ (let ((win-conf (current-window-configuration)))
+ (unwind-protect
+ (and
+ (prog2
+ (org-agenda-tree-to-indirect-buffer nil)
+ (not (y-or-n-p
+ (format "Delete entry with %d lines in buffer \"%s\"? "
+ n (buffer-name buffer))))
+ (kill-buffer org-last-indirect-buffer))
+ (error "Abort"))
+ (set-window-configuration win-conf))))
(let ((org-agenda-buffer-name bufname-orig))
(org-remove-subtree-entries-from-agenda buffer dbeg dend))
(with-current-buffer buffer (delete-region dbeg dend))