New option `org-archive-subtree-save-file-p'
* lisp/org-agenda.el (org-agenda-archive-with): Bind `org-archive-from-agenda' to `t' when archiving from agenda. * lisp/org-archive.el (org-archive-subtree-save-file-p): New option. (org-archive-subtree): Use the new option. * doc/org-manual.org (Moving a tree to an archive file): Mention the new option. Thanks to Russ Allbery for suggesting a similar idea.
This commit is contained in:
parent
c9d2f12094
commit
3d0282ef87
|
@ -7209,6 +7209,10 @@ came, its outline path the archiving time etc. Configure the variable
|
|||
~org-archive-save-context-info~ to adjust the amount of information
|
||||
added.
|
||||
|
||||
#+vindex: org-archive-subtree-save-file-p
|
||||
When ~org-archive-subtree-save-file-p~ is non-~nil~, save the target
|
||||
archive buffer.
|
||||
|
||||
*** Internal archiving
|
||||
:PROPERTIES:
|
||||
:DESCRIPTION: Switch off a tree but keep it in the file.
|
||||
|
|
46
etc/ORG-NEWS
46
etc/ORG-NEWS
|
@ -32,7 +32,7 @@ window header line when this first row is not visible anymore in the
|
|||
buffer.
|
||||
|
||||
You can activate this minor mode by default by setting the option
|
||||
~org-table-electric-header-p~ to ~t~.
|
||||
~org-table-electric-header-p~ to =t=.
|
||||
|
||||
*** Property drawers allowed before first headline
|
||||
|
||||
|
@ -44,16 +44,28 @@ properties will work also for this level. In other words: defining
|
|||
things in a property drawer before the first headline will make them
|
||||
"inheritable" for all headlines.
|
||||
|
||||
*** New option to group captured datetime entries by month
|
||||
|
||||
A new `:tree-type month' option was added to org-capture-templates to
|
||||
group new datetime entries by month.
|
||||
|
||||
*** Refinement in window behavior on exiting Org source buffer
|
||||
|
||||
After editing a source block, Org will restore the window layout when
|
||||
~org-src-window-setup~ is set to a value that modifies the layout.
|
||||
|
||||
*** Babel: new header argument to pass Java command line arguments
|
||||
|
||||
Babel Java blocks recognize header argument =:cmdargs= and pass its
|
||||
value in call to =java=.
|
||||
|
||||
** New options
|
||||
|
||||
*** New option ~org-table-electric-header-p~
|
||||
|
||||
Setting this option to =t= will activate
|
||||
~org-table-electric-header-mode~ in org-mode buffers.
|
||||
|
||||
*** New option to group captured datetime entries by month
|
||||
|
||||
A new `:tree-type month' option was added to org-capture-templates to
|
||||
group new datetime entries by month.
|
||||
|
||||
*** New option to show source buffers using "plain" display-buffer
|
||||
|
||||
Added option ~plain~ to ~org-src-window-setup~ to show source buffers
|
||||
|
@ -61,15 +73,21 @@ using ~display-buffer~. This allows users to control how source
|
|||
buffers are displayed by modifying ~display-buffer-alist~ or
|
||||
~display-buffer-base-action~.
|
||||
|
||||
*** New option ~org-archive-subtree-save-file-p~
|
||||
|
||||
Archiving a subtree used to always save the target archive buffer.
|
||||
Commit [[https://code.orgmode.org/bzg/org-mode/commit/b186d1d7][b186d1d7]] changed this behavior by always not saving the target
|
||||
buffer, because batch archiving from agenda could take too much time.
|
||||
|
||||
This new option ~org-archive-subtree-save-file-p~ defaults to the
|
||||
value =from-org= so that archiving a subtree will save the target
|
||||
buffer when done from an org-mode buffer, but not from the agenda.
|
||||
You can also set this option to =t= or to =from-agenda=.
|
||||
|
||||
*** New option ~org-show-notification-timeout~
|
||||
|
||||
This option will add a timeout to notifications.
|
||||
|
||||
*** Babel: new header argument to pass Java command line arguments
|
||||
|
||||
Babel Java blocks recognize header argument =:cmdargs= and pass its
|
||||
value in call to =java=.
|
||||
|
||||
** New commands
|
||||
*** ~org-table-electric-header-mode~
|
||||
|
||||
|
@ -1392,9 +1410,9 @@ removed from Gnus circa September 2010.
|
|||
|
||||
*** ~org-agenda-repeating-timestamp-show-all~ is removed.
|
||||
|
||||
For an equivalent to a ~nil~ value, set
|
||||
For an equivalent to a =nil= value, set
|
||||
~org-agenda-show-future-repeats~ to nil and
|
||||
~org-agenda-prefer-last-repeat~ to ~t~.
|
||||
~org-agenda-prefer-last-repeat~ to =t=.
|
||||
|
||||
*** ~org-gnus-nnimap-query-article-no-from-file~ is removed.
|
||||
|
||||
|
@ -1412,7 +1430,7 @@ equivalent to the removed format string.
|
|||
|
||||
*** ~org-enable-table-editor~ is removed.
|
||||
|
||||
Setting it to a ~nil~ value broke some other features (e.g., speed
|
||||
Setting it to a =nil= value broke some other features (e.g., speed
|
||||
keys).
|
||||
|
||||
*** ~org-export-use-babel~ cannot be set to ~inline-only~
|
||||
|
|
|
@ -8810,7 +8810,8 @@ Point is in the buffer where the item originated.")
|
|||
(let ((org-agenda-buffer-name bufname-orig))
|
||||
(org-remove-subtree-entries-from-agenda))
|
||||
(org-back-to-heading t)
|
||||
(funcall cmd)))
|
||||
(let ((org-archive-from-agenda t))
|
||||
(funcall cmd))))
|
||||
(error "Archiving works only in Org files"))))))
|
||||
|
||||
(defun org-remove-subtree-entries-from-agenda (&optional buf beg end)
|
||||
|
|
|
@ -91,6 +91,15 @@ When a string, a %s formatter will be replaced by the file name."
|
|||
(const :tag "When archiving a subtree to the same file" infile)
|
||||
(const :tag "Always" t)))
|
||||
|
||||
(defcustom org-archive-subtree-save-file-p 'from-org
|
||||
"Non-nil means save the archive file after archiving a subtree."
|
||||
:group 'org-archive
|
||||
:type '(choice
|
||||
(const :tag "Always save the archive buffer" t)
|
||||
(const :tag "Save target buffer when archiving from an agenda view" from-agenda)
|
||||
(const :tag "Save target buffer when archiving from an org buffer" from-org)
|
||||
(const :tag "Do not save the archive buffer")))
|
||||
|
||||
(defcustom org-archive-save-context-info '(time file olpath category todo itags)
|
||||
"Parts of context info that should be stored as properties when archiving.
|
||||
When a subtree is moved to an archive file, it loses information given by
|
||||
|
@ -361,6 +370,16 @@ direct children of this heading."
|
|||
(point)
|
||||
(concat "ARCHIVE_" (upcase (symbol-name item)))
|
||||
value))))
|
||||
;; Save and kill the buffer, if it is not the same
|
||||
;; buffer and depending on `org-archive-subtree-save-file-p'
|
||||
(unless (eq this-buffer buffer)
|
||||
(when (or (eq org-archive-subtree-save-file-p t)
|
||||
(and (boundp 'org-archive-from-agenda)
|
||||
(eq org-archive-subtree-save-file-p 'from-agenda)))
|
||||
(save-buffer)))
|
||||
;; (unless (or (not org-archive-subtree-save-file-p)
|
||||
;; (eq this-buffer buffer))
|
||||
;; (save-buffer))
|
||||
(widen))))
|
||||
;; Here we are back in the original buffer. Everything seems
|
||||
;; to have worked. So now run hooks, cut the tree and finish
|
||||
|
|
Loading…
Reference in New Issue