Fix "Before first headline" error in `org-refresh-property'
* lisp/org.el (org-refresh-property): Ignore function when before first headline or inlinetask. Small refactoring. Reported-by: Nick Dokos <ndokos@gmail.com> <http://permalink.gmane.org/gmane.emacs.orgmode/96552>
This commit is contained in:
parent
2081cd3f62
commit
c1a744659d
12
lisp/org.el
12
lisp/org.el
|
@ -9523,20 +9523,20 @@ the value of the drawer property."
|
||||||
(defun org-refresh-property (tprop p)
|
(defun org-refresh-property (tprop p)
|
||||||
"Refresh the buffer text property TPROP from the drawer property P.
|
"Refresh the buffer text property TPROP from the drawer property P.
|
||||||
The refresh happens only for the current tree (not subtree)."
|
The refresh happens only for the current tree (not subtree)."
|
||||||
|
(unless (org-before-first-heading-p)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(org-back-to-heading t)
|
(org-back-to-heading t)
|
||||||
;; tprop is a text property symbol
|
|
||||||
(if (symbolp tprop)
|
(if (symbolp tprop)
|
||||||
|
;; TPROP is a text property symbol
|
||||||
(put-text-property
|
(put-text-property
|
||||||
(point) (or (outline-next-heading) (point-max)) tprop p)
|
(point) (or (outline-next-heading) (point-max)) tprop p)
|
||||||
;; tprop is an alist with (properties . function) elements
|
;; TPROP is an alist with (properties . function) elements
|
||||||
(mapc (lambda(al)
|
(dolist (al tprop)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(put-text-property
|
(put-text-property
|
||||||
(point-at-bol) (or (outline-next-heading) (point-max))
|
(line-beginning-position) (or (outline-next-heading) (point-max))
|
||||||
(car al)
|
(car al)
|
||||||
(funcall (cdr al) p))))
|
(funcall (cdr al) p))))))))
|
||||||
tprop))))
|
|
||||||
|
|
||||||
(defun org-refresh-category-properties ()
|
(defun org-refresh-category-properties ()
|
||||||
"Refresh category text properties in the buffer."
|
"Refresh category text properties in the buffer."
|
||||||
|
|
Loading…
Reference in New Issue