org.el: Fix bug when setting properties with a null value
* org.el (org-re-property): New parameter `allow-null' to match property with a null value. (org-entry-put): Correctly update a property with a null value. Thanks to Andrea Rossetti for reporting this and suggesting a fix.
This commit is contained in:
parent
34c2365081
commit
822dcfc881
10
lisp/org.el
10
lisp/org.el
|
@ -6155,12 +6155,14 @@ Use `org-reduced-level' to remove the effect of `org-odd-levels'."
|
||||||
|
|
||||||
(defvar org-font-lock-keywords nil)
|
(defvar org-font-lock-keywords nil)
|
||||||
|
|
||||||
(defsubst org-re-property (property &optional literal)
|
(defsubst org-re-property (property &optional literal allow-null)
|
||||||
"Return a regexp matching a PROPERTY line.
|
"Return a regexp matching a PROPERTY line.
|
||||||
Match group 3 will be set to the value if it exists."
|
Match group 3 will be set to the value if it exists."
|
||||||
(concat "^\\(?4:[ \t]*\\)\\(?1::\\(?2:"
|
(concat "^\\(?4:[ \t]*\\)\\(?1::\\(?2:"
|
||||||
(if literal property (regexp-quote property))
|
(if literal property (regexp-quote property))
|
||||||
"\\):\\)[ \t]+\\(?3:[^ \t\r\n].*?\\)\\(?5:[ \t]*\\)$"))
|
"\\):\\)[ \t]+\\(?3:[^ \t\r\n]"
|
||||||
|
(if allow-null "*")
|
||||||
|
".*?\\)\\(?5:[ \t]*\\)$"))
|
||||||
|
|
||||||
(defconst org-property-re
|
(defconst org-property-re
|
||||||
(org-re-property ".*?" 'literal)
|
(org-re-property ".*?" 'literal)
|
||||||
|
@ -15589,7 +15591,7 @@ If it is not a string, an error is raised."
|
||||||
(setq range (org-get-property-block beg end 'force))
|
(setq range (org-get-property-block beg end 'force))
|
||||||
(goto-char (car range))
|
(goto-char (car range))
|
||||||
(if (re-search-forward
|
(if (re-search-forward
|
||||||
(org-re-property property) (cdr range) t)
|
(org-re-property property nil t) (cdr range) t)
|
||||||
(progn
|
(progn
|
||||||
(delete-region (match-beginning 0) (match-end 0))
|
(delete-region (match-beginning 0) (match-end 0))
|
||||||
(goto-char (match-beginning 0)))
|
(goto-char (match-beginning 0)))
|
||||||
|
|
Loading…
Reference in New Issue