From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#5805: 23.1; abbrev-insert does not protext itself with save-excursion Date: Mon, 12 Apr 2010 09:31:17 -0400 Message-ID: References: <87vdbzjnuq.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1271081185 9588 80.91.229.12 (12 Apr 2010 14:06:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 12 Apr 2010 14:06:25 +0000 (UTC) Cc: Chong Yidong , 5805@debbugs.gnu.org To: "Maguire\, Andrew \(GE Infra\, Energy\)" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 12 16:06:22 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O1KHL-0004vR-So for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Apr 2010 16:06:20 +0200 Original-Received: from localhost ([127.0.0.1]:32932 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1KB0-0004Ni-3M for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Apr 2010 09:59:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O1KA7-00043X-Q2 for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2010 09:58:51 -0400 Original-Received: from [140.186.70.92] (port=52086 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1KA6-00042w-9t for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2010 09:58:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O1KA4-0007V6-GB for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2010 09:58:50 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47068) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O1KA4-0007Uy-CN for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2010 09:58:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1O1JkA-0006NH-JF; Mon, 12 Apr 2010 09:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Apr 2010 13:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5805 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 5805-submit@debbugs.gnu.org id=B5805.127107908424495 (code B ref 5805); Mon, 12 Apr 2010 13:32:02 +0000 Original-Received: (at 5805) by debbugs.gnu.org; 12 Apr 2010 13:31:24 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O1JjY-0006N2-7l for submit@debbugs.gnu.org; Mon, 12 Apr 2010 09:31:24 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O1JjW-0006Mu-Q3 for 5805@debbugs.gnu.org; Mon, 12 Apr 2010 09:31:23 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEALS9wktMCqWu/2dsb2JhbACbMXK6Z4UMBItG X-IronPort-AV: E=Sophos;i="4.52,190,1270440000"; d="scan'208";a="60664448" Original-Received: from 76-10-165-174.dsl.teksavvy.com (HELO pastel.home) ([76.10.165.174]) by ironport2-out.pppoe.ca with ESMTP; 12 Apr 2010 09:31:17 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 41FC57F1B; Mon, 12 Apr 2010 09:31:17 -0400 (EDT) In-Reply-To: (Andrew Maguire's message of "Mon, 12 Apr 2010 13:28:50 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 12 Apr 2010 09:32:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:36203 Archived-At: > I do appreciate the need for some abbrevs to move point and that I am > reporting a perceived change in behaviour. > However, the question is whether the change in behaviour is deliberate > or not. The change was not deliberate, no. > If a user wishes to create an abbrev that requires point to move > presumably they have to create the abbrev in a certain way. > The example you give below would still require user code to move point > to between the LaTeX statements. > i.e If I created a simple global abbrev to expand "begi" point would be > left after the \end{itemize}^ Yes, the abbrev would need to be defined differently, but the point-movement would be done by the abbrev itself, i.e. the caller would still just call expand-abbrev. > So how should I fix my code that uses expand-abbrev to work in Emacs 23? > It currently works as is in Emacs 20, 21 and 22. I think you need to add a save-excursion around the call to expand-abbrev to make it clear that you don't want this call to move point. This will also save you in the case where the user has setup an abbrev like "begi", which is a case that could also happen in previous Emacsen. But that really depends on what behavior you expect in the case where your code encounters a "begi"-like abbrev. Stefan > Thanks, > Andrew > -----Original Message----- > From: Stefan Monnier [mailto:monnier@iro.umontreal.ca] > Sent: 10 April 2010 20:10 > To: Maguire, Andrew (GE Infra, Energy) > Cc: Chong Yidong; 5805@debbugs.gnu.org > Subject: Re: bug#5805: 23.1; abbrev-insert does not protext itself with > save-excursion >> Create a global abbrev, abbrv => abbrev >> Type the following, ^ indicating point location. >> abbrv () >> ^ >> Then press C-x ' to expand the abbrev on the line. >> abbrev () >> ^ >> Observe that point ^ is now before the ()s. > Right. The question now is: why is that a problem? > I ask because for some abbrevs, moving point isa feature, e.g. an abbrev > that uses skeletons to expand > begi > ^ > into > \begin{itemize} \end{itemize} > ^ > so maybe the problem is that your code makes unwarranted assumptions > about what abbrevs can do, or maybe your code knows that it won't > encounter such abbreviations or that it wouldn't care about their > point-placement feature, so it could/should use save-excursion. >> ;; Emacs 23 has a lisp implementation for abbrevs. > BTW, the problem is not that the implementation is in Lisp, but that it > behaves differently. > Stefan