all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* redefine C-h
@ 2008-08-08 17:13 YSK
  2008-08-09  1:45 ` Joel J. Adamson 
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: YSK @ 2008-08-08 17:13 UTC (permalink / raw)
  To: help-gnu-emacs

C-h is a normally prefix key, but I want to bind 'backward-char-
delete' to it. My .emacs has this:

(global-unset-key "\C-h")
(global-set-key "\C-\M-h" 'help-command)
(global-set-key [C-h] 'delete-backward-char)

I want to use C-M-h for help-command instead and use C-h for
backspace. However...it's not working. C-h remains a prefix key. My
understanding of prefix keys is basically nil, so there's probably
something pretty basic I'm missing here. Would anyone here be kind
enough to clue me in?

Thanks.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redefine C-h
  2008-08-08 17:13 redefine C-h YSK
@ 2008-08-09  1:45 ` Joel J. Adamson 
  2008-08-09 14:14 ` Kevin Rodgers
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Joel J. Adamson  @ 2008-08-09  1:45 UTC (permalink / raw)
  To: YSK; +Cc: help-gnu-emacs

>>>>> "Y" == YSK  <koyfman@gmail.com> writes:

    Y> I want to use C-M-h for help-command instead and use C-h for
    Y> backspace. However...it's not working. C-h remains a prefix key. My
    Y> understanding of prefix keys is basically nil, so there's probably
    Y> something pretty basic I'm missing here. Would anyone here be kind
    Y> enough to clue me in?


Perhaps your terminal isn't recognizing your Meta key.  What operating
system, version of Emacs, keyboard are you using?

Joel
-- 
Joel J. Adamson
(303) 880-3109
Public key: http://pgp.mit.edu
http://www.unc.edu/~adamsonj
http://trashbird1240.blogspot.com




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redefine C-h
  2008-08-08 17:13 redefine C-h YSK
  2008-08-09  1:45 ` Joel J. Adamson 
@ 2008-08-09 14:14 ` Kevin Rodgers
       [not found] ` <mailman.16197.1218291299.18990.help-gnu-emacs@gnu.org>
  2008-08-10 17:36 ` YSK
  3 siblings, 0 replies; 10+ messages in thread
From: Kevin Rodgers @ 2008-08-09 14:14 UTC (permalink / raw)
  To: help-gnu-emacs

YSK wrote:
> C-h is a normally prefix key, but I want to bind 'backward-char-
> delete' to it. My .emacs has this:
> 
> (global-unset-key "\C-h")
> (global-set-key "\C-\M-h" 'help-command)
> (global-set-key [C-h] 'delete-backward-char)
> 
> I want to use C-M-h for help-command instead and use C-h for
> backspace. However...it's not working. C-h remains a prefix key. My
> understanding of prefix keys is basically nil, so there's probably
> something pretty basic I'm missing here. Would anyone here be kind
> enough to clue me in?

[C-h] is not the same thing as "\C-h".

Also, you need to (setq help-char ?\C-\M-h)

-- 
Kevin Rodgers
Denver, Colorado, USA





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redefine C-h
       [not found] ` <mailman.16197.1218291299.18990.help-gnu-emacs@gnu.org>
@ 2008-08-09 16:00   ` YSK
  2008-08-10 18:40     ` Xah
  0 siblings, 1 reply; 10+ messages in thread
From: YSK @ 2008-08-09 16:00 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 9, 10:14 am, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> YSK wrote:
> > C-h is a normally prefix key, but I want to bind 'backward-char-
> > delete' to it. My .emacs has this:
>
> > (global-unset-key "\C-h")
> > (global-set-key "\C-\M-h" 'help-command)
> > (global-set-key [C-h] 'delete-backward-char)
>
> > I want to use C-M-h for help-command instead and use C-h for
> > backspace. However...it's not working. C-h remains a prefix key. My
> > understanding of prefix keys is basically nil, so there's probably
> > something pretty basic I'm missing here. Would anyone here be kind
> > enough to clue me in?
>
> [C-h] is not the same thing as "\C-h".
>
> Also, you need to (setq help-char ?\C-\M-h)
>
> --
> Kevin Rodgers
> Denver, Colorado, USA

Kevin,

I did not know that - what is the difference between [C-h] and "\C-h"?
I thought they were interchangeable.

Thanks


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redefine C-h
  2008-08-08 17:13 redefine C-h YSK
                   ` (2 preceding siblings ...)
       [not found] ` <mailman.16197.1218291299.18990.help-gnu-emacs@gnu.org>
@ 2008-08-10 17:36 ` YSK
  2008-08-11  0:41   ` Drew Adams
       [not found]   ` <mailman.16321.1218415295.18990.help-gnu-emacs@gnu.org>
  3 siblings, 2 replies; 10+ messages in thread
From: YSK @ 2008-08-10 17:36 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 8, 1:13 pm, YSK <koyf...@gmail.com> wrote:
> C-h is a normally prefix key, but I want to bind 'backward-char-
> delete' to it. My .emacs has this:
>
> (global-unset-key "\C-h")
> (global-set-key "\C-\M-h" 'help-command)
> (global-set-key [C-h] 'delete-backward-char)
>
> I want to use C-M-h for help-command instead and use C-h for
> backspace. However...it's not working. C-h remains a prefix key. My
> understanding of prefix keys is basically nil, so there's probably
> something pretty basic I'm missing here. Would anyone here be kind
> enough to clue me in?
>
> Thanks.

Problem solved: looks like the "icicles" package was overriding my key
settings.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redefine C-h
  2008-08-09 16:00   ` YSK
@ 2008-08-10 18:40     ` Xah
  2008-08-11  1:10       ` YSK
  0 siblings, 1 reply; 10+ messages in thread
From: Xah @ 2008-08-10 18:40 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 9, 9:00 am, YSK <koyf...@gmail.com> wrote:
> On Aug 9, 10:14 am, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:

> > [C-h] is not the same thing as "\C-h".
>
> > Also, you need to (setq help-char ?\C-\M-h)
>
> I did not know that - what is the difference between [C-h] and "\C-h"?
> I thought they were interchangeable.

One is vector datatype, one is string datatype.
the vector needs to be like this: “[?\C-h]”.

Also, it's best to use the function “kbd” for all your kebyoard
defining needs.

For a explanation on the various variant of syntax for key presses,
see:

http://xahlee.org/emacs/keystroke_rep.html

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: redefine C-h
  2008-08-10 17:36 ` YSK
@ 2008-08-11  0:41   ` Drew Adams
       [not found]   ` <mailman.16321.1218415295.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 10+ messages in thread
From: Drew Adams @ 2008-08-11  0:41 UTC (permalink / raw)
  To: 'YSK', help-gnu-emacs

> > C-h is a normally prefix key, but I want to bind 'backward-char-
> > delete' to it. My .emacs has this:
> >
> > (global-unset-key "\C-h")
> > (global-set-key "\C-\M-h" 'help-command)
> > (global-set-key [C-h] 'delete-backward-char)
> >
> > I want to use C-M-h for help-command instead and use C-h for
> > backspace. However...it's not working. C-h remains a prefix key. My
> > understanding of prefix keys is basically nil, so there's probably
> > something pretty basic I'm missing here. Would anyone here be kind
> > enough to clue me in?
> 
> Problem solved: looks like the "icicles" package was overriding my key
> settings.

Icicles does not bind `C-h'. `C-h' with Icicle mode is the same as it is without
it. (*)

If `C-h' remains a prefix key after your customizations, I am sure that has
nothing to do with Icicles. And, as others have pointed out, [C-h] is not what
you want anyway - use [(control ?h)] or "\C-h" or (kbd "C-h") or [?\C-h] or...
And you should also customize `help-char', as Kevin pointed out.

Similarly, for `C-M-h': Icicles should not affect it. Your binding of `C-M-h' to
`help-command' should work OK everywhere. Is that not what you see?

Icicle mode does, however make some changes in the minibuffer keymaps. One that
is pertinent here is that it remaps command `delete-backward-char' to
`icicle-delete-backward-char' in the minibuffer completion keymaps. This is so
that whenever you delete a character in the minibuffer the set of candidate
completions is updated to reflect your edited input.

This is as it should be. This does not, however, affect the binding of
`delete-backward-char' outside of the minibuffer. And it does not even affect
its binding in the minibuffer, except during completion.

If you successfully change the binding of `delete-backward-char' to `C-h', then,
because Icicle mode remaps this to `icicle-delete-backward-char' in the
minibuffer during completion, `C-h' during completion will delete a minibuffer
character and update the set of completion candidates. 

IIUC, that should be just what you're after: `C-h' will always delete the
character before point. In the minibuffer, it will also update the completion
candidates - but that's the only difference. 

You can easily see all of this for yourself if you load library `help-fns+.el'
(**) and then use `C-h M-k' (`describe-keymap'). You can use `C-h C-k' to show
`icicle-mode-map' and each of the minibuffer maps: `minibuffer-local-map',
`minibuffer-local-completion-map', and so on. Quit Icicle mode and check the
minibuffer maps again, to see the difference. Check `global-map' too, to see
whether your customizations have really taken effect as you expect.
`describe-keymap' is your friend.

You should be able to get what you want and still use Icicles, without any
difficulty. If you have questions, feel free to ask. If you see a problem,
please file a bug report: `M-x icicle-send-bug-report'.

----
(*) In Icicle mode, these two `C-h' bindings are changed, but only if you so
choose - see option `icicle-top-level-key-bindings':

`C-h C-o' - `icicle-describe-option-of-type'
`C-h w'   - `icicle-where-is' (multi-command version of `where-is')

(**) `help-fns+.el' is available here:
http://www.emacswiki.org/cgi-bin/wiki/help-fns%2b.el







^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redefine C-h
       [not found]   ` <mailman.16321.1218415295.18990.help-gnu-emacs@gnu.org>
@ 2008-08-11  1:00     ` YSK
  2008-08-11  4:07       ` Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: YSK @ 2008-08-11  1:00 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 10, 8:41 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:

>
> Icicles does not bind `C-h'. `C-h' with Icicle mode is the same as it is without
> it. (*)

Drew,

I must have turned on an icicles setting to override these keys, since
commenting out these lines in icicles-mode.el gave me the C-h behavior
I was looking for:

;    (icicle-remap 'where-is                               'icicle-
where-is
;                  icicle-mode-map (current-global-map)) ; `C-h w'

and

;    (define-key icicle-mode-map "\C-h\C-o"  'icicle-describe-option-
of-type) ; `C-h C-o'

I'm not exactly sure why, actually. Possibly I made another change at
around the same time that I can't recall right now that actually
"fixed" my C-h issue.

> If `C-h' remains a prefix key after your customizations, I am sure that has
> nothing to do with Icicles. And, as others have pointed out, [C-h] is not what
> you want anyway - use [(control ?h)] or "\C-h" or (kbd "C-h") or [?\C-h] or...
> And you should also customize `help-char', as Kevin pointed out.
>
> Similarly, for `C-M-h': Icicles should not affect it. Your binding of `C-M-h' to
> `help-command' should work OK everywhere. Is that not what you see?

Yes, C-M-h worked correctly right away. It's the 'C-h' rebinding that
was not taking.

>
> Icicle mode does, however make some changes in the minibuffer keymaps. One that
> is pertinent here is that it remaps command `delete-backward-char' to
> `icicle-delete-backward-char' in the minibuffer completion keymaps. This is so
> that whenever you delete a character in the minibuffer the set of candidate
> completions is updated to reflect your edited input.
>
> This is as it should be. This does not, however, affect the binding of
> `delete-backward-char' outside of the minibuffer. And it does not even affect
> its binding in the minibuffer, except during completion.

Yes..I would prefer to keep the iciciles minibuffer features intact
since I do use icicles entirely for its minibuffer enhancements.

>
> If you successfully change the binding of `delete-backward-char' to `C-h', then,
> because Icicle mode remaps this to `icicle-delete-backward-char' in the
> minibuffer during completion, `C-h' during completion will delete a minibuffer
> character and update the set of completion candidates.
>
> IIUC, that should be just what you're after: `C-h' will always delete the
> character before point. In the minibuffer, it will also update the completion
> candidates - but that's the only difference.

In my current setup, C-h does do the right thing in the minibuffer -
delete the char before point, and update the completion list.

> You can easily see all of this for yourself if you load library `help-fns+.el'
> (**) and then use `C-h M-k' (`describe-keymap'). You can use `C-h C-k' to show
> `icicle-mode-map' and each of the minibuffer maps: `minibuffer-local-map',
> `minibuffer-local-completion-map', and so on. Quit Icicle mode and check the
> minibuffer maps again, to see the difference. Check `global-map' too, to see
> whether your customizations have really taken effect as you expect.
> `describe-keymap' is your friend.

Thanks for the tip..I will give help-fns+.el a spin; it looks handy.

>
> You should be able to get what you want and still use Icicles, without any
> difficulty. If you have questions, feel free to ask. If you see a problem,
> please file a bug report: `M-x icicle-send-bug-report'.
>
> ----
> (*) In Icicle mode, these two `C-h' bindings are changed, but only if you so
> choose - see option `icicle-top-level-key-bindings':
>
> `C-h C-o' - `icicle-describe-option-of-type'
> `C-h w'   - `icicle-where-is' (multi-command version of `where-is')
>
> (**) `help-fns+.el' is available here:http://www.emacswiki.org/cgi-bin/wiki/help-fns%2b.el



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: redefine C-h
  2008-08-10 18:40     ` Xah
@ 2008-08-11  1:10       ` YSK
  0 siblings, 0 replies; 10+ messages in thread
From: YSK @ 2008-08-11  1:10 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 10, 2:40 pm, Xah <xah...@gmail.com> wrote:
> On Aug 9, 9:00 am, YSK <koyf...@gmail.com> wrote:
>
> > On Aug 9, 10:14 am, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> > > [C-h] is not the same thing as "\C-h".
>
> > > Also, you need to (setq help-char ?\C-\M-h)
>
> > I did not know that - what is the difference between [C-h] and "\C-h"?
> > I thought they were interchangeable.
>
> One is vector datatype, one is string datatype.
> the vector needs to be like this: “[?\C-h]”.
>
> Also, it's best to use the function “kbd” for all your kebyoard
> defining needs.
>
> For a explanation on the various variant of syntax for key presses,
> see:
>
> http://xahlee.org/emacs/keystroke_rep.html
>
>   Xah
> ∑http://xahlee.org/
>
> ☄

Xah - Thanks..I will keep this in mind next time I wade through
my .emacs.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: redefine C-h
  2008-08-11  1:00     ` YSK
@ 2008-08-11  4:07       ` Drew Adams
  0 siblings, 0 replies; 10+ messages in thread
From: Drew Adams @ 2008-08-11  4:07 UTC (permalink / raw)
  To: 'YSK', help-gnu-emacs

> > Icicles does not bind `C-h'. `C-h' with Icicle mode is the 
> > same as it is without it.
>
> I must have turned on an icicles setting to override these keys,
> since commenting out these lines in icicles-mode.el gave me the
> C-h behavior I was looking for:
> 
> ;    (icicle-remap 'where-is 'icicle-where-is
> ;                  icicle-mode-map (current-global-map)) ; `C-h w'
> ;    (define-key icicle-mode-map "\C-h\C-o" 'icicle-describe-option-
>       of-type) ; `C-h C-o'

1. That should have nothing to do with your binding of `C-h'.

2. The right way to remove those Icicle mode bindings, if you want to, is to
customize option `icicle-top-level-key-bindings', as I mentioned. That is the
way to customize all top-level (i.e., non-minibuffer) Icicles bindings. You
don't need to know any Lisp to do this; it's very simple.

> I'm not exactly sure why, actually. Possibly I made another change at
> around the same time that I can't recall right now that actually
> "fixed" my C-h issue.

I expect so. I don't think Icicles is related to your problem in any way.

> > Similarly, for `C-M-h': Icicles should not affect it....
> 
> Yes, C-M-h worked correctly right away. It's the 'C-h' rebinding that
> was not taking.

Others have explained why. See below for a summary recipe.

> > Icicle mode does, however make some changes in the 
> > minibuffer keymaps. One that is pertinent here is that
> > it remaps command `delete-backward-char' to
> > `icicle-delete-backward-char' in the minibuffer completion 
> > keymaps. This is so that whenever you delete a character
> > in the minibuffer the set of candidate completions is
> > updated to reflect your edited input...
> 
> Yes..I would prefer to keep the iciciles minibuffer features intact
> since I do use icicles entirely for its minibuffer enhancements.
>
> In my current setup, C-h does do the right thing in the minibuffer -
> delete the char before point, and update the completion list.

And it does the right thing outside the minibuffer too, right? Doesn't it delete
a char there too? If so, then the only thing that is not yet working is `C-M-h'
for `help-command', is that correct? Or is that working now also?

The following should do what you need. It should work whether or not you use
Icicles (it does for me).

(global-set-key "\C-h" 'delete-backward-char)
(setq help-char ?\C-\M-h)
(define-key global-map (char-to-string help-char) 'help-command)

`C-M-h w' should then give you `where-is', and so on.

Note, BTW, that `C-M-h C-h' gives you `help-for-help' - don't expect this to be
`C-M-h C-M-h'.



[Instead of using `setq' to set `help-char', you can use Customize:
`M-x customize-option help-char'.
In the Customize buffer, type: C-q C-M-h
(that is, Control-q key followed by Control-Meta-h chord)

`C-q' quotes the key you hit after it. You will see \210 as the displayed new
value of `help-char' in Customize, but that's OK. (Sometimes Customize is less
user-friendly than Lisp. ;-))

But you might as well just use (setq help-char ?\C-\M-h), to keep all of this
stuff together.]





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-08-11  4:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-08 17:13 redefine C-h YSK
2008-08-09  1:45 ` Joel J. Adamson 
2008-08-09 14:14 ` Kevin Rodgers
     [not found] ` <mailman.16197.1218291299.18990.help-gnu-emacs@gnu.org>
2008-08-09 16:00   ` YSK
2008-08-10 18:40     ` Xah
2008-08-11  1:10       ` YSK
2008-08-10 17:36 ` YSK
2008-08-11  0:41   ` Drew Adams
     [not found]   ` <mailman.16321.1218415295.18990.help-gnu-emacs@gnu.org>
2008-08-11  1:00     ` YSK
2008-08-11  4:07       ` Drew Adams

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.