all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Specifying Control-= as a string?
       [not found] <2cd46e7f0607191006j4b8a2fat3bda91b1e941ae1b@mail.gmail.com>
@ 2006-07-19 17:15 ` Ken Manheimer
  2006-07-19 19:47   ` Slawomir Nowaczyk
  2006-07-21 15:30   ` Kevin Rodgers
  0 siblings, 2 replies; 3+ messages in thread
From: Ken Manheimer @ 2006-07-19 17:15 UTC (permalink / raw)


is there any way to specify the one-character key sequence:

  [(control =)]

as a lisp string?

the strings "\C-=" and "\^=" complain about "Invalid modifier in string".

this question is mostly academic, at this point.  i was thinking about
using it key as a binding in a keymap, but eventually realized that
regular (non-window-system) ttys won't pass it as input.  though i've
given up on that, i'd like to better understand the story here, and am
curious about whether there's any way to express it as a string, or
whether it's just a bad idea in principle (BIiP).

thanks for any clues!

ken
http://myriadicity.net

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

* Re: Specifying Control-= as a string?
  2006-07-19 17:15 ` Specifying Control-= as a string? Ken Manheimer
@ 2006-07-19 19:47   ` Slawomir Nowaczyk
  2006-07-21 15:30   ` Kevin Rodgers
  1 sibling, 0 replies; 3+ messages in thread
From: Slawomir Nowaczyk @ 2006-07-19 19:47 UTC (permalink / raw)


On Wed, 19 Jul 2006 13:15:42 -0400
Ken Manheimer <ken.manheimer@gmail.com> wrote:

#> is there any way to specify the one-character key sequence:
#> 
#>   [(control =)]
#> 
#> as a lisp string?
#> 
#> the strings "\C-=" and "\^=" complain about "Invalid modifier in string".

(kbd "C-=") should work

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( slawomir.nowaczyk.847@student.lu.se )

There are three types of people in this world:
those who can count, and those who cannot.

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

* Re: Specifying Control-= as a string?
  2006-07-19 17:15 ` Specifying Control-= as a string? Ken Manheimer
  2006-07-19 19:47   ` Slawomir Nowaczyk
@ 2006-07-21 15:30   ` Kevin Rodgers
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2006-07-21 15:30 UTC (permalink / raw)


Ken Manheimer wrote:
> is there any way to specify the one-character key sequence:
> 
>  [(control =)]
> 
> as a lisp string?
> 
> the strings "\C-=" and "\^=" complain about "Invalid modifier in string".
> 
> this question is mostly academic, at this point.  i was thinking about
> using it key as a binding in a keymap, but eventually realized that
> regular (non-window-system) ttys won't pass it as input.  though i've
> given up on that, i'd like to better understand the story here, and am
> curious about whether there's any way to express it as a string, or
> whether it's just a bad idea in principle (BIiP).

It is explained in the Init Rebinding node of the Emacs manual:

| If you have a set of key bindings that you like to use all the time,
| you can specify them in your `.emacs' file by using their Lisp syntax.
| (*Note Init File::.)
|
|    The simplest method for doing this works for ASCII characters and
| Meta-modified ASCII characters only.  This method uses a string to
| represent the key sequence you want to rebind.  For example, here's how
| to bind `C-z' to `shell':
|
|      (global-set-key "\C-z" 'shell)
...
|    When the key sequence includes function keys or mouse button events,
| or non-ASCII characters such as `C-=' or `H-a', you must use the more
| general method of rebinding, which uses a vector to specify the key
| sequence.
|
|    The way to write a vector in Emacs Lisp is with square brackets
| around the vector elements.  Use spaces to separate the elements.  If an
| element is a symbol, simply write the symbol's name--no other
| delimiters or punctuation are needed.  If a vector element is a
| character, write it as a Lisp character constant: `?' followed by the
| character as it would appear in a string.
|
|    Here are examples of using vectors to rebind `C-=' (a control
| character not in ASCII), `C-M-=' (not in ASCII because `C-=' is not),
| `H-a' (a Hyper character; ASCII doesn't have Hyper at all), <F7> (a
| function key), and `C-Mouse-1' (a keyboard-modified mouse button):
|
|      (global-set-key [?\C-=] 'make-symbolic-link)
|      (global-set-key [?\M-\C-=] 'make-symbolic-link)
|      (global-set-key [?\H-a] 'make-symbolic-link)
|      (global-set-key [f7] 'make-symbolic-link)
|      (global-set-key [C-mouse-1] 'make-symbolic-link)

The issue of whether a terminal can send a different key code for 
control-= than for = depends on the particular terminal.  But if
it can be configured to send an escape sequence (like for function
keys), you can get Emacs to recognize that by frobbing function-key-map
(see the Translating Input Events node of the Emacs Lisp manual).

-- 
Kevin

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

end of thread, other threads:[~2006-07-21 15:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <2cd46e7f0607191006j4b8a2fat3bda91b1e941ae1b@mail.gmail.com>
2006-07-19 17:15 ` Specifying Control-= as a string? Ken Manheimer
2006-07-19 19:47   ` Slawomir Nowaczyk
2006-07-21 15:30   ` Kevin Rodgers

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.