unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Looking for a sneaky key binding
@ 2007-03-05  1:09 Dan Bensen
  2007-03-05  2:02 ` weber
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Dan Bensen @ 2007-03-05  1:09 UTC (permalink / raw)
  To: help-gnu-emacs

After making a new command, I wanted to bind it to M-C-|.
This form didn't work:
   (global-set-key <name> 'my-command)

where <name> was equal to
   "\M-\C-|"
   "\M-\C-\|"
   "|\M-\C-\||"

on separate attempts.  The error message was always
   "Invalid modifier in string".

So is there another trick somewhere that does this,
or is it not supported?

-- 
Dan
www.prairienet.org/~dsb

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

* Re: Looking for a sneaky key binding
  2007-03-05  1:09 Looking for a sneaky key binding Dan Bensen
@ 2007-03-05  2:02 ` weber
  2007-03-05  2:37 ` David Hansen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: weber @ 2007-03-05  2:02 UTC (permalink / raw)
  To: help-gnu-emacs

On 4 mar, 22:09, Dan Bensen <randomg...@cyberspace.net> wrote:
> After making a new command, I wanted to bind it to M-C-|.
> This form didn't work:
>    (global-set-key <name> 'my-command)
>
> where <name> was equal to
>    "\M-\C-|"
>    "\M-\C-\|"
>    "|\M-\C-\||"
>
> on separate attempts.  The error message was always
>    "Invalid modifier in string".
>
> So is there another trick somewhere that does this,
> or is it not supported?
>
> --
> Danwww.prairienet.org/~dsb

Yes, i had some problems too.. But with this syntax worked:

(global-set-key (kbd "M-C-\|") '(lambda() (interactive) (message
"Teste")))

It's hard combo to type though: you have to hold Ctrl, Alt and
Shift! :)
Cheers,
weber

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

* Re: Looking for a sneaky key binding
  2007-03-05  1:09 Looking for a sneaky key binding Dan Bensen
  2007-03-05  2:02 ` weber
@ 2007-03-05  2:37 ` David Hansen
       [not found] ` <mailman.438.1173062316.7795.help-gnu-emacs@gnu.org>
  2007-03-06  4:44 ` Kevin Rodgers
  3 siblings, 0 replies; 7+ messages in thread
From: David Hansen @ 2007-03-05  2:37 UTC (permalink / raw)
  To: help-gnu-emacs

On Sun, 04 Mar 2007 19:09:47 -0600 Dan Bensen wrote:

> After making a new command, I wanted to bind it to M-C-|.

Hit C-h k C-M-| and emacs will show you the key how it understands
it:

  C-M-| is undefined

then just use (kbd "C-M-|").

Wow, a keystroke that involves Meta Control and Shift, one key is
missing :)

David

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

* Re: Looking for a sneaky key binding
       [not found] ` <mailman.438.1173062316.7795.help-gnu-emacs@gnu.org>
@ 2007-03-05  3:23   ` Dan Bensen
  2007-03-05  3:49     ` Dan Bensen
  2007-03-06 13:07     ` Johan Bockgård
  0 siblings, 2 replies; 7+ messages in thread
From: Dan Bensen @ 2007-03-05  3:23 UTC (permalink / raw)
  To: help-gnu-emacs

David Hansen wrote:
> Hit C-h k C-M-| 
Very nice.

> then just use (kbd "C-M-|").
Finally!  Is kbd documented somewhere?  I don't see it in the elisp or 
emacs manuals or google.

> Wow, a keystroke that involves Meta Control and Shift, one key is
> missing :)
It's for my indent-buffer command.  It sort of parallels indent-region.

-- 
Dan
www.prairienet.org/~dsb

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

* Re: Looking for a sneaky key binding
  2007-03-05  3:23   ` Dan Bensen
@ 2007-03-05  3:49     ` Dan Bensen
  2007-03-06 13:07     ` Johan Bockgård
  1 sibling, 0 replies; 7+ messages in thread
From: Dan Bensen @ 2007-03-05  3:49 UTC (permalink / raw)
  To: help-gnu-emacs

Dan Bensen wrote:
> Is kbd documented somewhere?  I don't see it in the elisp or 
> emacs manuals or google.

I found the description with C-h f, which led to insert-kbd-macro,
but neither entry describes the syntax of the string for the key
sequence.
Also, I'm interested in how someone is supposed to find it by themself
without having to be told about it, considering it seems pretty useful
for defining bindings.

-- 
Dan
www.prairienet.org/~dsb

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

* Re: Looking for a sneaky key binding
  2007-03-05  1:09 Looking for a sneaky key binding Dan Bensen
                   ` (2 preceding siblings ...)
       [not found] ` <mailman.438.1173062316.7795.help-gnu-emacs@gnu.org>
@ 2007-03-06  4:44 ` Kevin Rodgers
  3 siblings, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2007-03-06  4:44 UTC (permalink / raw)
  To: help-gnu-emacs

Dan Bensen wrote:
> After making a new command, I wanted to bind it to M-C-|.
> This form didn't work:
>   (global-set-key <name> 'my-command)
> 
> where <name> was equal to
>   "\M-\C-|"
>   "\M-\C-\|"
>   "|\M-\C-\||"
> 
> on separate attempts.  The error message was always
>   "Invalid modifier in string".

See these sections of the Emacs Lisp manual:

Nonprinting Characters in Strings
Non-ASCII Characters in Strings
Changing Key Bindings

> So is there another trick somewhere that does this,
> or is it not supported?

Use the vector notation (Emacs manual: Rebinding Keys in Your Init File):

[?\M-\C-|]

-- 
Kevin Rodgers
Denver, Colorado, USA

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

* Re: Looking for a sneaky key binding
  2007-03-05  3:23   ` Dan Bensen
  2007-03-05  3:49     ` Dan Bensen
@ 2007-03-06 13:07     ` Johan Bockgård
  1 sibling, 0 replies; 7+ messages in thread
From: Johan Bockgård @ 2007-03-06 13:07 UTC (permalink / raw)
  To: help-gnu-emacs

Dan Bensen <randomgeek@cyberspace.net> writes:

> Finally!  Is kbd documented somewhere?  I don't see it in the elisp or
> emacs manuals or google.

Documentation for this function has been added in Emacs 22 (Elisp
manual).

-- 
Johan Bockgård

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

end of thread, other threads:[~2007-03-06 13:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-05  1:09 Looking for a sneaky key binding Dan Bensen
2007-03-05  2:02 ` weber
2007-03-05  2:37 ` David Hansen
     [not found] ` <mailman.438.1173062316.7795.help-gnu-emacs@gnu.org>
2007-03-05  3:23   ` Dan Bensen
2007-03-05  3:49     ` Dan Bensen
2007-03-06 13:07     ` Johan Bockgård
2007-03-06  4:44 ` Kevin Rodgers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).