Ver código fonte

Fix bug with allowed property values for remember templates.

When an org-remember template inserts a property, the template-creating
function tries to support the user by retrieving a list of allowed
values to facilitate completion.  So far this was done by getting the
property with inheritance, ignoring that the cursor in the target file
buffer may not be in an entry at all.  So now we just look at the global
and file lists of allowed values.

Reported by James TD Smith.
Carsten Dominik 16 anos atrás
pai
commit
627cc45e71
3 arquivos alterados com 16 adições e 6 exclusões
  1. 3 0
      lisp/ChangeLog
  2. 11 5
      lisp/org-remember.el
  3. 2 1
      lisp/org.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2008-11-18  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-remember.el (org-remember-apply-template): Fix the way how
+	the list of allowed properties is retrieved from the target file.
+
 	* org.el (org-insert-link): Improve file link matching.
 
 2008-11-17  Carsten Dominik  <carsten.dominik@gmail.com>

+ 11 - 5
lisp/org-remember.el

@@ -502,16 +502,22 @@ to be run from that hook to function properly."
 	   ((equal char "p")
 	    (let*
 		((prop (substring-no-properties prompt))
-		 (allowed (with-current-buffer
-			      (get-buffer (file-name-nondirectory file))
-			    (org-property-get-allowed-values nil prop 'table)))
+		 (pall (concat prop "_ALL"))
+		 (allowed
+		  (with-current-buffer
+		      (get-buffer (file-name-nondirectory file))
+		    (or (cdr (assoc pall org-file-properties))
+			(cdr (assoc pall org-global-properties))
+			(cdr (assoc pall org-global-properties-fixed)))))
 		 (existing (with-current-buffer
 			       (get-buffer (file-name-nondirectory file))
 			     (mapcar 'list (org-property-values prop))))
 		 (propprompt (concat "Value for " prop ": "))
 		 (val (if allowed
-			  (org-completing-read propprompt allowed nil
-					       'req-match)
+			  (org-completing-read
+			   propprompt
+			   (mapcar 'list (org-split-string allowed "[ \t]+"))
+			   nil 'req-match)
 			(org-completing-read propprompt existing nil nil
 					     "" nil ""))))
 	      (org-set-property prop val)))

+ 2 - 1
lisp/org.el

@@ -2012,7 +2012,8 @@ These are fixed values, for the preset properties.")
 
 (defcustom org-global-properties nil
   "List of property/value pairs that can be inherited by any entry.
-You can set buffer-local values for this by adding lines like
+You can set buffer-local values for the same purpose in the variable
+`org-file-properties' this by adding lines like
 
 #+PROPERTY: NAME VALUE"
   :group 'org-properties