emacs-devel
[Top][All Lists]
Advanced

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

Re: save-excursion and the mark


From: Nicolas Richard
Subject: Re: save-excursion and the mark
Date: Thu, 28 May 2015 19:42:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:
>                             I.e. point me to code which would misbehave
> if save-excursion were to stop saving&restoring the mark (and/or its
> activation status).

I found two more places where the behaviour is/was used :

1. In AUCTeX, e.g.

(defun LaTeX-fill-environment (justify)
  "Fill and indent current environment as LaTeX text."
  (interactive "*P")
  (save-excursion
    (LaTeX-mark-environment) ;; <= this activates the mark
    (re-search-forward "{\\([^}]+\\)}")
    (LaTeX-fill-region (region-beginning) (region-end) justify
                       (concat " environment " (TeX-match-buffer 1))))

The mark ends up being active when it was not. This happens with emacs
master, and doesn't happen with emacs 24.

2. In replace.el, in query-replace-read-from

There is a comment:
            ;; The save-excursion here is in case the user marks and copies
            ;; a region in order to specify the minibuffer input.
            ;; That should not clobber the region for the query-replace itself.

and indeed, with emacs master, if you mark some text (to act only on
that region), hit M-%, then C-x o, mark some other text, hit C-x o
again, and fill the prompt to do a replacement, the replacement is done
on the newly marked region. Here also, this doesn't happen in emacs 24.

I hope this helps.

Nicolas.




reply via email to

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