summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Abrahamsen <eric@ericabrahamsen.net>2014-10-14 09:38:41 +0800
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2014-10-16 18:57:34 +0200
commita7c72e0de593e77863d68d10e05d392c40b61cda (patch)
tree5a4b45c70308db1b2bd49985e4ce1d67e4769fb1
parent307cc6d6aa7c3d1d44a7cc352b3c8ea5a0895412 (diff)
downloadorg-mode-a7c72e0de593e77863d68d10e05d392c40b61cda.tar.gz
org-archive: Provide a hook during the archive process
* lisp/org-archive.el (org-archive-hook): New hook. (org-archive-subtree): Run hook.
-rw-r--r--lisp/org-archive.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/org-archive.el b/lisp/org-archive.el
index 700e59b..96ef021 100644
--- a/lisp/org-archive.el
+++ b/lisp/org-archive.el
@@ -119,6 +119,12 @@ 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 +372,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))