* (X)Emacs abbrev mode
@ 2010-02-17 17:14 Fabrizio Sidoli
0 siblings, 0 replies; 4+ messages in thread
From: Fabrizio Sidoli @ 2010-02-17 17:14 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
I was wondering if you could tell me why the following works in XEmacs and
not in Emacs.
I have the following abbreviation
("\\s" "\\section{}\\label{:sec:}" backward-char 0)
such that in XEmacs when I type '\s' followed by a space it prints
\section{}\label{:sec:}
In Emacs, this does not work. It does not recognise the '\\s'
abbreviation. I have to use
("s" "\\section{}\\label{:sec:}" backward-char 0)
for this to work.
Is this a bug?
Many thanks,
Fabrizio
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: (X)Emacs abbrev mode
[not found] <mailman.1444.1266504194.14305.help-gnu-emacs@gnu.org>
@ 2010-02-24 19:37 ` Stefan Monnier
2010-02-24 20:27 ` Andreas Röhler
[not found] ` <mailman.1833.1267043154.14305.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 4+ messages in thread
From: Stefan Monnier @ 2010-02-24 19:37 UTC (permalink / raw)
To: help-gnu-emacs
> I was wondering if you could tell me why the following works in XEmacs and
> not in Emacs.
Because Emacs only accepts "words" as abbreviations by default.
If you want to support something else (i.e. abbreviations that contains
chars that are not marked as words in the syntax-table), then you need
to tweak your abbreviation table by setting its :regexp property.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: (X)Emacs abbrev mode
2010-02-24 19:37 ` (X)Emacs abbrev mode Stefan Monnier
@ 2010-02-24 20:27 ` Andreas Röhler
[not found] ` <mailman.1833.1267043154.14305.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 4+ messages in thread
From: Andreas Röhler @ 2010-02-24 20:27 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
Stefan Monnier wrote:
>> I was wondering if you could tell me why the following works in XEmacs and
>> not in Emacs.
>
> Because Emacs only accepts "words" as abbreviations by default.
> If you want to support something else (i.e. abbreviations that contains
> chars that are not marked as words in the syntax-table), then you need
> to tweak your abbreviation table by setting its :regexp property.
>
>
> Stefan
>
Hi Stefan,
as this question comes into my mind from time to time: is there any reason
to limit the chars usable as abbrevs at all?
Thought at security reasons, but as code is simply replaced, not executed, don't see it.
Why not allow all chars available be part of an abbrev?
Best regards,
Andreas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: (X)Emacs abbrev mode
[not found] ` <mailman.1833.1267043154.14305.help-gnu-emacs@gnu.org>
@ 2010-02-24 21:48 ` Stefan Monnier
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2010-02-24 21:48 UTC (permalink / raw)
To: help-gnu-emacs
>>> I was wondering if you could tell me why the following works in XEmacs and
>>> not in Emacs.
>> Because Emacs only accepts "words" as abbreviations by default.
>> If you want to support something else (i.e. abbreviations that contains
>> chars that are not marked as words in the syntax-table), then you need
>> to tweak your abbreviation table by setting its :regexp property.
> as this question comes into my mind from time to time: is there any reason
> to limit the chars usable as abbrevs at all?
Obviously, no good one since XEmacs does it.
As for the not-so-good ones:
- limiting them to word-chars means that you can just "grab the word
before point" and then "look it up in the table". Whereas XEmacs
can't do that and has to loop through the table and check each and
every abbrev to see if the text before point happens to be one
of them.
- there is implicitly a notion of "boundary" that's important. E.g. if
"foo" is an abbrev, you don't want it to apply to "afoo". OTOH you do
want it to apply to ",foo". The abbrev definition never makes this
boundary specification clear. IIUC XEmacs uses a heuristic which is
that if the abbrev starts with a word-component then it only matches
if the char before is not itself a word-component (i.e. this
reproduces the convention used in Emacs) and that if the first char of
the abbrev is not a word-component than it is its own boundary so an
abbrev "\foo" will also be expanded when the text before point is
"\\foo" for example.
-- Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-02-24 21:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.1444.1266504194.14305.help-gnu-emacs@gnu.org>
2010-02-24 19:37 ` (X)Emacs abbrev mode Stefan Monnier
2010-02-24 20:27 ` Andreas Röhler
[not found] ` <mailman.1833.1267043154.14305.help-gnu-emacs@gnu.org>
2010-02-24 21:48 ` Stefan Monnier
2010-02-17 17:14 Fabrizio Sidoli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).