org-refresh-category-properties: Do not check element cache
* lisp/org.el (org-refresh-category-properties): Do not check if org-element-cache is active. This function is now obsolete and can only be called on purpose by third-party code that probably expects the text properties to be assigned regardless whether the cache is active. This commit also fixes compiler warning as `org-element--cache-active-p' is not declared anymore in lisp/org.el.
This commit is contained in:
parent
9ed7956afd
commit
5ed3e1dfc3
85
lisp/org.el
85
lisp/org.el
|
@ -8027,49 +8027,48 @@ the whole buffer."
|
||||||
|
|
||||||
(defun org-refresh-category-properties ()
|
(defun org-refresh-category-properties ()
|
||||||
"Refresh category text properties in the buffer."
|
"Refresh category text properties in the buffer."
|
||||||
(unless (org-element--cache-active-p)
|
(let ((case-fold-search t)
|
||||||
(let ((case-fold-search t)
|
(inhibit-read-only t)
|
||||||
(inhibit-read-only t)
|
(default-category
|
||||||
(default-category
|
(cond ((null org-category)
|
||||||
(cond ((null org-category)
|
(if buffer-file-name
|
||||||
(if buffer-file-name
|
(file-name-sans-extension
|
||||||
(file-name-sans-extension
|
(file-name-nondirectory buffer-file-name))
|
||||||
(file-name-nondirectory buffer-file-name))
|
"???"))
|
||||||
"???"))
|
((symbolp org-category) (symbol-name org-category))
|
||||||
((symbolp org-category) (symbol-name org-category))
|
(t org-category))))
|
||||||
(t org-category))))
|
(let ((category (catch 'buffer-category
|
||||||
(let ((category (catch 'buffer-category
|
(org-with-wide-buffer
|
||||||
(org-with-wide-buffer
|
(goto-char (point-max))
|
||||||
(goto-char (point-max))
|
(while (re-search-backward "^[ \t]*#\\+CATEGORY:" (point-min) t)
|
||||||
(while (re-search-backward "^[ \t]*#\\+CATEGORY:" (point-min) t)
|
(let ((element (org-element-at-point-no-context)))
|
||||||
(let ((element (org-element-at-point-no-context)))
|
(when (org-element-type-p element 'keyword)
|
||||||
(when (org-element-type-p element 'keyword)
|
(throw 'buffer-category
|
||||||
(throw 'buffer-category
|
(org-element-property :value element))))))
|
||||||
(org-element-property :value element))))))
|
default-category)))
|
||||||
default-category)))
|
(with-silent-modifications
|
||||||
(with-silent-modifications
|
(org-with-wide-buffer
|
||||||
(org-with-wide-buffer
|
;; Set buffer-wide property from keyword. Search last #+CATEGORY
|
||||||
;; Set buffer-wide property from keyword. Search last #+CATEGORY
|
;; keyword. If none is found, fall-back to `org-category' or
|
||||||
;; keyword. If none is found, fall-back to `org-category' or
|
;; buffer file name, or set it by the document property drawer.
|
||||||
;; buffer file name, or set it by the document property drawer.
|
(put-text-property (point-min) (point-max)
|
||||||
(put-text-property (point-min) (point-max)
|
'org-category category)
|
||||||
'org-category category)
|
;; Set categories from the document property drawer or
|
||||||
;; Set categories from the document property drawer or
|
;; property drawers in the outline. If category is found in
|
||||||
;; property drawers in the outline. If category is found in
|
;; the property drawer for the whole buffer that value
|
||||||
;; the property drawer for the whole buffer that value
|
;; overrides the keyword-based value set above.
|
||||||
;; overrides the keyword-based value set above.
|
(goto-char (point-min))
|
||||||
(goto-char (point-min))
|
(let ((regexp (org-re-property "CATEGORY")))
|
||||||
(let ((regexp (org-re-property "CATEGORY")))
|
(while (re-search-forward regexp nil t)
|
||||||
(while (re-search-forward regexp nil t)
|
(let ((value (match-string-no-properties 3)))
|
||||||
(let ((value (match-string-no-properties 3)))
|
(when (org-at-property-p)
|
||||||
(when (org-at-property-p)
|
(put-text-property
|
||||||
(put-text-property
|
(save-excursion (org-back-to-heading-or-point-min t))
|
||||||
(save-excursion (org-back-to-heading-or-point-min t))
|
(save-excursion (if (org-before-first-heading-p)
|
||||||
(save-excursion (if (org-before-first-heading-p)
|
(point-max)
|
||||||
(point-max)
|
(org-end-of-subtree t t)))
|
||||||
(org-end-of-subtree t t)))
|
'org-category
|
||||||
'org-category
|
value))))))))))
|
||||||
value)))))))))))
|
|
||||||
|
|
||||||
(defun org-refresh-stats-properties ()
|
(defun org-refresh-stats-properties ()
|
||||||
"Refresh stats text properties in the buffer."
|
"Refresh stats text properties in the buffer."
|
||||||
|
|
Loading…
Reference in New Issue