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

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

abbrev and escapes


From: harven
Subject: abbrev and escapes
Date: Mon, 23 Nov 2009 11:24:07 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Here is a sample code that works with emacs22 in fundamental or tex mode.
It expands \med into \medskip.

(progn
   (clear-abbrev-table my-table)
   (define-abbrev-table 'my-table '(
      ("success" "success again")
      ("\\med"   "\\medskip")))
   (setq local-abbrev-table my-table)
   (setq abbrev-mode t)                      
   (setq words-include-escapes t))

Unfortunately, it does not work anymore with emacs23.
I tried tweaking the new :regexp property to no avail.

(abbrev-table-put my-table :regexp  "\\<?\\(\\\\?\\w+\\)\\W*")

I also tried
 "\\(\\(\\\\\\|\\<\\)\\w+\\)\\W*"
 "\\(\\(\\<\\|\w\\)\\w+\\)\\W*"
 "\\(\\<?\\\\?\\w+\\)\\W*"
 "\\(\\\\?\\w+\\)\\W*"

The closest I came is  "\\(\\\\\\w+\\)\\W*"
that expands \med but, of course, not success.

What am I doing wrong here ?

BTW, isn't there a typo in the manual ? 
The default regexp given there (36.8 Abbrev Table Properties)
is "\\<\\(\\w+\\)\\W" and does not seem to work, but the one that comes with
the definition of define-abbrev-table is "\\<\\(\\w+\\)\\W*" (and it works)



reply via email to

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