emacs-devel
[Top][All Lists]
Advanced

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

Format av menu keymaps


From: Lennart Borgman
Subject: Format av menu keymaps
Date: Sun, 08 Jan 2006 23:27:46 +0100
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

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)))





reply via email to

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