mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-26 07:33:39 +00:00
Use `org-element-at-point-no-context' in performance-critical places
* lisp/org-compat.el (org-mode-flyspell-verify, org-indent-line, org-indent-region, org-indent-drawer, org-indent-block): Use `org-element-at-point-no-context' in place of `org-element-at-point' when we are doing changes. * lisp/org.el (org-collect-keywords): Use direct parsing in place of `org-elemnt-at-point'
This commit is contained in:
parent
e70a8aac59
commit
5aeeb4f739
@ -1047,8 +1047,8 @@ ELEMENT is the element at point."
|
||||
(or (not (match-beginning 5))
|
||||
(< (point) (match-beginning 5)))
|
||||
;; Ignore checks in code, verbatim and others.
|
||||
(org--flyspell-object-check-p (org-element-at-point)))
|
||||
(let* ((element (org-element-at-point))
|
||||
(org--flyspell-object-check-p (org-element-at-point-no-context)))
|
||||
(let* ((element (org-element-at-point-no-context))
|
||||
(post-affiliated (org-element-property :post-affiliated element)))
|
||||
(cond
|
||||
;; Ignore checks in all affiliated keywords but captions.
|
||||
|
10
lisp/org.el
10
lisp/org.el
@ -4537,7 +4537,7 @@ directory."
|
||||
(let ((case-fold-search t)
|
||||
(regexp (org-make-options-regexp keywords)))
|
||||
(while (and keywords (re-search-forward regexp nil t))
|
||||
(let ((element (org-element-at-point)))
|
||||
(let ((element (org-with-point-at (match-beginning 0) (org-element-keyword-parser (line-end-position) (list (match-beginning 0))))))
|
||||
(when (eq 'keyword (org-element-type element))
|
||||
(let ((value (org-element-property :value element)))
|
||||
(pcase (org-element-property :key element)
|
||||
@ -19271,7 +19271,7 @@ Also align node properties according to `org-property-format'."
|
||||
(skip-chars-backward "\n")
|
||||
(or (org-at-heading-p)
|
||||
(looking-back ":END:.*" (point-at-bol))))))
|
||||
(let* ((element (save-excursion (beginning-of-line) (org-element-at-point)))
|
||||
(let* ((element (save-excursion (beginning-of-line) (org-element-at-point-no-context)))
|
||||
(type (org-element-type element)))
|
||||
(cond ((and (memq type '(plain-list item))
|
||||
(= (line-beginning-position)
|
||||
@ -19344,7 +19344,7 @@ assumed to be significant there."
|
||||
(end (copy-marker end)))
|
||||
(while (< (point) end)
|
||||
(if (or (looking-at-p " \r\t\n") (org-at-heading-p)) (forward-line)
|
||||
(let* ((element (org-element-at-point))
|
||||
(let* ((element (org-element-at-point-no-context))
|
||||
(type (org-element-type element))
|
||||
(element-end (copy-marker (org-element-property :end element)))
|
||||
(ind (org--get-expected-indentation element nil)))
|
||||
@ -19450,7 +19450,7 @@ assumed to be significant there."
|
||||
(beginning-of-line)
|
||||
(looking-at-p org-drawer-regexp))
|
||||
(user-error "Not at a drawer"))
|
||||
(let ((element (org-element-at-point)))
|
||||
(let ((element (org-element-at-point-no-context)))
|
||||
(unless (memq (org-element-type element) '(drawer property-drawer))
|
||||
(user-error "Not at a drawer"))
|
||||
(org-with-wide-buffer
|
||||
@ -19466,7 +19466,7 @@ assumed to be significant there."
|
||||
(let ((case-fold-search t))
|
||||
(looking-at-p "[ \t]*#\\+\\(begin\\|end\\)_")))
|
||||
(user-error "Not at a block"))
|
||||
(let ((element (org-element-at-point)))
|
||||
(let ((element (org-element-at-point-no-context)))
|
||||
(unless (memq (org-element-type element)
|
||||
'(comment-block center-block dynamic-block example-block
|
||||
export-block quote-block special-block
|
||||
|
Loading…
Reference in New Issue
Block a user