[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group'
From: |
Philip Kaludercic |
Subject: |
Re: [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group' |
Date: |
Mon, 29 Aug 2022 10:18:05 +0000 |
Arash Esbati <arash@gnu.org> writes:
>
> Philip Kaludercic <philipk@posteo.net> writes:
>
>> IIRC environments are usually inserted in one go, so the atomic change
>> group wouldn't make much of a difference, or am I mistaken?
>
> Not always, try:
>
> \documentclass[10pt]{article}
> \usepackage{fancyvrb}
> \begin{document}
>
> Hit C-c C-n to parse the document. Then do:
>
> C-c C-e Verbatim RET C-q
>
> which inserts the environment like this:
>
> \begin{Verbatim}
> * is the position of point
> \end{Verbatim}
>
> \end{document}
>
> %%% Local Variables:
> %%% mode: latex
> %%% TeX-master: t
> %%% End:
For some reason there seems something is wrong on my end, so that
"Verbatim" is not even suggested as a known environment, but I belive
you that it is possible.
>> If so, this patch should do the job:
>>
>> From 4e25d3ba7ee1b6399d544cc32d9e10a63ab6a1d7 Mon Sep 17 00:00:00 2001
>> From: Philip Kaludercic <philipk@posteo.net>
>> Date: Sun, 28 Aug 2022 14:14:04 +0200
>> Subject: [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group'
>
> Wrong patch attached?
Yes, sorry about that:
>From bb5bd4b9b178f1363ef8cc01db2c4f5515a539c5 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Mon, 29 Aug 2022 11:13:34 +0200
Subject: [PATCH] Wrap environment insertion in an atomic change group
* latex.el (LaTeX-insert-environment): Add new function that calls
'LaTeX-insert-environment-1' in an atomic change group.
* latex.el (LaTeX-insert-environment-1): Rename 'LaTeX-insert-environment'.
---
latex.el | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/latex.el b/latex.el
index 9d6c37e7..93d5029c 100644
--- a/latex.el
+++ b/latex.el
@@ -691,6 +691,12 @@ environment just inserted, the buffer position just before
\\begin and the position just before \\end.")
(defun LaTeX-insert-environment (environment &optional extra)
+ "Insert LaTeX ENVIRONMENT with optional argument EXTRA.
+See `LaTeX-insert-environment-1'."
+ (atomic-change-group
+ (LaTeX-insert-environment-1 environment extra)))
+
+(defun LaTeX-insert-environment-1 (environment &optional extra)
"Insert LaTeX ENVIRONMENT with optional argument EXTRA."
(let ((active-mark (and (TeX-active-mark) (not (eq (mark) (point)))))
prefix content-start env-start env-end additional-indent)
--
2.37.2
> Best, Arash
- [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group', Philip Kaludercic, 2022/08/28
- Re: [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group', Tassilo Horn, 2022/08/29
- Re: [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group', Arash Esbati, 2022/08/29
- Re: [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group', Philip Kaludercic, 2022/08/29
- Re: [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group', Arash Esbati, 2022/08/29
- Re: [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group',
Philip Kaludercic <=
- Re: [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group', Arash Esbati, 2022/08/29
- Re: [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group', Philip Kaludercic, 2022/08/29
- Re: [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group', Arash Esbati, 2022/08/29
- Re: [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group', Philip Kaludercic, 2022/08/29
- Re: [PATCH] * tex.el (TeX-insert-macro): Use 'atomic-change-group', Philip Kaludercic, 2022/08/29