Browse Source

Make org-refile interface for jumping to a target work before first heading

* lisp/org.el (org-refile-get-location): Ignore errors when
collection heading to be excluded.
Carsten Dominik 6 years ago
1 changed files with 9 additions and 4 deletions
  1. 9 4

+ 9 - 4

@@ -10477,7 +10477,8 @@ prefix argument (`C-u C-u C-u C-c C-w')."
 			       (cond (goto "Goto")
 				     (regionp "Refile region to")
 				     (t "Refile subtree to")) default-buffer
-			       org-refile-allow-creating-parent-nodes)))))
+			       org-refile-allow-creating-parent-nodes
+			       goto)))))
 	  (setq file (nth 1 it)
 		re (nth 2 it)
 		pos (nth 3 it))
@@ -10556,16 +10557,20 @@ prefix argument (`C-u C-u C-u C-c C-w')."
   (bookmark-jump "org-refile-last-stored")
   (message "This is the location of the last refile"))
-(defun org-refile-get-location (&optional prompt default-buffer new-nodes)
+(defun org-refile-get-location (&optional prompt default-buffer new-nodes
+					  no-exclude)
   "Prompt the user for a refile location, using PROMPT.
 PROMPT should not be suffixed with a colon and a space, because
 this function appends the default value from
-`org-refile-history' automatically, if that is not empty."
+`org-refile-history' automatically, if that is not empty.
+When NO-EXCLUDE is set, do not exclude headlines in the current subtree,
+this is used for the GOTO interface."
   (let ((org-refile-targets org-refile-targets)
 	(org-refile-use-outline-path org-refile-use-outline-path)
     (when (and (eq major-mode 'org-mode)
-	       (not org-refile-use-cache))
+	       (not org-refile-use-cache)
+	       (not no-exclude))
 	 (setq excluded-entries