Article View: gnu.emacs.bug
Article #87813define-key-after documentation/implementation mismatch
From: Marc Auslander
Date: Thu, 25 Aug 1994 20:51
Date: Thu, 25 Aug 1994 20:51
46 lines
2419 bytes
2419 bytes
In GNU Emacs 19.25.94.4 (rs6000-ibm-aix3.2.5) of Wed Aug 24 1994 on marc.watson.ibm.com
The issue is whether the AFTER argument of define-key-after should be
[previous] or 'previous. My experiments indicate the latter, but the
documentation example indicates the former.
Modifying Menus
---------------
When you insert a new item in an existing menu, you probably want to
put it in a particular place among the menu's existing items. If you
use `define-key' to add the item, it normally goes at the front of the
menu. To put it elsewhere, use `define-key-after':
- Function: define-key-after MAP KEY BINDING AFTER
Define a binding in MAP for KEY, with value BINDING, just like
`define-key', but position the binding in MAP after the binding
for the key AFTER. For example,
(define-key my-menu [drink]
'("Drink" . drink-command) [eat])
makes a binding for the fake function key drink and puts it right
after the binding for eat.
;; run following in scratch/first part sets up menu
;; then try either define-key-after and observe result.
(progn (define-key (current-local-map) [menu-bar test]
(cons "test" (make-sparse-keymap "test")))
(setq menu (lookup-key (current-local-map) [menu-bar test]))
(define-key menu [line1] '("line2" . nil))
(define-key menu [line2] '("line1" . nil)))
;;eval-last-sexp here first, then
;;following doesn't work correctly
(define-key-after menu [between] '("between" .nil) [line2])
;;following does
(define-key-after menu [between] '("between" .nil) 'line2)
Marc Auslander <marc@watson.ibm.com> 914 784-6699 (Tieline 863 Fax x6306)
Technical Details
Message-ID:
<9408252050.AA21417@marc.watson.ibm.com>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!uunet!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!watson.ibm.com!marcShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,c39ee25ddef526ff,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1994-08-25 18:39:42 PST Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!uunet!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!watson.ibm.com!marc From: marc@watson.ibm.com (Marc Auslander) Newsgroups: gnu.emacs.bug Subject: define-key-after documentation/implementation mismatch Date: 25 Aug 1994 16:51:31 -0400 Organization: GNUs Not Usenet Lines: 46 Sender: daemon@cis.ohio-state.edu Approved: bug-gnu-emacs@prep.ai.mit.edu Distribution: gnu Message-ID: <9408252050.AA21417@marc.watson.ibm.com> Reply-To: marc@watson.ibm.com