Browse Source

Fix bug when setting a property where an empty property is already there.

* org.el (org-re-property-keyword): New function.
(org-entry-put): Use it to fix a bug with respect to setting
the value of a property when a property line with no value
already exists.
Bastien Guerry 13 years ago
parent
commit
e10ff18ffc
1 changed files with 8 additions and 3 deletions
  1. 8 3
      lisp/org.el

+ 8 - 3
lisp/org.el

@@ -14105,10 +14105,15 @@ Being in this list makes sure that they are offered for completion.")
   "Matches an entire clock drawer.")
 
 (defsubst org-re-property (property)
-  "Return a regexp matching PROPERTY.
-Match group 1 will be set to the value "
+  "Return a regexp matching a PROPERTY line.
+Match group 1 will be set to the value."
   (concat "^[ \t]*:" (regexp-quote property) ":[ \t]*\\(\\S-.*\\)"))
 
+(defsubst org-re-property-keyword (property)
+  "Return a regexp matching a PROPERTY line, possibly with no
+value for the property."
+  (concat "^[ \t]*:" (regexp-quote property) ":[ \t]*\\(\\S-.*\\)?"))
+
 (defun org-property-action ()
   "Do an action on properties."
   (interactive)
@@ -14522,7 +14527,7 @@ and the new value.")
 	  (setq range (org-get-property-block beg end 'force))
 	  (goto-char (car range))
 	  (if (re-search-forward
-	       (org-re-property property) (cdr range) t)
+	       (org-re-property-keyword property) (cdr range) t)
 	      (progn
 		(delete-region (match-beginning 0) (match-end 0))
 		(goto-char (match-beginning 0)))