help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: Making new menu after Tools using keymap-set-after


From: uzibalqa
Subject: RE: [External] : Re: Making new menu after Tools using keymap-set-after
Date: Tue, 18 Jul 2023 21:40:21 +0000

------- Original Message -------
On Wednesday, July 19th, 2023 at 8:55 AM, uzibalqa <uzibalqa@proton.me> wrote:


> ------- Original Message -------
> On Wednesday, July 19th, 2023 at 8:42 AM, Drew Adams drew.adams@oracle.com 
> wrote:
> 
> 
> 
> > Caveat: I'm not really following this thread in detail.
> > 
> > OP: I think (among other things perhaps) you are
> > looking for an example of using `keymap-set-after'. If so, I see two 
> > examples where` keymap-set-after'
> > is presented, in (elisp) `Modifying Menus':
> > ___
> > 
> > Here is an example:
> > 
> > (keymap-set-after 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>.
> 
> 
> The declaration is making things much more complicated because we were just
> using a vector [menu-bar mcp-topm]. Now it is characters with angled brackets
> such as "<menu-bar mcp-topm>" rather than conforming with previous 
> define-key-after way.
> 
> 
> More torture.
> 
> > Here is how to insert an item called ‘Work’ in the ‘Signals’ menu
> > of Shell mode, after the item ‘break’:
> > 
> > (keymap-set-after shell-mode-map "<menu-bar> <signals> <work>"
> > 
> > '("Work" . work-command) 'break)
> > ___
> > 

This is what I call help.  Eli - Learn.

Consider

  (defvar mcp-kdf (make-sparse-keymap "MCP"))
  (keymap-set-after global-map
    "<menu-bar> <mcp-topm>" (cons "MCP" mcp-kdf) 'tools)

(error "tools is not a valid key definition; see 'key-valid-p')


> > This node of the manual comes after nodes that
> > specify defining menus in general.
> > ___

Quite right.  Everything upside down,yet we have Eli and other experienced 
programmers
iterating how everything is properly done.  t is the same as the people in the 
asylum
thinking they are some and the doctor insane.  It is a disease of the Emacs 
Mind.  
 
> > BTW, Eli, isn't `define-key' here a typo - shouldn't it be` keymap-set':
> > 
> > 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 in the
> > menu, use ‘keymap-set-after’:
> > 
> > I expect that the contrast to be made there is
> > between `keymap-set' and` keymap-set-after',
> > not between `define-key' and` keymap-set-after'.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]