Browse Source

Use safer regexps to retrieve property values.

Bernt Hansen recently reported that occasionally he got a newline
included with property values returned by `org-entry-get'.  While the
reason for this is not understood (maybe some dark mingling with
character syntax), these new regexps are explicit about what they
interpret as a non-white character and therefore should make this
matching safer.
Carsten Dominik 16 years ago
parent
commit
ebc9366762
2 changed files with 7 additions and 2 deletions
  1. 5 0
      lisp/ChangeLog
  2. 2 2
      lisp/org.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2008-11-10  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-entry-get, org-entry-delete): Use safer regexps to
+	retrieve property values.
+
 2008-11-09  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-agenda.el (org-agenda-list): Handle the value `only' of

+ 2 - 2
lisp/org.el

@@ -9944,7 +9944,7 @@ If the property is not present at all, nil is returned."
 	  (if (and range
 		   (goto-char (car range))
 		   (re-search-forward
-		    (concat "^[ \t]*:" property ":[ \t]*\\(.*\\S-\\)?")
+		    (concat "^[ \t]*:" property ":[ \t]*\\(.*[^ \t\r\n\f\v]\\)?")
 		    (cdr range) t))
 	      ;; Found the property, return it.
 	      (if (match-end 1)
@@ -9968,7 +9968,7 @@ If yes, return this value.  If not, return the current value of the variable."
 	(if (and range
 		 (goto-char (car range))
 		 (re-search-forward
-		  (concat "^[ \t]*:" property ":[ \t]*\\(.*\\S-\\)")
+		  (concat "^[ \t]*:" property ":[ \t]*\\(.*[^ \t\r\n\f\v]\\)")
 		  (cdr range) t))
 	    (progn
 	      (delete-region (match-beginning 0) (1+ (point-at-eol)))