summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Maus <dmaus@ictsoc.de>2010-07-06 00:28:34 +0000
committerCarsten Dominik <carsten.dominik@gmail.com>2010-07-06 08:55:02 +0200
commit4273e50ab703ea673e51ce57b7928731bd1765d3 (patch)
treebb2adbb9709c959c06ebdeebec79f8d94931bf10
parent6d889cc363c9fd8bb23b973ddd05505892b7faeb (diff)
downloadorg-mode-4273e50ab703ea673e51ce57b7928731bd1765d3.tar.gz
Don't create marker if target is entire file.
* org-agenda.el (org-agenda-bulk-action): Don't create marker for position if target is entire file. If the target of a bulk refile operation is the entire file, `org-refile-get-location' returns nil for the refile position. Creating a marker for the target file's buffer at position nil returns a marker that points nowhere (Cf. GNU Emacs Lisp Reference Manual, 31.6). `org-refile' adds headings to level 1 if the target position for the target file is nil -- and hence a marker that points nowhere is not nil, tries to jump to nowhere.
-rw-r--r--lisp/org-agenda.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 4345f06..1fe4639 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7489,11 +7489,12 @@ The prefix arg is passed through to the command if possible."
"Refile to: "
(marker-buffer (car org-agenda-bulk-marked-entries))
org-refile-allow-creating-parent-nodes))
- (setcar (nthcdr 3 rfloc)
- (move-marker (make-marker) (nth 3 rfloc)
- (or (get-file-buffer (nth 1 rfloc))
- (find-buffer-visiting (nth 1 rfloc))
- (error "This should not happen"))))
+ (if (nth 3 rfloc)
+ (setcar (nthcdr 3 rfloc)
+ (move-marker (make-marker) (nth 3 rfloc)
+ (or (get-file-buffer (nth 1 rfloc))
+ (find-buffer-visiting (nth 1 rfloc))
+ (error "This should not happen")))))
(setq cmd (list 'org-agenda-refile nil (list 'quote rfloc) t)
redo-at-end t))