all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Format av menu keymaps
@ 2006-01-08 22:27 Lennart Borgman
  2006-01-09  2:27 ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Lennart Borgman @ 2006-01-08 22:27 UTC (permalink / raw)


I am loooking for the format of a menu keymap. There seem to be several 
different formats that are possible for a submenu, but I can not find 
where these are described. Are there any functions to check if an entry 
in a keymap list is a submenu?

I have invented something like the function below to use. It works, but 
I have no idea whether it will work always:

;; Function to get submenu and title
(defun appmenu-get-submenu(menu-command)
  (let (subtitle submenumap)
    (if (eq 'menu-item (car menu-command))
        (progn (setq subtitle   (cadr  menu-command))
               (setq submenumap (caddr menu-command)))
      (setq subtitle   (car menu-command))
      (setq submenumap (cdr menu-command)))
    (unless (keymapp submenumap) (error "submenu not a keymap=%s" submenu))
    (cons subtitle submenumap)))

;; A typical usage in my case:
          (map-keymap
           (lambda(binding command)
             (let* ((tit-map (appmenu-get-submenu command))
                    (subtitle (car tit-map))
                    (submenumap (cdr tit-map)))
               (define-key map [appmenu-major]
                 (list 'menu-item
                       subtitle submenumap
                       ))))
           (cdr (assoc 'menu-bar major-map)))

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

end of thread, other threads:[~2006-01-10 17:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.