Archiving: Allow file name interpolation in target headline
Matt Lundin writes: I had one more question/request concerning archives. Would it perhaps be possible to enable the file name substitution (i.e., "%s") after the double semi-colon, so that the file name can be used as a headline within the archive file? My ideal setup would be to have a single archive file for each year's work, with headlines named according to the original files of the archived subtrees. E.g., ,---- | * finances.org | ** archived item | * notes.org | ** archived item | ** another archived item `---- This commit does implement this request.
This commit is contained in:
parent
5a8f775d79
commit
74a4244db1
|
@ -1118,7 +1118,7 @@ each specifies the archive location for the text below it. The first
|
||||||
such line also applies to any text before its definition. However,
|
such line also applies to any text before its definition. However,
|
||||||
using this method is @emph{strongly} deprecated as it is incompatible
|
using this method is @emph{strongly} deprecated as it is incompatible
|
||||||
with the outline structure of the document. The correct method for
|
with the outline structure of the document. The correct method for
|
||||||
setting multiple archive locations in a buffer is using a property.}:
|
setting multiple archive locations in a buffer is using properties.}:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
#+ARCHIVE: %s_done::
|
#+ARCHIVE: %s_done::
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2009-01-11 Carsten Dominik <carsten.dominik@gmail.com>
|
||||||
|
|
||||||
|
* org-archive.el (org-extract-archive-heading): Allow %s for file
|
||||||
|
name also in achive location heading.
|
||||||
|
|
||||||
2009-01-10 Carsten Dominik <carsten.dominik@gmail.com>
|
2009-01-10 Carsten Dominik <carsten.dominik@gmail.com>
|
||||||
|
|
||||||
* org-archive.el (org-add-archive-files): Uniquify the list before
|
* org-archive.el (org-add-archive-files): Uniquify the list before
|
||||||
|
|
|
@ -151,7 +151,8 @@ if LOCATION is not given, the value of `org-archive-location' is used."
|
||||||
if LOCATION is not given, the value of `org-archive-location' is used."
|
if LOCATION is not given, the value of `org-archive-location' is used."
|
||||||
(setq location (or location org-archive-location))
|
(setq location (or location org-archive-location))
|
||||||
(if (string-match "\\(.*\\)::\\(.*\\)" location)
|
(if (string-match "\\(.*\\)::\\(.*\\)" location)
|
||||||
(match-string 2 location)))
|
(format (match-string 2 location)
|
||||||
|
(file-name-nondirectory buffer-file-name))))
|
||||||
|
|
||||||
(defun org-archive-subtree (&optional find-done)
|
(defun org-archive-subtree (&optional find-done)
|
||||||
"Move the current subtree to the archive.
|
"Move the current subtree to the archive.
|
||||||
|
|
|
@ -2770,7 +2770,9 @@ Org-mode Agenda.
|
||||||
|
|
||||||
The archived entries will be filed as subtrees of the specified
|
The archived entries will be filed as subtrees of the specified
|
||||||
headline. When the headline is omitted, the subtrees are simply
|
headline. When the headline is omitted, the subtrees are simply
|
||||||
filed away at the end of the file, as top-level entries.
|
filed away at the end of the file, as top-level entries. Also in
|
||||||
|
the heading you can use %s to represent the file name, this can be
|
||||||
|
useful when using the same archive for a number of different files.
|
||||||
|
|
||||||
Here are a few examples:
|
Here are a few examples:
|
||||||
\"%s_archive::\"
|
\"%s_archive::\"
|
||||||
|
@ -2784,6 +2786,10 @@ Here are a few examples:
|
||||||
\"~/org/archive.org::\"
|
\"~/org/archive.org::\"
|
||||||
Archive in file ~/org/archive.org (absolute path), as top-level trees.
|
Archive in file ~/org/archive.org (absolute path), as top-level trees.
|
||||||
|
|
||||||
|
\"~/org/archive.org::From %s\"
|
||||||
|
Archive in file ~/org/archive.org (absolute path), und headlines
|
||||||
|
\"From FILENAME\" where file name is the current file name.
|
||||||
|
|
||||||
\"basement::** Finished Tasks\"
|
\"basement::** Finished Tasks\"
|
||||||
Archive in file ./basement (relative path), as level 3 trees
|
Archive in file ./basement (relative path), as level 3 trees
|
||||||
below the level 2 heading \"** Finished Tasks\".
|
below the level 2 heading \"** Finished Tasks\".
|
||||||
|
|
Loading…
Reference in New Issue