help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: abbreviation ending with "."


From: harven
Subject: Re: abbreviation ending with "."
Date: Mon, 16 Nov 2009 11:34:21 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> I want to have an abbreviation that turns "p." into "para"
>> (Portuguese).  But all my abbreviations that end with "." are not
>> expanded.  I googled around and could not find anything on this.
>
> Abbreviations by default only work if they're exclusively made up of
> "word chars" (a.k.a chars of syntax class "word").
>
> So you can either change the char "." to be a word constituent (which
> may lead to surprises), or you can change the setting on the
> abbrev-table in which you placed that "p." abbreviation.
>
> E.g. if it's added to the abbrev table named `foo-abbrev-table', you
> could do
>
>    (abbrev-table-put foo-abbrev-table
>                      :regexp "\\<\\(\\w+\\.?\\)\\W*")

This does not seem to work. I tried the following with emacs -Q 

(progn
   (setq abbrev-mode t)
   (define-abbrev-table 'my-abbrev-table '(
      ("success"         "success again")
      ("try."            "try again")))
   (abbrev-table-put my-abbrev-table
                        :regexp "\\<\\(\\w+\\.?\\)\\W*")
   (setq local-abbrev-table my-abbrev-table))

success expands as success again.
try. does not expand.

Strange enough, If I try to make a new expansion for "try." with C-x a i l, 
it says that I am trying to overwrite the "try. -> try again" expansion, but 
there is still no expansion. What am I doing wrong ?

I am running "GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5) of 
2009-09-14 on raven, modified by Debian"


reply via email to

[Prev in Thread] Current Thread [Next in Thread]