>From 9c0d617c8fea6499d8eb5ebabaf3a20501ecb204 Mon Sep 17 00:00:00 2001 From: Ikumi Keita Date: Thu, 10 Jun 2021 17:21:18 +0900 Subject: [PATCH] Clean up temporal markers * latex.el (LaTeX-env-figure, LaTeX-fill-region-as-paragraph) (LaTeX-fill-region-as-para-do,LaTeX-fill-paragraph) (LaTeX-fill-region): * style/dinbrief.el (LaTeX-dinbrief-env-recipient): * style/letter.el (LaTeX-env-recipient): * tex-info.el (Texinfo-reftex-section-info): * tex.el (TeX-parse-argument): Clean up temporal markers after their usage so that they don't slow down the subsequent editing in the buffer. --- latex.el | 24 ++++++++++++++++++------ style/dinbrief.el | 3 ++- style/letter.el | 3 ++- tex-info.el | 6 ++++-- tex.el | 3 ++- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/latex.el b/latex.el index cf26383a..82d5ffa8 100644 --- a/latex.el +++ b/latex.el @@ -1205,7 +1205,9 @@ If SHORT-CAPTION is non-nil pass it as an optional argument to (unless (zerop (length float)) (concat LaTeX-optop float LaTeX-optcl))) - (when active-mark (goto-char start-marker)) + (when active-mark + (goto-char start-marker) + (set-marker start-marker nil)) (when center (insert TeX-esc "centering") (indent-according-to-mode) @@ -1227,7 +1229,9 @@ If SHORT-CAPTION is non-nil pass it as an optional argument to (LaTeX-newline) (indent-according-to-mode))) ;; bottom caption (default) - (when active-mark (goto-char end-marker)) + (when active-mark + (goto-char end-marker) + (set-marker end-marker nil)) (save-excursion (LaTeX-newline) (indent-according-to-mode) @@ -3855,7 +3859,8 @@ performed in that case." ;; ELSE part follows - loop termination relies on a fact ;; that (LaTeX-fill-region-as-para-do) moves point past ;; the filled region - (LaTeX-fill-region-as-para-do from end-marker justify-flag))))))) + (LaTeX-fill-region-as-para-do from end-marker justify-flag))))) + (set-marker end-marker nil))) ;; The content of `LaTeX-fill-region-as-para-do' was copied from the ;; function `fill-region-as-paragraph' in `fill.el' (CVS Emacs, @@ -3915,7 +3920,10 @@ space does not end a sentence, so don't break a line there." (goto-char from-plus-indent)) (if (not (> to (point))) - nil ;; There is no paragraph, only whitespace: exit now. + ;; There is no paragraph, only whitespace: exit now. + (progn + (set-marker to nil) + nil) (or justify (setq justify (current-justification))) @@ -4040,10 +4048,12 @@ space does not end a sentence, so don't break a line there." (concat "^\\([ \t]*" TeX-comment-start-regexp "+\\)*" "[ \t]*") (line-beginning-position))) - (LaTeX-fill-newline))))) + (LaTeX-fill-newline))) + (set-marker end-marker nil))) ;; Leave point after final newline. (goto-char to) (unless (eobp) (forward-char 1)) + (set-marker to nil) ;; Return the fill-prefix we used fill-prefix))) @@ -4321,7 +4331,8 @@ depends on the value of `LaTeX-syntactic-comments'." (line-beginning-position 2) justify) (goto-char end-marker) - (beginning-of-line))) + (beginning-of-line) + (set-marker end-marker nil))) (LaTeX-fill-code-comment justify))) ;; Syntax-aware filling: ;; * `LaTeX-syntactic-comments' enabled: Everything. @@ -4463,6 +4474,7 @@ formatting." (concat "^\\($\\|[ \t]+$\\|[ \t]*" TeX-comment-start-regexp "+[ \t]*$\\)"))) (forward-line 1)))) + (set-marker next-par nil) (set-marker to nil))) (message "Formatting%s...done" (or what ""))) diff --git a/style/dinbrief.el b/style/dinbrief.el index 57bf7738..f674961b 100644 --- a/style/dinbrief.el +++ b/style/dinbrief.el @@ -169,7 +169,8 @@ (marker-position addr-end) 'move) (progn (newline) - (indent-to addr-column)))))))) + (indent-to addr-column))) + (set-marker addr-end nil)))))) (LaTeX-dinbrief-insert "\n") (indent-to indentation)) (if (not (zerop (length postremark))) diff --git a/style/letter.el b/style/letter.el index a07aba53..5c64c28b 100644 --- a/style/letter.el +++ b/style/letter.el @@ -146,7 +146,8 @@ (marker-position addr-end) 'move) (progn (newline) - (indent-to addr-column)))))))) + (indent-to addr-column))))) + (set-marker addr-end nil)))) (insert "\n") (indent-to indentation)) (insert TeX-esc "opening" diff --git a/tex-info.el b/tex-info.el index ea6cab0e..4a7aed08 100644 --- a/tex-info.el +++ b/tex-info.el @@ -478,8 +478,10 @@ is assumed by default." (if (nth 1 reftex-label-menu-flags) ; section number flag (concat section-number " ")) text)) - (list 'toc "toc" text file marker level section-number - literal (marker-position marker)))) + (prog1 + (list 'toc "toc" text file marker level section-number + literal (marker-position marker)) + (set-marker marker nil)))) (defun Texinfo-reftex-hook () "Hook function to plug Texinfo into RefTeX." diff --git a/tex.el b/tex.el index d07b479d..2c5da746 100644 --- a/tex.el +++ b/tex.el @@ -3502,7 +3502,8 @@ See `TeX-parse-macro' for details." (insert TeX-arg-opening-brace) (goto-char (marker-position end)) (insert TeX-arg-closing-brace) - (setq insert-flag t)))) + (setq insert-flag t) + (set-marker end nil)))) ((= arg 0)) ; nop for clarity ((> arg 0) (TeX-parse-argument optional t) -- 2.31.1