bug-auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-AUCTeX] 2014-07-13; Requests for the mark management improvemen


From: Tassilo Horn
Subject: Re: [Bug-AUCTeX] 2014-07-13; Requests for the mark management improvements
Date: Thu, 02 Oct 2014 14:07:41 +0200
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Ikumi Keita <address@hidden> writes:

Hi!

> (1) The mark position is not recorded in mark-ring when using C-c .
>     (LaTeX-mark-environment).
>     This is inconvenient when I plan to go back to the marked position
>     afterward.
>
>     Example:
>     1. Open the following file with AUCTeX.
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \documentclass{article}
>
> \begin{document}
> \begin{itemize}
> \item abc
> \item MARK HERE
> \item xyz
> \end{itemize}
>
> \end{document}
>
> %%% Local Variables:
> %%% mode: latex
> %%% TeX-master: t
> %%% End:
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>     2. Put the point on the text "MARK HERE" and type C-SPC.
>     3. Type C-c . to cover the itemize environment with a region.
>     4. Type C-u C-SPC several times.  You cannot go back to the position
>        "MARK HERE".

Indeed.

>     The reason is that LaTeX-mark-environment uses set-mark, not
>     push-mark.  Considering that the doc string of set-mark tells
>     to avoid using set-mark, I propose the attached patch-1 to replace
>     set-mark with push-mark.
>
>     Similar issue seems to apply for ConTeXt-mark-environment in
>     context.el and Texinfo-mark-environment, Texinfo-mark-section in
>     tex-info.el so the patch-1 includes fixes for them, too.

Thanks, I've committed your patch.

> (2) TeX-insert-dollar now has a nice feature that repeating type of `$'
>     toggles between inline equation, display equation, and no equation
>     if TeX-electric-math is properly set up.  I have a question about
>     the management of the mark with respect to that toggle.
>
> --- Quote from TeX-insert-dollar in tex.el ----------------------------
>       (cond
>        ;; $...$ to $$...$$
>        ((and (eq last-command 'TeX-insert-dollar)
>            (re-search-forward "\\=\\$\\([^$][^z-a]*[^$]\\)\\$" (mark) t))
>       (replace-match "$$\\1$$")
>       (push-mark (match-beginning 0) t))
>        ;; \(...\) to \[...\]
>        ((and (eq last-command 'TeX-insert-dollar)
>            (re-search-forward "\\=\\\\(\\([^z-a]*\\)\\\\)" (mark) t))
>       (replace-match "\\\\[\\1\\\\]")
>       (push-mark (match-beginning 0) t))
>        ;; 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))
>        (t
> -----------------------------------------------------------------------
>
>     Here push-mark is called every time for a toggle.  They repeat to
>     save the mark position in mark-ring, which results in mark-ring
>     populated with duplicated markers with the same position like this:
> (#<marker at 45 in abc.tex> #<marker at 45 in abc.tex> #<marker at 42 in 
> abc.tex> #<marker at 42 in abc.tex> #<marker at 42 in abc.tex> #<marker at 42 
> in abc.tex> #<marker at 42 in abc.tex> #<marker at 42 in abc.tex>)
>
>     Is this an intended behaviour?

I guess no but I'm not using that feature so I'm no authority here.

>     If not so, I propose to replace push-mark with just goto-char like
>     in the attached patch-2.  (Although looking-at should be used
>     instead of re-search-forward in the above quoted portion for code
>     readability, I don't touch those lines here.)

Sorry, in the current form this patch cannot go in since `activate-mark'
seems not to be available in XEmacs.

Bye,
Tassilo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]