summaryrefslogtreecommitdiff
path: root/lisp/org/org-archive.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2022-11-29 23:05:53 -0500
committerKyle Meyer <kyle@kyleam.com>2022-11-29 23:05:53 -0500
commit0625651e8a61c9effc31ff771f15885a3a37c6e6 (patch)
treedb4c09e8ef119ad4a9a4028c5e615fd58d2dee69 /lisp/org/org-archive.el
parentedd64e64a389e0f0e6ce670846d4fae79a9d8b35 (diff)
downloademacs-0625651e8a61c9effc31ff771f15885a3a37c6e6.tar.gz
emacs-0625651e8a61c9effc31ff771f15885a3a37c6e6.tar.bz2
emacs-0625651e8a61c9effc31ff771f15885a3a37c6e6.zip
Update to Org 9.6-3-ga4d38e
Diffstat (limited to 'lisp/org/org-archive.el')
-rw-r--r--lisp/org/org-archive.el30
1 files changed, 20 insertions, 10 deletions
diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el
index c490e4b48fa..d08afa457ae 100644
--- a/lisp/org/org-archive.el
+++ b/lisp/org/org-archive.el
@@ -4,7 +4,7 @@
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: outlines, hypermedia, calendar, wp
-;; Homepage: https://orgmode.org
+;; URL: https://orgmode.org
;;
;; This file is part of GNU Emacs.
;;
@@ -28,6 +28,9 @@
;;; Code:
+(require 'org-macs)
+(org-assert-version)
+
(require 'org)
(require 'cl-lib)
@@ -35,6 +38,9 @@
(declare-function org-datetree-find-date-create "org-datetree" (date &optional keep-restriction))
(declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
+;; From org-element.el
+(defvar org-element--cache-avoid-synchronous-headline-re-parsing)
+
(defcustom org-archive-default-command 'org-archive-subtree
"The default archiving command."
:group 'org-archive
@@ -233,7 +239,7 @@ direct children of this heading."
(tr-org-odd-levels-only org-odd-levels-only)
(this-buffer (current-buffer))
(time (format-time-string
- (substring (cdr org-time-stamp-formats) 1 -1)))
+ (org-time-stamp-format 'with-time 'no-brackets)))
(file (abbreviate-file-name
(or (buffer-file-name (buffer-base-buffer))
(error "No file associated to buffer"))))
@@ -253,7 +259,9 @@ direct children of this heading."
(if (local-variable-p 'org-odd-levels-only (current-buffer))
org-odd-levels-only
tr-org-odd-levels-only))
- level datetree-date datetree-subheading-p)
+ level datetree-date datetree-subheading-p
+ ;; Suppress on-the-fly headline updates.
+ (org-element--cache-avoid-synchronous-headline-re-parsing t))
(when (string-match "\\`datetree/\\(\\**\\)" heading)
;; "datetree/" corresponds to 3 levels of headings.
(let ((nsub (length (match-string 1 heading))))
@@ -319,7 +327,7 @@ direct children of this heading."
(org-todo-regexp tr-org-todo-regexp)
(org-todo-line-regexp tr-org-todo-line-regexp))
(goto-char (point-min))
- (org-show-all '(headings blocks))
+ (org-fold-show-all '(headings blocks))
(if (and heading (not (and datetree-date (not datetree-subheading-p))))
(progn
(if (re-search-forward
@@ -334,7 +342,7 @@ direct children of this heading."
(insert (if datetree-date "" "\n") heading "\n")
(end-of-line 0))
;; Make the subtree visible
- (outline-show-subtree)
+ (org-fold-show-subtree)
(if org-archive-reversed-order
(progn
(org-back-to-heading t)
@@ -412,7 +420,7 @@ direct children of this heading."
(if (eq this-buffer buffer)
(concat "under heading: " heading)
(concat "in file: " (abbreviate-file-name afile)))))))
- (org-reveal)
+ (org-fold-reveal)
(if (looking-at "^[ \t]*$")
(outline-next-visible-heading 1))))
@@ -448,6 +456,8 @@ Archiving time is retained in the ARCHIVE_TIME node property."
(setq leader (match-string 0)
level (funcall outline-level))
(setq pos (point-marker))
+ ;; Advance POS upon insertion in front of it.
+ (set-marker-insertion-type pos t)
(condition-case nil
(outline-up-heading 1 t)
(error (setq e (point-max)) (goto-char (point-min))))
@@ -480,15 +490,15 @@ Archiving time is retained in the ARCHIVE_TIME node property."
(org-set-property
"ARCHIVE_TIME"
(format-time-string
- (substring (cdr org-time-stamp-formats) 1 -1)))
+ (org-time-stamp-format 'with-time 'no-brackets)))
(outline-up-heading 1 t)
- (org-flag-subtree t)
+ (org-fold-subtree t)
(org-cycle-show-empty-lines 'folded)
(when org-provide-todo-statistics
;; Update TODO statistics of parent.
(org-update-parent-todo-statistics))
(goto-char pos)))
- (org-reveal)
+ (org-fold-reveal)
(if (looking-at "^[ \t]*$")
(outline-next-visible-heading 1))))
@@ -597,7 +607,7 @@ the children that do not contain any open TODO items."
(save-excursion
(org-back-to-heading t)
(setq set (org-toggle-tag org-archive-tag))
- (when set (org-flag-subtree t)))
+ (when set (org-fold-subtree t)))
(and set (beginning-of-line 1))
(message "Subtree %s" (if set "archived" "unarchived"))))))