* global-set-key not global?
@ 2004-02-05 17:54 Emory Smith
0 siblings, 0 replies; 6+ messages in thread
From: Emory Smith @ 2004-02-05 17:54 UTC (permalink / raw)
im using the following in my .emacs:
(global-set-key "\C-j" 'bs-cycle-next)
(global-set-key "\M-j" 'bs-cycle-previous)
but a number of major modes still seem to have C-j bound to
insert-newline.
it works fine if i use local-set-key inside the add-hook for every
mode, but seems like i shouldnt have to do this.
also, how can i use the semicolon in a keybinding. obviously, the
following doesnt work:
(global-set-key "\C-;" 'indent-for-comment)
how can i escape the ";" character so that it doesnt look like a
comment to elisp?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: global-set-key not global?
[not found] <mailman.1967.1076003924.928.help-gnu-emacs@gnu.org>
@ 2004-02-05 19:35 ` Stefan Monnier
[not found] ` <AB8C2728-59BF-11D8-ABDD-000A958A3AF4@mac.com>
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2004-02-05 19:35 UTC (permalink / raw)
> im using the following in my .emacs:
> (global-set-key "\C-j" 'bs-cycle-next)
> (global-set-key "\M-j" 'bs-cycle-previous)
> but a number of major modes still seem to have C-j bound to insert-newline.
> it works fine if i use local-set-key inside the add-hook for every mode, but
> seems like i shouldnt have to do this.
Indeed. Report those things as bugs.
> also, how can i use the semicolon in a keybinding. obviously, the following
> doesnt work:
> (global-set-key "\C-;" 'indent-for-comment)
Indeed, because C-; is not a character (contrary to C-a and a few other
such special cases) so you can't put it in a string.
Instead use the form [(control ?\;)].
> how can i escape the ";" character so that it doesnt look like a comment
> to elisp?
In your code above it should work just fine since it's inside a string.
When it's not inside a string use \ as I did above.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: global-set-key not global?
[not found] ` <AB8C2728-59BF-11D8-ABDD-000A958A3AF4@mac.com>
@ 2004-02-07 22:50 ` Emory Smith
[not found] ` <mailman.2070.1076194243.928.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 6+ messages in thread
From: Emory Smith @ 2004-02-07 22:50 UTC (permalink / raw)
On Feb 5, 2004, at 12:35 PM, Stefan Monnier wrote:
>> im using the following in my .emacs:
>> (global-set-key "\C-j" 'bs-cycle-next)
>> (global-set-key "\M-j" 'bs-cycle-previous)
>
>> but a number of major modes still seem to have C-j bound to
>> insert-newline.
>> it works fine if i use local-set-key inside the add-hook for every
>> mode, but
>> seems like i shouldnt have to do this.
>
> Indeed. Report those things as bugs.
>
so a local keymap entry is not supposed to override a global one?
i didnt think this was actually a bug, but was rather wondering how i
might make a global-set-key apply to all major modes, even if they have
their own local binding of that key (without using a hook for every
mode).
thanks, emory
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: global-set-key not global?
[not found] ` <mailman.2070.1076194243.928.help-gnu-emacs@gnu.org>
@ 2004-02-08 13:29 ` Kai Grossjohann
2004-02-09 19:18 ` Kevin Rodgers
0 siblings, 1 reply; 6+ messages in thread
From: Kai Grossjohann @ 2004-02-08 13:29 UTC (permalink / raw)
Emory Smith <emory.smith@mac.com> writes:
> On Feb 5, 2004, at 12:35 PM, Stefan Monnier wrote:
>
>>> im using the following in my .emacs:
>>> (global-set-key "\C-j" 'bs-cycle-next)
>>> (global-set-key "\M-j" 'bs-cycle-previous)
>>
>>> but a number of major modes still seem to have C-j bound to
>>> insert-newline.
>>> it works fine if i use local-set-key inside the add-hook for every
>>> mode, but
>>> seems like i shouldnt have to do this.
>>
>> Indeed. Report those things as bugs.
>>
>
> so a local keymap entry is not supposed to override a global one?
No. But the global bindings for C-j and M-j should work for all
modes, so that there is no need for a mode to bind C-j and M-j itself.
So Stefan was only referring to these two keys. For other keys, it's
different.
Kai
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: global-set-key not global?
2004-02-08 13:29 ` Kai Grossjohann
@ 2004-02-09 19:18 ` Kevin Rodgers
2004-02-12 14:00 ` Kai Grossjohann
0 siblings, 1 reply; 6+ messages in thread
From: Kevin Rodgers @ 2004-02-09 19:18 UTC (permalink / raw)
Kai Grossjohann wrote:
> Emory Smith <emory.smith@mac.com> writes:
>>On Feb 5, 2004, at 12:35 PM, Stefan Monnier wrote:
>>>>im using the following in my .emacs:
>>>>(global-set-key "\C-j" 'bs-cycle-next)
>>>>(global-set-key "\M-j" 'bs-cycle-previous)
>>>>
>>>>but a number of major modes still seem to have C-j bound to
>>>>insert-newline.
>>>>it works fine if i use local-set-key inside the add-hook for every
>>>>mode, but
>>>>seems like i shouldnt have to do this.
>>>
>>>Indeed. Report those things as bugs.
>>
>>so a local keymap entry is not supposed to override a global one?
>
> No. But the global bindings for C-j and M-j should work for all
> modes, so that there is no need for a mode to bind C-j and M-j itself.
>
> So Stefan was only referring to these two keys. For other keys, it's
> different.
C-j is LFD so I can understand why Emacs might treat it specially (and
presumably C-m aka RET). But what is the significance of M-j?
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: global-set-key not global?
2004-02-09 19:18 ` Kevin Rodgers
@ 2004-02-12 14:00 ` Kai Grossjohann
0 siblings, 0 replies; 6+ messages in thread
From: Kai Grossjohann @ 2004-02-12 14:00 UTC (permalink / raw)
Kevin Rodgers <ihs_4664@yahoo.com> writes:
> C-j is LFD so I can understand why Emacs might treat it specially (and
> presumably C-m aka RET). But what is the significance of M-j?
No, it does not have to do with the fact that C-j happens to be LFD.
It has to do with the fact that the default binding of C-j is
newline-and-indent, and that function should indent correctly in all
modes, by way of the indent-line-function variable.
M-j is bound to indent-new-comment-line by default, which reads some
variables to learn how to make a comment. So the fix is to set the
variables so that the comment comes out right, rather than to change
the keybinding.
(Compare M-; which is comment-dwim in all modes, regardless of comment
syntax. You don't have comment-latex, comment-c, comment-pascal, ...)
Kai
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-02-12 14:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.1967.1076003924.928.help-gnu-emacs@gnu.org>
2004-02-05 19:35 ` global-set-key not global? Stefan Monnier
[not found] ` <AB8C2728-59BF-11D8-ABDD-000A958A3AF4@mac.com>
2004-02-07 22:50 ` Emory Smith
[not found] ` <mailman.2070.1076194243.928.help-gnu-emacs@gnu.org>
2004-02-08 13:29 ` Kai Grossjohann
2004-02-09 19:18 ` Kevin Rodgers
2004-02-12 14:00 ` Kai Grossjohann
2004-02-05 17:54 Emory Smith
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).