I tried this with skeleton, and got similar problems. I cannot trigger the abbrev with _ character even it do listed in the abbrev list.
But when I bound the abbrev to character i, it works fine.
(define-skeleton underscore
"when I type _, Emacs writes _{}"
""
"_{}"
)
(define-abbrev org-mode-abbrev-table "_" "" 'underscore)
(define-abbrev org-mode-abbrev-table "i" "" 'underscore)
(org-mode-abbrev-table)
"1exp" 3 "" 1exp
"1prop" 4 "" 1prop
"1src" 6 "" 1src
"6W" 1 "" 6W
"^" 0 "" carrot
"_" 0 "" underscore
"bexp" 11 "BEGIN_EXAMPLE"
"eexp" 10 "END_EXAMPLE"
"i" 3 "" underscore
"iexp" 10 "" 1exp
"ihtml" 1 "" insert-emacser-code
"iprop" 0 "" 1prop
"isrc" 8 "" 1src
Just a curiosity - I'm currently writing an Emacs mode for theetienne mann <etienne.mann@gmail.com> writes:
Hello,
> 1) I am struggeling with my .emacs file: I want that when I press "_"
> emacs write "_{ }".
> So I write this in my .emacs file
>
> (defun souligne () (interactive)
> (insert "_{}") (forward-char -1))
> (global-set-key "_" 'souligne)
>
> It does not work. What is strange is that if I put
> (defun souligne () (interactive)
> (insert "_{}") (forward-char -1))
> (global-set-key "z" 'souligne)
> when I press "z", emacs write "_{}" !!!
>
> So in emacs, I try to M-x global-unset-key then _ but it does not work
> in emacs. the button _ still works !!!
>
> I also wanted to press ^ and get ^{} and press $ and have $ $ but it
> not works !
>
> Notice that for ( ) or {} it works fine
>
> 2) my second question is about an historical file and menu.Is it
> possible that emacs have a menu with the last 10 files that I opened ?
PicoLisp-Wiki that requires exactly this syntax:
,----
| _{}
| ^{}
| !{}
`----
(and quite a few others ...)
Are we, just by casuality, working on the same thing without being
aware of it?
My mode is almost done and lets you insert and fontificate these
constructs. I only need to add a few commands. I probably publish a Beta
version this weekend on Github, will announce it here on the list.
--
cheers,
Thorsten