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.3 abbrev-insert needs a limited save-excursion Date: Thu, 07 Jul 2011 21:03:03 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1310087064 15370 80.91.229.12 (8 Jul 2011 01:04:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 8 Jul 2011 01:04:24 +0000 (UTC) Cc: 5805@debbugs.gnu.org To: Bob Nnamtrop Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 08 03:04:19 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QezUQ-0001bC-Ho for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 Jul 2011 03:04:18 +0200 Original-Received: from localhost ([::1]:48498 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QezUP-0001iO-9l for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Jul 2011 21:04:17 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:55186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QezUB-0001iI-Np for bug-gnu-emacs@gnu.org; Thu, 07 Jul 2011 21:04:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QezUA-0005NK-D7 for bug-gnu-emacs@gnu.org; Thu, 07 Jul 2011 21:04:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46022) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QezUA-0005NE-6p for bug-gnu-emacs@gnu.org; Thu, 07 Jul 2011 21:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QezU9-0002dQ-Ot; Thu, 07 Jul 2011 21:04:01 -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: Fri, 08 Jul 2011 01:04:01 +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: patch Original-Received: via spool by 5805-submit@debbugs.gnu.org id=B5805.131008700510075 (code B ref 5805); Fri, 08 Jul 2011 01:04:01 +0000 Original-Received: (at 5805) by debbugs.gnu.org; 8 Jul 2011 01:03:25 +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 1QezTY-0002cS-RI for submit@debbugs.gnu.org; Thu, 07 Jul 2011 21:03:25 -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 1QezTX-0002cD-8V for 5805@debbugs.gnu.org; Thu, 07 Jul 2011 21:03:24 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EADpXFk5MCqt8/2dsb2JhbABTpz14iHvDS4Y4BJ5xhC8 X-IronPort-AV: E=Sophos;i="4.65,496,1304308800"; d="scan'208";a="123480958" Original-Received: from 76-10-171-124.dsl.teksavvy.com (HELO pastel.home) ([76.10.171.124]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 07 Jul 2011 21:03:04 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 570D759006; Thu, 7 Jul 2011 21:03:03 -0400 (EDT) In-Reply-To: (Bob Nnamtrop's message of "Thu, 7 Jul 2011 18:02:15 -0600") 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: Thu, 07 Jul 2011 21:04:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:48229 Archived-At: > Here are two patches that do what I explained above. I am new to elisp > so be kind :-) Note that these apply against the trunk (sorry to be > switching back of forth). I still haven't thought about the save-excursion issue, but for the other, I think the fix should be complete in viper without changing expand-abbrev. The way it work in "normal Emacs" is the self-insert-command only calls expand-abbrev if (as its docstring explains) the char inserted doesn't have word syntax and the previous one does. The corresponding code (it's in C): if (!NILP (BVAR (current_buffer, abbrev_mode)) && synt != Sword && NILP (BVAR (current_buffer, read_only)) && PT > BEGV && (SYNTAX (!NILP (BVAR (current_buffer, enable_multibyte_characters)) ? XFASTINT (Fprevious_char ()) : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ()))) == Sword)) { -- Stefan