From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Nicolas Richard" Newsgroups: gmane.emacs.devel Subject: Re: save-excursion and the mark Date: Thu, 28 May 2015 19:42:38 +0200 Message-ID: <86a8wo4n01.fsf@members.fsf.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1432835128 7492 80.91.229.3 (28 May 2015 17:45:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 May 2015 17:45:28 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 28 19:45:15 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Yy1rn-00068Z-9G for ged-emacs-devel@m.gmane.org; Thu, 28 May 2015 19:45:15 +0200 Original-Received: from localhost ([::1]:60164 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yy1rm-0006FD-LG for ged-emacs-devel@m.gmane.org; Thu, 28 May 2015 13:45:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yy1ri-0006Eo-Fu for emacs-devel@gnu.org; Thu, 28 May 2015 13:45:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yy1rd-00056M-Hm for emacs-devel@gnu.org; Thu, 28 May 2015 13:45:10 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:52017) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yy1rd-00055A-Bh for emacs-devel@gnu.org; Thu, 28 May 2015 13:45:05 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Yy1rb-0005yt-9P for emacs-devel@gnu.org; Thu, 28 May 2015 19:45:03 +0200 Original-Received: from 91.178.144.178 ([91.178.144.178]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 28 May 2015 19:45:03 +0200 Original-Received: from youngfrog by 91.178.144.178 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 28 May 2015 19:45:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 36 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 91.178.144.178 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:2nMk3vjln+4/arTKYp+d5FU6zu0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:186928 Archived-At: Stefan Monnier 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.