Hi!

> But are you sure that changing the GNU Emacs version of
> `TeX-activate-region' from a no-op to the above has no undesired
> side-effects?  I mean, it's also used at some other places in latex.el,
> tex-info.el, and context.el.

I expect that the change doesn't bring about undesired side-effects.
Here is the summary of the investigation.

(1) The uses of `TeX-activate-region' in latex.el, tex-info.el and
    context.el are essentially the same.  It is used in
    `LaTeX-mark-environment', `LaTeX-mark-section' and its friends, and
    in the following form:

(defun XXX-mark-YYY (&optional ZZZ)
...
  (TeX-activate-region))

(2) There is one difference to `LaTeX-mark-environment' between before
    and after my change to `TeX-activate-region'.  When
    `transient-mark-mode' is nil, after `LaTeX-mark-environment'
    the region is...
    - not activated if `TeX-activate-region' is no-op
    - activated with `TeX-activate-region' with my change.

That is the only side-effect to `LaTeX-mark-environment' I'm aware of
currently.  I hope side-effects to others are limited to similar
harmless ones.

However, if you are afraid of undiscovered incompatibilities, I don't
adhere to changing `TeX-activate-region'.  In that case, I hope the
attached patch which just changes `push-mark' to `set-mark' in
`TeX-insert-dollar' would be helpful.

Regards,
Ikumi Keita

diff --git a/tex.el b/tex.el
--- a/tex.el
+++ b/tex.el
@@ -5540,18 +5540,18 @@
        ((and (eq last-command 'TeX-insert-dollar)
 	     (re-search-forward "\\=\\$\\([^$][^z-a]*[^$]\\)\\$" (mark) t))
 	(replace-match "$$\\1$$")
-	(push-mark (match-beginning 0) t))
+	(set-mark (match-beginning 0)))
        ;; \(...\) to \[...\]
        ((and (eq last-command 'TeX-insert-dollar)
 	     (re-search-forward "\\=\\\\(\\([^z-a]*\\)\\\\)" (mark) t))
 	(replace-match "\\\\[\\1\\\\]")
-	(push-mark (match-beginning 0) t))
+	(set-mark (match-beginning 0)))
        ;; Strip \[...\] or $$...$$
        ((and (eq last-command 'TeX-insert-dollar)
 	     (or (re-search-forward "\\=\\\\\\[\\([^z-a]*\\)\\\\\\]" (mark) t)
 		 (re-search-forward "\\=\\$\\$\\([^z-a]*\\)\\$\\$" (mark) t)))
 	(replace-match "\\1")
-	(push-mark (match-beginning 0) t))
+	(set-mark (match-beginning 0)))
        (t
 	;; We use `save-excursion' because point must be situated before opening
 	;; symbol.
_______________________________________________
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to