GNU bug report logs - #5936
23.1.95; fix a bug in abbrev--before-point

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Mon, 12 Apr 2010 15:20:02 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5936 in the body.
You can then email your comments to 5936 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5936; Package emacs. (Mon, 12 Apr 2010 15:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 12 Apr 2010 15:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1.95; fix a bug in abbrev--before-point
Date: Mon, 12 Apr 2010 16:19:37 +0100
If you use the :regexp property in an abbrev table, all abbrevs in that
table will fail except those with only one char. This is because of a
regexp match in abbrev--before-point which only looks back one char.

BTW, the doc string of looking-back seems irrelevant if by default it
only looks back one char, that can't be slower than looking-at.

diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index b72bdbb..d3b95cb 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -681,7 +681,7 @@ then ABBREV is looked up in that table only."
                              (setq start (point))
                              (forward-word 1)
                              (setq end (min (point) lim)))
-                         (when (looking-back re (line-beginning-position))
+                         (when (looking-back re (line-beginning-position) t)
                            (setq start (match-beginning 1))
                            (setq end   (match-end 1)))))
                      (setq name  (buffer-substring start end))






Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5936; Package emacs. (Mon, 12 Apr 2010 18:26:01 GMT) Full text and rfc822 format available.

Message #8 received at 5936 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo <sdl.web <at> gmail.com>
Cc: 5936 <at> debbugs.gnu.org
Subject: Re: bug#5936: 23.1.95; fix a bug in abbrev--before-point
Date: Mon, 12 Apr 2010 14:25:16 -0400
> If you use the :regexp property in an abbrev table, all abbrevs in that
> table will fail except those with only one char.

Not at all.  But you may get such a result if you use a naive regexp, yes.

> This is because of a regexp match in abbrev--before-point which only
> looks back one char.

No, this is because the regexp you have to use must match part of the
text *before* the abbrev.  That's why the doc for define-abbrev-table
gives as example \<\(\w+\)\W* rather than just \(\w+\)\W*.


        Stefan






bug closed, send any further explanations to Leo <sdl.web <at> gmail.com> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Wed, 14 Apr 2010 15:40:02 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5936; Package emacs. (Thu, 15 Apr 2010 10:16:02 GMT) Full text and rfc822 format available.

Message #13 received at 5936 <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 5936 <at> debbugs.gnu.org
Subject: Re: bug#5936: 23.1.95; fix a bug in abbrev--before-point
Date: Thu, 15 Apr 2010 11:15:11 +0100
On 2010-04-12 19:25 +0100, Stefan Monnier wrote:
>> If you use the :regexp property in an abbrev table, all abbrevs in that
>> table will fail except those with only one char.
>
> Not at all.  But you may get such a result if you use a naive regexp, yes.
>
>> This is because of a regexp match in abbrev--before-point which only
>> looks back one char.
>
> No, this is because the regexp you have to use must match part of the
> text *before* the abbrev.  That's why the doc for define-abbrev-table
> gives as example \<\(\w+\)\W* rather than just \(\w+\)\W*.

Thank you for the clarification.

The bug can be closed.

>         Stefan

Leo




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 13 May 2010 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 98 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.