Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

abbrev and escapes

1 view
Skip to first unread message

harven

unread,
Nov 23, 2009, 5:24:07 AM11/23/09
to
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)

Stefan Monnier

unread,
Nov 23, 2009, 10:25:58 PM11/23/09
to
> Unfortunately, it does not work anymore with emacs23.

Try M-x report-emacs-bug.


Stefan

0 new messages