>From 1bfc84570f29dd884c2759dfe19116f09228ed4e Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Sun, 12 Oct 2014 22:01:29 +0800 Subject: [PATCH 2/3] Provide a hook during the archive process * lisp/org-archive.el (org-archive-hook): New hook. (org-archive-subtree): Run hook. --- lisp/org-archive.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/org-archive.el b/lisp/org-archive.el index 700e59b..c7f02b9 100644 --- a/lisp/org-archive.el +++ b/lisp/org-archive.el @@ -119,6 +119,13 @@ information." (const :tag "Outline path" olpath) (const :tag "Local tags" ltags))) +(defvar org-archive-hook nil + "Hook run after successfully archiving a subtree. + +Hook functions are called with point on the subtree in the +original file. At this stage, the subtree has been added to the +archive location, but not yet deleted from the original file.") + (defun org-get-local-archive-location () "Get the archive location applicable at point." (let ((re "^[ \t]*#\\+ARCHIVE:[ \t]+\\(\\S-.*\\S-\\)[ \t]*$") @@ -366,8 +373,10 @@ this heading." ;; Save and kill the buffer, if it is not the same buffer. (when (not (eq this-buffer buffer)) (save-buffer)))) - ;; Here we are back in the original buffer. Everything seems to have - ;; worked. So now cut the tree and finish up. + ;; Here we are back in the original buffer. Everything seems + ;; to have worked. So now run hooks, cut the tree and finish + ;; up. + (run-hooks 'org-archive-hook) (let (this-command) (org-cut-subtree)) (when (featurep 'org-inlinetask) (org-inlinetask-remove-END-maybe)) -- 2.1.2