* about global-set-key
@ 2012-08-31 23:12 etienne mann
2012-09-01 0:20 ` Thorsten Jolitz
0 siblings, 1 reply; 10+ messages in thread
From: etienne mann @ 2012-08-31 23:12 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 865 bytes --]
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 ?
If you can help me, I would be very happy
thx
Etienne
[-- Attachment #2: Type: text/html, Size: 1044 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: about global-set-key
2012-08-31 23:12 etienne mann
@ 2012-09-01 0:20 ` Thorsten Jolitz
2012-09-01 3:54 ` David Young
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Thorsten Jolitz @ 2012-09-01 0:20 UTC (permalink / raw)
To: help-gnu-emacs
etienne 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 ?
Just a curiosity - I'm currently writing an Emacs mode for the
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: about global-set-key
2012-09-01 0:20 ` Thorsten Jolitz
@ 2012-09-01 3:54 ` David Young
[not found] ` <mailman.7893.1346482862.855.help-gnu-emacs@gnu.org>
2012-09-11 8:15 ` etienne
2 siblings, 0 replies; 10+ messages in thread
From: David Young @ 2012-09-01 3:54 UTC (permalink / raw)
To: Thorsten Jolitz; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 2622 bytes --]
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
2012/9/1 Thorsten Jolitz <tjolitz@googlemail.com>
> etienne 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 ?
>
> Just a curiosity - I'm currently writing an Emacs mode for the
> 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
>
>
>
--
M-x Thinks
[-- Attachment #2: Type: text/html, Size: 3845 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: about global-set-key
[not found] <mailman.7891.1346455860.855.help-gnu-emacs@gnu.org>
@ 2012-09-01 13:17 ` Stefan Monnier
2012-09-11 8:30 ` etienne
2012-09-11 8:59 ` etienne
0 siblings, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2012-09-01 13:17 UTC (permalink / raw)
To: help-gnu-emacs
> (global-set-key "_" 'souligne)
> It does not work. What is strange is that if I put
> (global-set-key "z" 'souligne)
> when I press "z", emacs write "_{}" !!!
What does C-h k _ tell you? Can it be you're using a major mode which
already redefines the _ key to something else (hence the global-set-key
doesn't have any effect there)?
> 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 ?
Have you tried recentf-mode?
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: about global-set-key
[not found] ` <mailman.7893.1346482862.855.help-gnu-emacs@gnu.org>
@ 2012-09-01 13:19 ` Stefan Monnier
2012-09-11 8:21 ` etienne
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2012-09-01 13:19 UTC (permalink / raw)
To: help-gnu-emacs
> I tried this with skeleton, and got similar problems. I cannot trigger the
> abbrev with _ character even it do listed in the abbrev list.
_ is not a char with word-syntax, so you'll need to use an abbrev-table
where you've provided a :regexp argument that explains which chars can
be considered.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: about global-set-key
2012-09-01 0:20 ` Thorsten Jolitz
2012-09-01 3:54 ` David Young
[not found] ` <mailman.7893.1346482862.855.help-gnu-emacs@gnu.org>
@ 2012-09-11 8:15 ` etienne
2 siblings, 0 replies; 10+ messages in thread
From: etienne @ 2012-09-11 8:15 UTC (permalink / raw)
To: Help-gnu-emacs
Dear Thorsten,
I am not working on your stuff. I am only an emacs user :)
thx
Etienne
--
View this message in context: http://emacs.1067599.n5.nabble.com/about-global-set-key-tp262753p263708.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: about global-set-key
2012-09-01 13:19 ` Stefan Monnier
@ 2012-09-11 8:21 ` etienne
0 siblings, 0 replies; 10+ messages in thread
From: etienne @ 2012-09-11 8:21 UTC (permalink / raw)
To: Help-gnu-emacs
Dear Stephan,
thank you for your reply,
The answer of emacs to C-h k _ is
*
runs the command souligne, which is an interactive Lisp function in
`init.el'.
It is bound to _.
(souligne)
Not documented.*
Recall that in my .emacs file I have
(defun souligne () (interactive)
(insert "_{}") (forward-char -1))
(global-set-key "_" 'souligne)
Etienne
--
View this message in context: http://emacs.1067599.n5.nabble.com/about-global-set-key-tp262753p263709.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: about global-set-key
2012-09-01 13:17 ` about global-set-key Stefan Monnier
@ 2012-09-11 8:30 ` etienne
2012-09-11 9:21 ` Peter Dyballa
2012-09-11 8:59 ` etienne
1 sibling, 1 reply; 10+ messages in thread
From: etienne @ 2012-09-11 8:30 UTC (permalink / raw)
To: Help-gnu-emacs
Dear Stefan,
you must be right because when I press _ on a standard file (like the
tutorial) then it write _{} as I expect but this not work in a latex file
because I you said I use an other mode.
What should be I do to use this shortcut ?
Here is the line of my .emacs file about latex and auctex
(setq reftex-plug-into-AUCTeX t)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
(require 'reftex)
(setq TeX-PDF-mode nil) ; remove pdflatex by defaut
(setq LaTeX-math-mode t) ; set Latex-math-mode
--
View this message in context: http://emacs.1067599.n5.nabble.com/about-global-set-key-tp262753p263711.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: about global-set-key
2012-09-01 13:17 ` about global-set-key Stefan Monnier
2012-09-11 8:30 ` etienne
@ 2012-09-11 8:59 ` etienne
1 sibling, 0 replies; 10+ messages in thread
From: etienne @ 2012-09-11 8:59 UTC (permalink / raw)
To: Help-gnu-emacs
Dear Stefan,
Finally I resolve my problem reading this page
http://ergoemacs.org/emacs/reclaim_keybindings.html
http://ergoemacs.org/emacs/reclaim_keybindings.html
Here is my new .emacs
*(defun parentheses () (interactive) (insert "()") (forward-char -1))
(defun modemath () (interactive)(insert "$$") (forward-char -1))
(defun souligne () (interactive)(insert "_{}") (forward-char -1))
(defun puissance () (interactive)(insert "^{}") (forward-char -1))
(add-hook 'LaTeX-mode-hook
(lambda ()
(define-key LaTeX-mode-map (kbd "(") 'parentheses)
(define-key LaTeX-mode-map (kbd "$") 'modemath)
(define-key LaTeX-mode-map (kbd "_") 'souligne)
(define-key LaTeX-mode-map (kbd "^") 'puissance)
)
)
*
Thank you very much for your hints
Etienne
--
View this message in context: http://emacs.1067599.n5.nabble.com/about-global-set-key-tp262753p263713.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: about global-set-key
2012-09-11 8:30 ` etienne
@ 2012-09-11 9:21 ` Peter Dyballa
0 siblings, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2012-09-11 9:21 UTC (permalink / raw)
To: etienne; +Cc: Help-gnu-emacs
Am 11.09.2012 um 10:30 schrieb etienne:
> What should be I do to use this shortcut ?
Put it in TeX-mode-map! Then it won't be available outside of AUCTeX.
--
Greetings
~ O
Pete ~~_\\_/%
~ O o
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-09-11 9:21 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.7891.1346455860.855.help-gnu-emacs@gnu.org>
2012-09-01 13:17 ` about global-set-key Stefan Monnier
2012-09-11 8:30 ` etienne
2012-09-11 9:21 ` Peter Dyballa
2012-09-11 8:59 ` etienne
2012-08-31 23:12 etienne mann
2012-09-01 0:20 ` Thorsten Jolitz
2012-09-01 3:54 ` David Young
[not found] ` <mailman.7893.1346482862.855.help-gnu-emacs@gnu.org>
2012-09-01 13:19 ` Stefan Monnier
2012-09-11 8:21 ` etienne
2012-09-11 8:15 ` etienne
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).