From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.devel Subject: Re: save-excursion and the mark Date: Wed, 25 Feb 2015 12:35:18 +0000 Message-ID: <87ioeq2mpl.fsf@violet.siamics.net> References: <54ECA136.60004@online.de> <54EDB6E2.70602@online.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1424867759 25112 80.91.229.3 (25 Feb 2015 12:35:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Feb 2015 12:35:59 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 25 13:35:51 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 1YQbBv-0001Ed-9I for ged-emacs-devel@m.gmane.org; Wed, 25 Feb 2015 13:35:51 +0100 Original-Received: from localhost ([::1]:53972 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQbBu-0007pC-Jk for ged-emacs-devel@m.gmane.org; Wed, 25 Feb 2015 07:35:50 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQbBc-0007la-FF for emacs-devel@gnu.org; Wed, 25 Feb 2015 07:35:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQbBa-0000HB-SV for emacs-devel@gnu.org; Wed, 25 Feb 2015 07:35:32 -0500 Original-Received: from fely.am-1.org ([2a01:4f8:d15:1b86::2]:41773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQbBa-0000Gx-J7 for emacs-devel@gnu.org; Wed, 25 Feb 2015 07:35:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=RtzTPi2czOkLTpwkxb9lu+V3fYe7IWCtAE5RnBvnYjQ=; b=IB7psHwE4WBK6alP6h56zhsCbxq/Bp00YEzm9IGoPBqLVw2vRPny6QoFadQGnRPuRnHDmln9WyUrTNyRxswfasO+fhfLU1qhyraIqgE+5xp7GqIsCenB051oSV1DwxbQ6IZpHPT/5yZGBQSD1H7c0cez1AI4AHY1B3JZwayd9hc=; Original-Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YQbBW-0007wr-7l for emacs-devel@gnu.org; Wed, 25 Feb 2015 12:35:26 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YQbBO-0006rn-Ud for emacs-devel@gnu.org; Wed, 25 Feb 2015 19:35:19 +0700 Mail-Followup-To: emacs-devel@gnu.org In-Reply-To: <54EDB6E2.70602@online.de> ("Andreas \=\?utf-8\?Q\?R\=C3\=B6hler\=22\?\= \=\?utf-8\?Q\?'s\?\= message of "Wed, 25 Feb 2015 12:49:54 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a01:4f8:d15:1b86::2 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:183491 Archived-At: >>>>> Andreas R=C3=B6hler writes: >>>>> On 25.02.2015 03:59, Stefan Monnier wrote: >>> See for example indent-code-ridigly. >> Can you give more details about how this requires save&restore of >> the mark (or its "active" status)? > Think a shifting code by TAB in python-mode. FWIW, python.el doesn=E2=80=99t seem to use the mark. > Mark might exist somewhere in line. Shifting will use its own region > =E2=80=93 but original region should be restored =E2=80=93 if any. Shif= ting by > itself should not create a region nor clutter the mark-ring. There seem to be a misunderstanding; the notion of /Emacs Lisp/ region is different to that of /Emacs/ region, the former being (more or less) a way of saying =E2=80=9Cfrom here to there=E2=80=9D, and does /not/ (generally) involve either mark or point. For instance, indent-code-ridigly can be used from Lisp like: (indent-code-ridigly 13 37) Or perhaps: (when-let ((here (re-search-backward "START" nil t)) (there (re-search-forward "END" nil t))) (indent-code-ridigly here there)) With the common idiom being: (let ((save (point))) ; Move point forward, by some amount. (indent-code-ridigly save (point))) As should be obvious, the mark is /not/ involved in either case. And, arguably, it /should not/ be. [=E2=80=A6] > commit b1d6ddd44614c84746f5ee494e1f29cd9be8a2d8 > Notable changes to goto-line, i. e. calling push-mark. That makes a point, indeed: there=E2=80=99s a class of Emacs commands intended first and foremost for interactive use. Naturally, goto-line is one of them; to quote its docstring: This function is for interactive use only; in Lisp code use `forward-line' instead. The proposed change to save-excursion would expose the bugs in the code which uses such commands inside of save-excursion, which now masks the unfortunate side-effects of such (mis)use. --=20 FSF associate member #7257 np. Rule the World =E2=80=94 Kamelot 3013 B6A0= 230E 334A