(popup-menu): Add loop to handle submenus.
authorRichard M. Stallman <rms@gnu.org>
Tue, 4 Jan 1994 23:30:37 +0000 (23:30 +0000)
committerRichard M. Stallman <rms@gnu.org>
Tue, 4 Jan 1994 23:30:37 +0000 (23:30 +0000)
lisp/emacs-lisp/lmenu.el

index dc108c1..3883d0e 100644 (file)
@@ -132,11 +132,16 @@ The syntax, more precisely:
   (let ((menu (make-lucid-menu-keymap (car menu-desc) (cdr menu-desc)))
        (pos (mouse-position))
        answer)
-    (setq answer (x-popup-menu (list (list (nth 1 pos) (nthcdr 2 pos))
-                                    (car pos))
-                              menu))
-    (setq cmd (lookup-key menu (vector answer)))
-    (if cmd (call-interactively cmd))))
+    (while menu
+      (setq answer (x-popup-menu (list (list (nth 1 pos) (nthcdr 2 pos))
+                                      (car pos))
+                                menu))
+      (setq cmd (lookup-key menu (vector answer)))
+      (setq menu nil)
+      (and cmd
+          (if (keymapp cmd)
+              (setq menu cmd)
+            (call-interactively cmd))))))
 \f
 ;; This is empty because the usual elements of the menu bar 
 ;; are provided by menu-bar.el instead.