0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 19:07:52 +00:00

org-archive: Provide a hook during the archive process

* lisp/org-archive.el (org-archive-hook): New hook.
  (org-archive-subtree): Run hook.
This commit is contained in:
Eric Abrahamsen 2014-10-14 09:38:41 +08:00 committed by Nicolas Goaziou
parent 307cc6d6aa
commit a7c72e0de5

View file

@ -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))