My setup
GNU Emacs GUI (version 24.4.51.1 (x86_64-w64-mingw32) compiled from Harroogan Emacs.)
Situation
I would like to type a word in PHP-mode, and it will automatically expand to a proper word.
For example, I would like to type $session
and he will expand it to $_SESSION
.
When reading the manual about Abbrev mode
Type the word you want to use as expansion, and then type ‘C-x a g’ and the abbreviation for it. Example:
t h e C-x a g t e h RET
Unfortunately, if you wanted to abbreviate Read The Fine Manual with RTFM, you couldn’t just type C-x a g after “Read the Fine Manual
So I put the cursor behind the word $_SESSION
, then C-x a g
and type $session. But I notice it will only expand session
to SESSION
without the underhyphen or the dollar variable.
When I'm looking in the .abbrev_defs
with M-x edit-abbrevs
, then the following is mentioned:
(global-abbrev-table)
"session" 0 "SESSION"
Then I try to change it to
"session" 2 "$_SESSION"
And save it with M-x write-abbrev-file
, it didn't help. Maybe the abbrev uses regexp (?), thuis excluding the dollar sign. Any another suggestion?
(define-abbrev-table 'global-abbrev-table '( ("session" "$_SESSION" nil 2) ))
in.emacs
works for me.4se
for abbrev. Do you have some link of something?