all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Adventures in key mapping
@ 2011-05-10 13:31 sdn.gnuem
  2011-05-10 13:45 ` Antoine Levitt
  0 siblings, 1 reply; 2+ messages in thread
From: sdn.gnuem @ 2011-05-10 13:31 UTC (permalink / raw)
  To: help-gnu-emacs

I wanted to assign something to the C-, (control comma) key sequence.  My first attempt was:



    (local-set-key  "\C-,"  'some-function)



This gives the error "Invalid modifier in string", although I'm not sure why.  Then I tried:



    (local-set-key  [C-,]  'some-function)



This gave no error or warning, but it also apparently had no effect.  It did not assign anything to C-,.  After much experimentation and frustration, I hit upon this:



    (local-set-key  [(control ,)]  'some-function)



which works.



One day, I byte-compiled the elisp file that contains the above line.  I got a most curious warning message:



  !! The file uses old-style backquotes !!

  This functionality has been obsolete for more than 10 years already

  and will be removed soon.  See (elisp)Backquote in the manual.



I wonder if this message is a bug.  I have no clue what "old-style backquotes" are, and the Backquote section of the elisp manual makes no mention of them.  The backquote character (ascii 0x60) does not appear anywhere in the source file.



After more trial-and-error, I crafted the following:



   (local-set-key  [(control ?,)]  'some-function)



which works and does not result in any byte-compilation warnings.  Also, I have found that:



    (local-set-key  [?\C-,]  'some-function)



works as well.





I don't really have a question for the list, since I got it to work.  I'm posting this to help anyone in the future who may have similar problems.  But does anyone think that the backquote warning is a bug that should be reported?  Or perhaps the documentation should be updated?

----------
This message was sent from a MailNull anti-spam account.  You can get
your free account and take control over your email by visiting the
following URL.

   http://mailnull.com/



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

* Re: Adventures in key mapping
  2011-05-10 13:31 Adventures in key mapping sdn.gnuem
@ 2011-05-10 13:45 ` Antoine Levitt
  0 siblings, 0 replies; 2+ messages in thread
From: Antoine Levitt @ 2011-05-10 13:45 UTC (permalink / raw)
  To: help-gnu-emacs

10/05/11 15:31, sdn.gnuem@mailnull.com
> I wanted to assign something to the C-, (control comma) key sequence.
> My first attempt was:
>
>
>
>     (local-set-key  "\C-,"  'some-function)

Why don't people use "kbd" more? It translates user-friendly bindings to
low-level representation.

Here, you'd just use

(local-set-key  (kbd "C-,")  'some-function)

or whatever gets reported by C-h k. No need to wander into the
intricacies of emacs key system.




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

end of thread, other threads:[~2011-05-10 13:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-10 13:31 Adventures in key mapping sdn.gnuem
2011-05-10 13:45 ` Antoine Levitt

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.