Browse Source

Interpret relative file names in remember templates.

Relative file names will now be interpreted relative to the directory
given by the variable `org-directory'.
Carsten Dominik 17 years ago
parent
commit
99b9b746d8
4 changed files with 23 additions and 8 deletions
  1. 3 1
      ChangeLog
  2. 4 0
      ORGWEBPAGE/Changes.org
  3. 14 6
      org.el
  4. 2 1
      org.texi

+ 3 - 1
ChangeLog

@@ -6,7 +6,9 @@
 	list it at each date (only on Mondays).
 	(org-read-date-analyze): Define local variable `iso-date'.
 	(org-agenda-format-date-aligned): Remove dependency on
-	`calendar-time-from-absolute'. 
+	`calendar-time-from-absolute'.
+	(org-remember-apply-template, org-go-to-remember-target):
+	Interpret filenames relative to `org-directory'.
 
 2008-03-19  Bastien Guerry  <bzg@altern.org>
 

+ 4 - 0
ORGWEBPAGE/Changes.org

@@ -72,6 +72,7 @@
       also match in "Nasim's".
 
 *** Misc
+
    - When an entry already has a scheduling or deadline time
      stamp, calling `C-c C-s' or `C-c C-d', respectively, will no
      use that old date as the default, and you can can use the
@@ -82,6 +83,9 @@
      This was an omission in the earlier implementation, spotted
      by Wanrong Lin.  Thanks!
 
+   - File names in remember templates can be relative, they will
+     be interpreted relative to =org-directory=.
+
 * Version 5.23
 
 ** Overview

+ 14 - 6
org.el

@@ -1562,12 +1562,16 @@ When nil, just let remember make the buffer.
 When not nil, this is a list of 5-element lists.  In each entry, the first
 element is the name of the template, which should be a single short word.
 The second element is a character, a unique key to select this template.
-The third element is the template.  The fourth element is optional and can
-specify a destination file for remember items created with this template.
-The default file is given by `org-default-notes-file'.  An optional fifth
-element can specify the headline in that file that should be offered
-first when the user is asked to file the entry.  The default headline is
-given in the variable `org-remember-default-headline'.
+The third element is the template.  
+
+The fourth element is optional and can specify a destination file for
+remember items created with this template.  The default file is given
+by `org-default-notes-file'.  If the file name is not an absolute path,
+it will be interpreted relative to `org-directory'.
+
+An optional fifth element can specify the headline in that file that should
+be offered first when the user is asked to file the entry.  The default
+headline is given in the variable `org-remember-default-headline'.
 
 An optional sixth element specifies the contexts in which the user can
 select the template.  This element can be either a list of major modes
@@ -13400,6 +13404,8 @@ to be run from that hook to function properly."
 	     (org-startup-folded nil)
 	     org-time-was-given org-end-time-was-given x
 	     prompt completions char time pos default histvar)
+	(when (and file (not (file-name-absolute-p file)))
+	  (setq file (expand-file-name file org-directory)))
 	(setq org-store-link-plist
 	      (append (list :annotation v-a :initial v-i)
 		      org-store-link-plist))
@@ -13604,6 +13610,8 @@ The user is queried for the template."
 	 visiting)
     (unless (and file (stringp file) (string-match "\\S-" file))
       (setq file org-default-notes-file))
+    (when (and file (not (file-name-absolute-p file)))
+      (setq file (expand-file-name file org-directory)))
     (unless (and heading (stringp heading) (string-match "\\S-" heading))
       (setq heading org-remember-default-headline))
     (setq visiting (org-find-base-buffer-visiting file))

+ 2 - 1
org.texi

@@ -4609,7 +4609,8 @@ specifies the template.  Two more (optional) strings give the file in
 which, and the headline under which the new note should be stored.  The
 file (if not present or @code{nil}) defaults to
 @code{org-default-notes-file}, the heading to
-@code{org-remember-default-headline}.
+@code{org-remember-default-headline}.  If the file name is not an
+absolute path, it will be interpreted relative to @code{org-directory}.
 
 An optional sixth element specifies the contexts in which the user can
 select the template.  This element can be either a list of major modes