From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bob Nnamtrop Newsgroups: gmane.emacs.bugs Subject: bug#9038: 24.0.50; limit expand-abbrev in viper mode state change Date: Sat, 9 Jul 2011 11:09:52 -0600 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1310231488 17801 80.91.229.12 (9 Jul 2011 17:11:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 9 Jul 2011 17:11:28 +0000 (UTC) To: 9038@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jul 09 19:11:24 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 1Qfb3r-0002WG-E9 for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Jul 2011 19:11:23 +0200 Original-Received: from localhost ([::1]:57000 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qfb3q-0005Ps-DH for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Jul 2011 13:11:22 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:34652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qfb3X-0005Pl-5W for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2011 13:11:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qfb3W-00017C-8i for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2011 13:11:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qfb3W-000178-5q for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2011 13:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Qfb3W-0005HJ-00; Sat, 09 Jul 2011 13:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Bob Nnamtrop Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Jul 2011 17:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9038 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.131023140620225 (code B ref -1); Sat, 09 Jul 2011 17:11:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Jul 2011 17:10:06 +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 1Qfb2b-0005G9-T5 for submit@debbugs.gnu.org; Sat, 09 Jul 2011 13:10:06 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qfb2Y-0005Fd-RD for submit@debbugs.gnu.org; Sat, 09 Jul 2011 13:10:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qfb2R-0000yC-Oi for submit@debbugs.gnu.org; Sat, 09 Jul 2011 13:09:57 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:40449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qfb2R-0000y8-Lb for submit@debbugs.gnu.org; Sat, 09 Jul 2011 13:09:55 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:34457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qfb2Q-0005K7-AM for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2011 13:09:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qfb2O-0000xd-T9 for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2011 13:09:54 -0400 Original-Received: from mail-vw0-f41.google.com ([209.85.212.41]:56115) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qfb2O-0000xY-QN for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2011 13:09:52 -0400 Original-Received: by vws4 with SMTP id 4so2552705vws.0 for ; Sat, 09 Jul 2011 10:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=fXX1oqxxqpBTDkvymrW8EFr2tdOUGXj4aU+wiwdW0UA=; b=h1RgUoS4pHdNcqhpt0yp6qexnXvpuPIv5psADe2ikU8HboGIswNxF2MbLHdY7f+U61 lDyHeYnt6qCxodEdh+A6jHS7o/aizI0drMjJtCn7tsbyS2vfl2CT5rl4EYLvIzU7/rH5 IaG4O722RfR58Ba/+gvtigDs2O8GN7yjLk6Ns= Original-Received: by 10.52.22.39 with SMTP id a7mr3697063vdf.73.1310231392118; Sat, 09 Jul 2011 10:09:52 -0700 (PDT) Original-Received: by 10.52.184.34 with HTTP; Sat, 9 Jul 2011 10:09:52 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 09 Jul 2011 13:11:02 -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:48339 Archived-At: Changing from viper insert state to vi state (called "changing state" below for brevity) causes expand-abbrev to run if abbrev's are turned on. This is good but I think the rule for if an abbrev is expanded should agree with the rule in self-insert-command when in insert mode. Thus "changing state" should only attempt to expand abbrev if and only if the previous char has word syntax. This is easily achieved with the following patch (against trunk): === modified file 'lisp/emulation/viper-cmd.el' --- lisp/emulation/viper-cmd.el 2011-05-23 17:57:17 +0000 +++ lisp/emulation/viper-cmd.el 2011-07-09 16:20:55 +0000 @@ -617,7 +617,8 @@ (or (viper-overlay-p viper-replace-overlay) (viper-set-replace-overlay (point-min) (point-min))) (viper-hide-replace-overlay) - (if abbrev-mode (expand-abbrev)) + (if (and abbrev-mode (eq (char-syntax (preceding-char)) ?w)) + (expand-abbrev)) (if (and auto-fill-function (> (current-column) fill-column)) (funcall auto-fill-function)) ;; don't leave whitespace lines around More detail: The reason I want this is because with the present behavior abbrev's often get run multiple times which can be very annoying. For example, in idlwave mode if I type in an "if ... endif" block, when I hit return after the endif the endif is caught as a abbrev which causes its hook to run (which moves the point to the corresponding begin and back). Now if I hit escape to change state the abbrev is caught again and the hook runs again. This occurs even though typing a non-word char would NOT have caused expand-abbrev to run. If I go back to insert mode and type any number of non-word char (including returns) and go back to vi mode this will happen again. Very annoying behavior. As stated, the "changing state" behavior will run expand-abbrev even if the point is many lines below the line with the abbrev. In emacs 23.1 and before, "changing state" would only run expand-abbrev if the abbrev was on the same line. This behavior changed in revision 98777 on 2009-11-25 which changed abbrev--before-point (and thus expand-abbrev) and made it jump up arbitrary number of lines to find a abbrev (note that if the abbrev-table has a re for the abbrev the behavior is the same as the old behavior of staying on one line). The doc-string for expand-abbrev says "Expand the abbrev before point, if there is an abbrev there". The "before point" is a bit ambiguous but to me it implies directly before point and not 10 lines up! I mention this because the "changing state" behavior got much more annoying after this revision since expand-abbrev was no longer bound to the line that point was on. Thanks, Bob