all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* define-key OK; defiune-key-after won't evaluate
@ 2006-02-20  0:16 RD.
  2006-02-21 16:18 ` Kevin Rodgers
       [not found] ` <mailman.1088.1140548301.2856.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: RD. @ 2006-02-20  0:16 UTC (permalink / raw)


I can define a menu button in the menu bar, placed to the left of the
File button, thus:

(define-key global-map [menu-bar rsave] '("Save" . save-buffer))

But I don't know how to use define-key-after.  I get a Lisp error:

(define-key-after global-map [menu-bar rsave]
   '("Save" . save-buffer) 'tools)
Debugger entered--Lisp error: (error "multi-event key specified in
`define-key-after'")

Is it obvious what's wrong?

[Aside: I posted a related question yesterday, but I couldn't see how
to post this follow-on question as a response to that question, i.e. in
the same thread.]

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

* Re: define-key OK; defiune-key-after won't evaluate
  2006-02-20  0:16 define-key OK; defiune-key-after won't evaluate RD.
@ 2006-02-21 16:18 ` Kevin Rodgers
       [not found] ` <mailman.1088.1140548301.2856.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2006-02-21 16:18 UTC (permalink / raw)


RD. wrote:
> I can define a menu button in the menu bar, placed to the left of the
> File button, thus:
> 
> (define-key global-map [menu-bar rsave] '("Save" . save-buffer))
> 
> But I don't know how to use define-key-after.  I get a Lisp error:
> 
> (define-key-after global-map [menu-bar rsave]
>    '("Save" . save-buffer) 'tools)
> Debugger entered--Lisp error: (error "multi-event key specified in
> `define-key-after'")
> 
> Is it obvious what's wrong?

,----[ C-h f define-key-after RET ]
| define-key-after is a compiled Lisp function in `subr'.
| (define-key-after KEYMAP KEY DEFINITION &optional AFTER)
|
| Add binding in KEYMAP for KEY => DEFINITION, right after AFTER's binding.
| This is like `define-key' except that the binding for KEY is placed
| just after the binding for the event AFTER, instead of at the beginning
| of the map.  Note that AFTER must be an event type (like KEY), NOT a 
command
| (like DEFINITION).
|
| If AFTER is t or omitted, the new binding goes at the end of the keymap.
|
| KEY must contain just one event type--that is to say, it must be a
| string or vector of length 1, but AFTER should be a single event
| type--a symbol or a character, not a sequence.
|
| Bindings are always added before any inherited map.
|
| The order of bindings in a keymap matters when it is used as a menu.
`----

Does this work?

(define-key-after (lookup-key global-map [menu-bar]) [rsave]
   '("Save" . save-buffer) 'tools)

-- 
Kevin Rodgers

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

* Re: define-key OK; defiune-key-after won't evaluate
       [not found] ` <mailman.1088.1140548301.2856.help-gnu-emacs@gnu.org>
@ 2006-02-25  2:43   ` RD
  0 siblings, 0 replies; 3+ messages in thread
From: RD @ 2006-02-25  2:43 UTC (permalink / raw)


Kevin Rodgers wrote:
> RD. wrote:
> 
>> I can define a menu button in the menu bar, placed to the left of the
>> File button, thus:
>>
>> (define-key global-map [menu-bar rsave] '("Save" . save-buffer))
>>
>> But I don't know how to use define-key-after.  I get a Lisp error:
>>
>> (define-key-after global-map [menu-bar rsave]
>>    '("Save" . save-buffer) 'tools)
>> Debugger entered--Lisp error: (error "multi-event key specified in
>> `define-key-after'")
>>
>> Is it obvious what's wrong?
> 
> 
> ,----[ C-h f define-key-after RET ]
> | define-key-after is a compiled Lisp function in `subr'.
> | (define-key-after KEYMAP KEY DEFINITION &optional AFTER)
> |
> | Add binding in KEYMAP for KEY => DEFINITION, right after AFTER's binding.
> | This is like `define-key' except that the binding for KEY is placed
> | just after the binding for the event AFTER, instead of at the beginning
> | of the map.  Note that AFTER must be an event type (like KEY), NOT a 
> command
> | (like DEFINITION).
> |
> | If AFTER is t or omitted, the new binding goes at the end of the keymap.
> |
> | KEY must contain just one event type--that is to say, it must be a
> | string or vector of length 1, but AFTER should be a single event
> | type--a symbol or a character, not a sequence.
> |
> | Bindings are always added before any inherited map.
> |
> | The order of bindings in a keymap matters when it is used as a menu.
> `----
> 
> Does this work?
> 
> (define-key-after (lookup-key global-map [menu-bar]) [rsave]
>   '("Save" . save-buffer) 'tools)
> 

Yes.  That does work.
Thanks very much.

(I'm figuring out how to get my ISP and Thunderbird to handle these 
USENET groups.  I hope this reply shows up in the right place.)

Bob

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

end of thread, other threads:[~2006-02-25  2:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-20  0:16 define-key OK; defiune-key-after won't evaluate RD.
2006-02-21 16:18 ` Kevin Rodgers
     [not found] ` <mailman.1088.1140548301.2856.help-gnu-emacs@gnu.org>
2006-02-25  2:43   ` RD

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.