Procházet zdrojové kódy

Allow the file component in a remember template to be a function.

Carsten Dominik před 16 roky
rodič
revize
b831ab8ef5
3 změnil soubory, kde provedl 23 přidání a 7 odebrání
  1. 8 5
      ORGWEBPAGE/Changes.org
  2. 7 0
      lisp/ChangeLog
  3. 8 2
      lisp/org-remember.el

+ 8 - 5
ORGWEBPAGE/Changes.org

@@ -17,11 +17,14 @@
 
 ** Details
 
-** It is now possible to define filters for column view
-   The filter can modify the value that will be displayed in a
-   column, for example it can cut out a part of a time stamp.
-   For more information, look at the variable
-   =org-columns-modify-value-for-display-function=.
+*** The file specification in a remember template may now be a function
+    Thanks to Gregory Sullivan for a patch to this effect.
+
+*** It is now possible to define filters for column view
+    The filter can modify the value that will be displayed in a
+    column, for example it can cut out a part of a time stamp.
+    For more information, look at the variable
+    =org-columns-modify-value-for-display-function=.
 
 * Version 6.06
 

+ 7 - 0
lisp/ChangeLog

@@ -1,5 +1,12 @@
 2008-09-03  Carsten Dominik  <dominik@science.uva.nl>
 
+	* org-exp.el (org-export-as-html): Fixed typo in creator
+	information.
+
+	* org-remember.el (org-remember-templates)
+	(org-remember-apply-template): Allow the file component to be a
+	function.
+
 	* org.el (org-goto-local-search-headings): Renamed from
 	`org-goto-local-search-forward-headings'.  Added the possibility
 	to search backwards.

+ 8 - 2
lisp/org-remember.el

@@ -176,6 +176,7 @@ calendar           |  %:type %:date"
 		(string :tag "Template")
 		(choice :tag "Destination file"
 		 (file :tag "Specify")
+		 (function :tag "Function")
 		 (const :tag "Use `org-default-notes-file'" nil))
 		(choice :tag "Destin. headline"
 		 (string :tag "Specify")
@@ -318,8 +319,10 @@ to be run from that hook to function properly."
 	     (ct (or org-overriding-default-time (org-current-time)))
 	     (tpl (car entry))
 	     (plist-p (if org-store-link-plist t nil))
-	     (file (if (and (nth 1 entry) (stringp (nth 1 entry))
-			    (string-match "\\S-" (nth 1 entry)))
+	     (file (if (and (nth 1 entry) 
+			    (or (and (stringp (nth 1 entry))
+				     (string-match "\\S-" (nth 1 entry)))
+				(functionp (nth 1 entry))))
 		       (nth 1 entry)
 		     org-default-notes-file))
 	     (headline (nth 2 entry))
@@ -349,6 +352,9 @@ 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 (functionp file)
+	  (setq file (funcall file)))
 	(when (and file (not (file-name-absolute-p file)))
 	  (setq file (expand-file-name file org-directory)))
 	(setq org-store-link-plist