mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-25 05:32:51 +00:00
org-element: Fix wrong cache behaviour
* lisp/org-element.el (org-element--cache-before-change): Correctly preserve match data.
This commit is contained in:
parent
080f1dd5af
commit
a8568372ad
|
@ -5461,23 +5461,23 @@ BEG and END are the beginning and end of the range of changed
|
||||||
text. See `before-change-functions' for more information."
|
text. See `before-change-functions' for more information."
|
||||||
(let ((inhibit-quit t))
|
(let ((inhibit-quit t))
|
||||||
;; Make sure buffer positions in cache are correct until END.
|
;; Make sure buffer positions in cache are correct until END.
|
||||||
(org-element--cache-sync (current-buffer) end)
|
(save-match-data
|
||||||
(org-with-wide-buffer
|
(org-element--cache-sync (current-buffer) end)
|
||||||
(goto-char beg)
|
(org-with-wide-buffer
|
||||||
(beginning-of-line)
|
(goto-char beg)
|
||||||
(let ((top (point))
|
(beginning-of-line)
|
||||||
(bottom (save-excursion (goto-char end) (line-end-position)))
|
(let ((top (point))
|
||||||
(sensitive-re
|
(bottom (save-excursion (goto-char end) (line-end-position)))
|
||||||
;; A sensitive line is a headline or a block (or drawer,
|
(sensitive-re
|
||||||
;; or latex-environment) boundary. Inserting one can
|
;; A sensitive line is a headline or a block (or drawer,
|
||||||
;; modify buffer drastically both above and below that
|
;; or latex-environment) boundary. Inserting one can
|
||||||
;; line, possibly making cache invalid. Therefore, we
|
;; modify buffer drastically both above and below that
|
||||||
;; need to pay attention to changes happening to them.
|
;; line, possibly making cache invalid. Therefore, we
|
||||||
(concat
|
;; need to pay attention to changes happening to them.
|
||||||
"\\(" (org-with-limited-levels org-outline-regexp-bol) "\\)" "\\|"
|
(concat
|
||||||
org-element--cache-closing-line "\\|"
|
"\\(" (org-with-limited-levels org-outline-regexp-bol) "\\)" "\\|"
|
||||||
org-element--cache-opening-line)))
|
org-element--cache-closing-line "\\|"
|
||||||
(save-match-data
|
org-element--cache-opening-line)))
|
||||||
(setq org-element--cache-change-warning
|
(setq org-element--cache-change-warning
|
||||||
(cond ((not (re-search-forward sensitive-re bottom t)) nil)
|
(cond ((not (re-search-forward sensitive-re bottom t)) nil)
|
||||||
((and (match-beginning 1)
|
((and (match-beginning 1)
|
||||||
|
|
Loading…
Reference in a new issue