Browse Source

Refile: New hook

Requested by Keith Swartz.
Carsten Dominik 16 years ago
parent
commit
e7e711148a
2 changed files with 9 additions and 1 deletions
  1. 2 0
      lisp/ChangeLog
  2. 7 1
      lisp/org.el

+ 2 - 0
lisp/ChangeLog

@@ -2,6 +2,8 @@
 
 	* org.el (org-after-sorting-entries-or-items-hook): New hook.
 	(org-sort-entries-or-items): Run the new hook.
+	(org-after-refile-insert-hook): New hook.
+	(org-refile): Run `org-after-refile-insert-hook'.
 
 	* org-agenda.el (org-agenda-get-progress): Never take time of day
 	from headline when displaying progress.

+ 7 - 1
lisp/org.el

@@ -8435,6 +8435,11 @@ on the system \"/user@host:\"."
 (defvar org-refile-history nil
   "History for refiling operations.")
 
+(defvar org-after-refile-insert-hook nil
+  "Hook run after `org-refile' has inserted its stuff at the new location.
+Note that this is still *before* the stuff will be removed from
+the *old* location.")
+
 (defun org-refile (&optional goto default-buffer)
   "Move the entry at point to another heading.
 The list of target headings is compiled using the information in
@@ -8524,7 +8529,8 @@ See also `org-refile-use-outline-path' and `org-completion-use-ido'"
 		    (or (outline-next-heading) (goto-char (point-max)))))
 		(if (not (bolp)) (newline))
 		(bookmark-set "org-refile-last-stored")
-		(org-paste-subtree level))))
+		(org-paste-subtree level)
+		(run-hooks 'org-after-refile-insert-hook))))
 	  (if regionp
 	      (delete-region (point) (+ (point) region-length))
 	    (org-cut-subtree))