all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lennart Borgman <lennart.borgman.073@student.lu.se>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Format av menu keymaps
Date: Tue, 10 Jan 2006 00:57:47 +0100	[thread overview]
Message-ID: <43C2F87B.1030401@student.lu.se> (raw)
In-Reply-To: <jwv3bjx57ox.fsf-monnier+emacs@gnu.org>

Stefan Monnier wrote:

>>      (when (featurep 'xhtml-help)
>>        (let ((menu-bar-entry (cdr (assoc 'menu-bar xhtml-help-mode-keymap))))
>>    
>>
>
>Rather than `assoc' you should probably use lookup-key.
>  
>
Thanks.

>  
>
>>          (when menu-bar-entry
>>            (map-keymap
>>             (lambda(binding command)
>>               (let* ((tit-map (appmenu-get-submenu command))
>>                      (subtitle (car tit-map))
>>                      (submenu  (cdr tit-map)))
>>                 (define-key map
>>                   [nxhtml-xhtml-help]
>>                   (list 'menu-item
>>                         subtitle submenu
>>                         :help "XHTML help access"))))
>>             menu-bar-entry)
>>    
>>
>
>There's something odd in this code snice for each iteration of map-keymap
>you end up rebinding the same key with `define-key' so only ther last one
>will have an effect.
>  
>
Yes, it is odd. I am using map-keymap just to get the 'command'. (There 
is only one entry in menu-bar-entry.) Is there another way?

>I assume `map' is some arbitrary keymap to which you want to add the entries
>found in xhtml-help-mode-keymap?
>  
>
Yes.

>Why do you use `appmenu-get-submenu' to destructure the menu-item only to
>rebuild it right after.
>  
>
The submenu I gave is just an example. I do not know the format of the 
submenu normally. `appmenu-get-submenu' (see previous message) handles 
those two formats for a submenu that I have seen. There may be more, but 
I do not know. Are there more?

>I'd just do
>
>      (when (featurep 'xhtml-help)
>        (let ((menu-bar-entry (lookup-key xhtml-help-mode-keymap [menu-bar])))
>          (when menu-bar-entry
>            (map-keymap
>             (lambda (key command)
>               (define-key map
>                           (vector (intern (concat "nxhtml-" (symbol-name key))))
>                           command))
>             menu-bar-entry)
>            (define-key map [nxhtml-nxhtml-help-separator] (list 'menu-item
>            "--"))
>
>but maybe that's not what you're trying to do.
>  
>
It is not exactly what I want to do, but some of the syntax I can surely 
use, thanks.

  reply	other threads:[~2006-01-09 23:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-08 22:27 Format av menu keymaps Lennart Borgman
2006-01-09  2:27 ` Stefan Monnier
2006-01-09 21:45   ` Lennart Borgman
2006-01-09 23:10     ` Stefan Monnier
2006-01-09 23:57       ` Lennart Borgman [this message]
2006-01-10  4:21         ` Stefan Monnier
     [not found]           ` <43C36D10.1050003@student.lu.se>
     [not found]             ` <jwvmzi43xn9.fsf-monnier+emacs@gnu.org>
2006-01-10 17:00               ` Lennart Borgman
2006-01-10 17:40                 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43C2F87B.1030401@student.lu.se \
    --to=lennart.borgman.073@student.lu.se \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.