1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-01-22 19:47:07 +00:00

org-element: `org-element-parse-secondary-string' accepts nil argument

* lisp/org-element.el (org-element-parse-secondary-string): Accept nil
  argument as a special case.

Reported-by: Rasmus <rasmus@gmx.us>
<http://permalink.gmane.org/gmane.emacs.orgmode/96234>
This commit is contained in:
Nicolas Goaziou 2015-03-21 09:43:45 +01:00
parent 13aba46ce0
commit bcf6970369

View File

@ -3940,20 +3940,25 @@ looked after.
Optional argument PARENT, when non-nil, is the element or object
containing the secondary string. It is used to set correctly
`:parent' property within the string."
(let ((local-variables (buffer-local-variables)))
(with-temp-buffer
(dolist (v local-variables)
(ignore-errors
(if (symbolp v) (makunbound v)
(org-set-local (car v) (cdr v)))))
(insert string)
(restore-buffer-modified-p nil)
(let ((secondary (org-element--parse-objects
(point-min) (point-max) nil restriction)))
(when parent
(dolist (o secondary) (org-element-put-property o :parent parent)))
secondary))))
`:parent' property within the string.
If STRING is the empty string or nil, return nil."
(cond
((not string) nil)
((equal string "") nil)
(t (let ((local-variables (buffer-local-variables)))
(with-temp-buffer
(dolist (v local-variables)
(ignore-errors
(if (symbolp v) (makunbound v)
(org-set-local (car v) (cdr v)))))
(insert string)
(restore-buffer-modified-p nil)
(let ((data (org-element--parse-objects
(point-min) (point-max) nil restriction)))
(when parent
(dolist (o data) (org-element-put-property o :parent parent)))
data))))))
(defun org-element-map
(data types fun &optional info first-match no-recursion with-affiliated)