* bug#5936: 23.1.95; fix a bug in abbrev--before-point
@ 2010-04-12 15:19 Leo
2010-04-12 18:25 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Leo @ 2010-04-12 15:19 UTC (permalink / raw)
To: 5936
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))
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#5936: 23.1.95; fix a bug in abbrev--before-point
2010-04-12 15:19 bug#5936: 23.1.95; fix a bug in abbrev--before-point Leo
@ 2010-04-12 18:25 ` Stefan Monnier
2010-04-15 10:15 ` Leo
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2010-04-12 18:25 UTC (permalink / raw)
To: Leo; +Cc: 5936
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#5936: 23.1.95; fix a bug in abbrev--before-point
2010-04-12 18:25 ` Stefan Monnier
@ 2010-04-15 10:15 ` Leo
0 siblings, 0 replies; 3+ messages in thread
From: Leo @ 2010-04-15 10:15 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 5936
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-15 10:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-12 15:19 bug#5936: 23.1.95; fix a bug in abbrev--before-point Leo
2010-04-12 18:25 ` Stefan Monnier
2010-04-15 10:15 ` Leo
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.