help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to bind C-x = = to describe-char ?


From: Abhiseck Paira
Subject: Re: How to bind C-x = = to describe-char ?
Date: Fri, 28 May 2021 19:17:36 +0530


> How to bind C-x = = to describe-char ?

If you want to bind "C-x = =" to 'describe-char' you first have to
unbind "C-x =" keybinding as it's already bound to
'what-cursor-position'.

To unbind the "C-x =" place the following in your init.el file:
(global-unset-key (kbd "C-x ="))

Now it'll be possible to bind 'describe-char' to "C-x = ="
(global-set-key (kbd "C-x = =") #'describe-char)

Now you if you still need to have easy access to 'what-cursor-position'
command, bind it to something else. For example let's bind it to
"C-x = w"
(global-set-key (kbd "C-x = w") #'what-cursor-position)


> For eg I do not want to disturb the current "C-x =" binding to
> "what-cursor-position" ?

It is not possible to have "C-x =" bound to a function and "C-x = ="
bound to some other function simultaneously. A key combination is either
a complete key sequence or a prefix key. It can't be both.

> What is the difference between OR why are these two NON-Equivalent ?
>
> (global-set-key "\C-xx=" 'describe-char)            ;;; works
> (global-unset-key "\C-xx=")                         ;;; unbind

> (global-set-key (kbd "<C-x-x-=>") 'describe-char)   ;;; why does not
> not work ?

kbd takes key sequence strings like described in the manual, like "C-h
k", "C-x x =" etc. This key sequence "<C-x-x-=>" basically means type
left angle bracket, right angle bracket, Control, x, = all at the same
time. 

-- 
Abhisek Paira
E34E 825B 979E EB9F 8505  F80E E93D 353B 7740 0709
"There is no system but GNU, and Linux is one of its kernels."

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]