* Disabling M-q
@ 2013-05-15 15:31 Cecil Westerhof
2013-05-16 2:59 ` Yuri Khan
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Cecil Westerhof @ 2013-05-15 15:31 UTC (permalink / raw)
To: help-gnu-emacs
A friend asked how to disable M-q. My first thought was:
(local-unset-key (kbd "\M-q"))
or
(local-set-key (kbd "M-q") nil)
But both did not work. I am now using:
(local-set-key (kbd "M-q") "")
and this works. Is this the best way, or is there a better way?
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Disabling M-q
2013-05-15 15:31 Disabling M-q Cecil Westerhof
@ 2013-05-16 2:59 ` Yuri Khan
2013-05-18 4:43 ` B. T. Raven
[not found] ` <mailman.25881.1368673172.855.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 13+ messages in thread
From: Yuri Khan @ 2013-05-16 2:59 UTC (permalink / raw)
To: Cecil Westerhof; +Cc: help-gnu-emacs
On Wed, May 15, 2013 at 10:31 PM, Cecil Westerhof <Cecil@decebal.nl> wrote:
> A friend asked how to disable M-q. My first thought was:
> (local-unset-key (kbd "\M-q"))
> or
> (local-set-key (kbd "M-q") nil)
You need to unset the key in the map that sets it, or override it with
another function in a higher-priority map (as you do below with the
empty string, which is not a proper function).
> But both did not work. I am now using:
> (local-set-key (kbd "M-q") "")
>
> and this works. Is this the best way, or is there a better way?
You could bind the `ignore' function discussed recently on this list.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Disabling M-q
2013-05-15 15:31 Disabling M-q Cecil Westerhof
2013-05-16 2:59 ` Yuri Khan
@ 2013-05-18 4:43 ` B. T. Raven
2013-05-18 10:26 ` Emanuel Berg
[not found] ` <mailman.25881.1368673172.855.help-gnu-emacs@gnu.org>
2 siblings, 1 reply; 13+ messages in thread
From: B. T. Raven @ 2013-05-18 4:43 UTC (permalink / raw)
To: help-gnu-emacs
> A friend asked how to disable M-q. My first thought was:
> (local-unset-key (kbd "\M-q"))
> or
> (local-set-key (kbd "M-q") nil)
>
> But both did not work. I am now using:
> (local-set-key (kbd "M-q") "")
>
> and this works. Is this the best way, or is there a better way?
>
How about either
(global-unset-key [(meta q)]
or
(local-unset-key [(meta q)]
??
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Disabling M-q
2013-05-18 4:43 ` B. T. Raven
@ 2013-05-18 10:26 ` Emanuel Berg
2013-05-18 17:44 ` B. T. Raven
0 siblings, 1 reply; 13+ messages in thread
From: Emanuel Berg @ 2013-05-18 10:26 UTC (permalink / raw)
To: help-gnu-emacs
"B. T. Raven" <btraven@nihilo.net> writes:
>> A friend asked how to disable M-q. My first thought was:
>> (local-unset-key (kbd "\M-q"))
>> or
>> (local-set-key (kbd "M-q") nil)
>>
>> But both did not work. I am now using:
>> (local-set-key (kbd "M-q") "")
>>
>> and this works. Is this the best way, or is there a better way?
>
> How about either
>
> (global-unset-key [(meta q)]
>
> or
>
> (local-unset-key [(meta q)]
I wrote a couple of lines you can experiment with. Use `C-h w' for the
functions and `C-x C-e' to change keybinding.
The local binding will shadow the global. If the global is shadowed,
it won't report any key on `C-h w'. But, as soon as you unset the
local, or set it to the nils, the global is back on. When the local is
set to the empty string, the shadow is on (i.e., the global is off)
only this "shadow" doesn't do anything.
Like I said, play around with it.
(defun test-message-local () (interactive) (message "local check"))
(defun test-message-global () (interactive) (message "global check"))
(global-unset-key (kbd "C-M-w")) ; either unset both
(local-unset-key (kbd "C-M-w"))
(global-set-key (kbd "C-M-w") 'test-message-global) ; test C-h w here
(local-set-key (kbd "C-M-w") 'test-message-local) ; shadows global
(local-set-key (kbd "C-M-w") nil) ; these four - global *on*
(local-set-key (kbd "C-M-w") 'nil)
(local-set-key (kbd "C-M-w") ())
(local-set-key (kbd "C-M-w") '())
(local-set-key (kbd "C-M-w") "") ; this - local "nothing" shadow
--
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Disabling M-q
2013-05-18 10:26 ` Emanuel Berg
@ 2013-05-18 17:44 ` B. T. Raven
2013-05-21 8:21 ` Cecil Westerhof
0 siblings, 1 reply; 13+ messages in thread
From: B. T. Raven @ 2013-05-18 17:44 UTC (permalink / raw)
To: help-gnu-emacs
> "B. T. Raven" <btraven@nihilo.net> writes:
>
>>> A friend asked how to disable M-q. My first thought was:
>>> (local-unset-key (kbd "\M-q"))
This was the original question. Should M be escaped in a string here?
Did you try the vector description of "M-q"? I notice that (kbd <key>...
returns a specific vector but the vector [(meta q)] just evaluates to
itself. Have you tried:
(define-key (current-local-map) [(meta q)] nil)
??
>>> or
>>> (local-set-key (kbd "M-q") nil)
>>>
>>> But both did not work. I am now using:
>>> (local-set-key (kbd "M-q") "")
>>>
>>> and this works. Is this the best way, or is there a better way?
>>
>> How about either
>>
>> (global-unset-key [(meta q)]
>>
>> or
>>
>> (local-unset-key [(meta q)]
>
> I wrote a couple of lines you can experiment with. Use `C-h w' for the
> functions and `C-x C-e' to change keybinding.
>
> The local binding will shadow the global. If the global is shadowed,
> it won't report any key on `C-h w'. But, as soon as you unset the
> local, or set it to the nils, the global is back on. When the local is
> set to the empty string, the shadow is on (i.e., the global is off)
> only this "shadow" doesn't do anything.
>
> Like I said, play around with it.
>
> (defun test-message-local () (interactive) (message "local check"))
> (defun test-message-global () (interactive) (message "global check"))
> (global-unset-key (kbd "C-M-w")) ; either unset both
> (local-unset-key (kbd "C-M-w"))
> (global-set-key (kbd "C-M-w") 'test-message-global) ; test C-h w here
> (local-set-key (kbd "C-M-w") 'test-message-local) ; shadows global
> (local-set-key (kbd "C-M-w") nil) ; these four - global *on*
> (local-set-key (kbd "C-M-w") 'nil)
> (local-set-key (kbd "C-M-w") ())
> (local-set-key (kbd "C-M-w") '())
> (local-set-key (kbd "C-M-w") "") ; this - local "nothing" shadow
>
^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <mailman.25881.1368673172.855.help-gnu-emacs@gnu.org>]
* Re: Disabling M-q
[not found] ` <mailman.25881.1368673172.855.help-gnu-emacs@gnu.org>
@ 2013-05-21 8:13 ` Cecil Westerhof
0 siblings, 0 replies; 13+ messages in thread
From: Cecil Westerhof @ 2013-05-21 8:13 UTC (permalink / raw)
To: help-gnu-emacs
Op donderdag 16 mei 2013 04:59 CEST schreef Yuri Khan:
> On Wed, May 15, 2013 at 10:31 PM, Cecil Westerhof <Cecil@decebal.nl> wrote:
>> A friend asked how to disable M-q. My first thought was:
>> (local-unset-key (kbd "\M-q"))
>> or
>> (local-set-key (kbd "M-q") nil)
>
> You need to unset the key in the map that sets it, or override it
> with another function in a higher-priority map (as you do below with
> the empty string, which is not a proper function).
>
>> But both did not work. I am now using:
>> (local-set-key (kbd "M-q") "")
>>
>> and this works. Is this the best way, or is there a better way?
>
> You could bind the `ignore' function discussed recently on this
> list.
I have tried (I am not using it):
(local-set-key (kbd "M-q") 'ignore)
and it works. I send the improved solution to my friend.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-05-22 14:59 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-15 15:31 Disabling M-q Cecil Westerhof
2013-05-16 2:59 ` Yuri Khan
2013-05-18 4:43 ` B. T. Raven
2013-05-18 10:26 ` Emanuel Berg
2013-05-18 17:44 ` B. T. Raven
2013-05-21 8:21 ` Cecil Westerhof
2013-05-21 16:44 ` Drew Adams
2013-05-21 16:57 ` B. T. Raven
[not found] ` <mailman.131.1369154672.22516.help-gnu-emacs@gnu.org>
2013-05-21 18:35 ` Cecil Westerhof
2013-05-21 20:29 ` Drew Adams
2013-05-21 20:44 ` B. T. Raven
2013-05-22 14:59 ` Drew Adams
[not found] ` <mailman.25881.1368673172.855.help-gnu-emacs@gnu.org>
2013-05-21 8:13 ` Cecil Westerhof
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.