浏览代码

Remember: Take annotation and initial from plist, if defined.

The annotation and initial contents for a remember template are
normally taken from the variables `annotation' and `initial', which
are bound by remember.  We now also check the property list for such
values, so that the link generating routine can force the right values
in there.
Carsten Dominik 16 年之前
父节点
当前提交
8235075514
共有 2 个文件被更改,包括 17 次插入8 次删除
  1. 3 0
      lisp/ChangeLog
  2. 14 8
      lisp/org-remember.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-04-02  Carsten Dominik  <carsten.dominik@gmail.com>
 2009-04-02  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
+	* org-remember.el (org-remember-apply-template): Take the default
+	for the annotation from the :annotation property.
+
 	* org-mac-message.el (org-mac-message-get-link): Remove the
 	* org-mac-message.el (org-mac-message-get-link): Remove the
 	quotes.
 	quotes.
 	(org-mac-message-get-link): Return the result.
 	(org-mac-message-get-link): Return the result.

+ 14 - 8
lisp/org-remember.el

@@ -386,11 +386,16 @@ to be run from that hook to function properly."
 	     (v-T (format-time-string (cdr org-time-stamp-formats) ct))
 	     (v-T (format-time-string (cdr org-time-stamp-formats) ct))
 	     (v-u (concat "[" (substring v-t 1 -1) "]"))
 	     (v-u (concat "[" (substring v-t 1 -1) "]"))
 	     (v-U (concat "[" (substring v-T 1 -1) "]"))
 	     (v-U (concat "[" (substring v-T 1 -1) "]"))
-	     ;; `initial' and `annotation' are bound in `remember'
-	     (v-i (if (boundp 'initial) initial))
-	     (v-a (if (and (boundp 'annotation) annotation)
-		      (if (equal annotation "[[]]") "" annotation)
-		    ""))
+	     ;; `initial' and `annotation' are bound in `remember'.
+	     ;; But if the property list has them, we prefer those values
+	     (v-i (or (plist-get org-store-link-plist :initial)
+		      (and (boundp 'initial) initial)
+		      ""))
+	     (v-a (or (plist-get org-store-link-plist :annotation)
+		      (and (boundp 'annotation) annotation)
+		      ""))
+	     ;; Is the link empty?  Then we do not want it...
+	     (v-a (if (equal v-a "[[]]") "" v-a))
 	     (clipboards (remove nil (list v-i
 	     (clipboards (remove nil (list v-i
 					   (org-get-x-clipboard 'PRIMARY)
 					   (org-get-x-clipboard 'PRIMARY)
 					   (org-get-x-clipboard 'CLIPBOARD)
 					   (org-get-x-clipboard 'CLIPBOARD)
@@ -418,10 +423,11 @@ to be run from that hook to function properly."
 	(when (and file (not (file-name-absolute-p file)))
 	(when (and file (not (file-name-absolute-p file)))
 	  (setq file (expand-file-name file org-directory)))
 	  (setq file (expand-file-name file org-directory)))
 
 
-
 	(setq org-store-link-plist
 	(setq org-store-link-plist
-	      (append (list :annotation v-a :initial v-i)
-		      org-store-link-plist))
+	      (plist-put org-store-link-plist :annotation v-a)
+	      org-store-link-plist
+	      (plist-put org-store-link-plist :initial v-i))
+
 	(unless tpl (setq tpl "") (message "No template") (ding) (sit-for 1))
 	(unless tpl (setq tpl "") (message "No template") (ding) (sit-for 1))
 	(erase-buffer)
 	(erase-buffer)
 	(insert (substitute-command-keys
 	(insert (substitute-command-keys