From 40716cd9c4d41db83dd06cb88dd087eede602f01 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 16 Sep 2000 23:35:51 +0000 Subject: [PATCH] (popup-menu, popup-menu-internal, popup-menu-popup): Remove. --- lisp/emacs-lisp/lmenu.el | 141 +++------------------------------------ 1 file changed, 11 insertions(+), 130 deletions(-) diff --git a/lisp/emacs-lisp/lmenu.el b/lisp/emacs-lisp/lmenu.el index c67e209821a..eceda361b89 100644 --- a/lisp/emacs-lisp/lmenu.el +++ b/lisp/emacs-lisp/lmenu.el @@ -2,7 +2,7 @@ ;; Copyright (C) 1992, 1993, 1994, 1997 Free Software Foundation, Inc. -;; Keywords: emulations +;; Keywords: emulations obsolete ;; This file is part of GNU Emacs. @@ -47,6 +47,7 @@ (cons (cons 'current-menubar lucid-menubar-map) minor-mode-map-alist))) +;; XEmacs compatibility (defun set-menubar-dirty-flag () (force-mode-line-update) (setq lucid-menu-bar-dirty-flag t)) @@ -124,115 +125,7 @@ (setq menu-items (cdr menu-items))) menu)) -;; The value of the cache-symbol for a menu -;; is -;; unbound -- nothing computed -;; (ORIG . TRANSL) -;; ORIG is the original menu spec list -;; and TRANSL is its translation. - -(defmacro popup-menu (arg) - "Pop up the given menu. -A menu is a list of menu items, strings, and submenus. - -The first element of a menu must be a string, which is the name of the -menu. This is the string that will be displayed in the parent menu, if -any. For toplevel menus, it is ignored. This string is not displayed -in the menu itself. - -A menu item is a vector containing: - - - the name of the menu item (a string); - - the `callback' of that item; - - a list of keywords with associated values: - - :active active-p a form specifying whether this item is selectable; - - :suffix suffix a string to be appended to the name as an `argument' - to the command, like `Kill Buffer NAME'; - - :keys command-keys a string, suitable for `substitute-command-keys', - to specify the keyboard equivalent of a command - when the callback is a form (this is not necessary - when the callback is a symbol, as the keyboard - equivalent is computed automatically in that case); - - :style style a symbol: nil for a normal menu item, `toggle' for - a toggle button (a single option that can be turned - on or off), or `radio' for a radio button (one of a - group of mutually exclusive options); - - :selected form for `toggle' or `radio' style, a form that specifies - whether the button will be in the selected state. - -Alternately, the vector may contain exactly 3 or 4 elements, with the third -element specifying `active-p' and the fourth specifying `suffix'. - -If the `callback' of a menu item is a symbol, then it must name a command. -It will be invoked with `call-interactively'. If it is a list, then it is -evaluated with `eval'. - -If an element of a menu is a string, then that string will be presented in -the menu as unselectable text. - -If an element of a menu is a string consisting solely of hyphens, then that -item will be presented as a solid horizontal line. - -If an element of a menu is a list, it is treated as a submenu. The name of -that submenu (the first element in the list) will be used as the name of the -item representing this menu on the parent. - -The syntax, more precisely: - - form := - command := - callback := command | form - active-p := - text := - name := - suffix := - command-keys := - object-style := 'nil' | 'toggle' | 'radio' - keyword := ':active' active-p - | ':suffix' suffix - | ':keys' command-keys - | ':style' object-style - | ':selected' form - menu-item := '[' name callback active-p [ suffix ] ']' - | '[' name callback [ keyword ]+ ']' - menu := '(' name [ menu-item | menu | text ]+ ')'" - (if (not (symbolp arg)) - `(popup-menu-internal ,arg nil) - `(popup-menu-internal ,arg - ',(intern (concat "popup-menu-" (symbol-name arg)))))) - -(defun popup-menu-internal (menu cache-symbol) - (if (null cache-symbol) - ;; If no cache symbol, translate the menu afresh each time. - (popup-menu-popup (make-lucid-menu-keymap (car menu) (cdr menu))) - ;; We have a cache symbol. See if the cache is valid - ;; for the same menu we have now. - (or (and (boundp cache-symbol) - (consp (symbol-value cache-symbol)) - (equal (car (symbol-value cache-symbol)) - menu)) - ;; If not, update it. - (set cache-symbol - (cons menu (make-lucid-menu-keymap (car menu) (cdr menu))))) - ;; Use the menu in the cache. - (popup-menu-popup (cdr (symbol-value cache-symbol))))) - -;; Pop up MENU-KEYMAP which was made by make-lucid-menu-keymap. -(defun popup-menu-popup (menu-keymap) - (let ((pos (mouse-pixel-position)) - answer cmd) - (while (and menu-keymap - (setq answer (x-popup-menu (list (list (nth 1 pos) - (nthcdr 2 pos)) - (car pos)) - menu-keymap))) - (setq cmd (lookup-key menu-keymap (apply 'vector answer))) - (setq menu-keymap nil) - (and cmd - (if (keymapp cmd) - (setq menu-keymap cmd) - (call-interactively cmd)))))) - +;; XEmacs compatibility function (defun popup-dialog-box (data) "Pop up a dialog box. A dialog box description is a list. @@ -287,11 +180,13 @@ The syntax, more precisely: ;; It would not make sense to duplicate them here. (defconst default-menubar nil) +;; XEmacs compatibility (defun set-menubar (menubar) "Set the default menubar to be menubar." (setq-default current-menubar (copy-sequence menubar)) (set-menubar-dirty-flag)) +;; XEmacs compatibility (defun set-buffer-menubar (menubar) "Set the buffer-local menubar to be menubar." (make-local-variable 'current-menubar) @@ -301,6 +196,7 @@ The syntax, more precisely: ;;; menu manipulation functions +;; XEmacs compatibility (defun find-menu-item (menubar item-path-list &optional parent) "Searches MENUBAR for item given by ITEM-PATH-LIST. Returns (ITEM . PARENT), where PARENT is the immediate parent of @@ -330,6 +226,7 @@ Signals an error if the item is not found." (cons result parent))))) +;; XEmacs compatibility (defun disable-menu-item (path) "Make the named menu item be unselectable. PATH is a list of strings which identify the position of the menu item in @@ -349,6 +246,7 @@ menu item called \"Item\" under the \"Foo\" submenu of \"Menu\"." item)) +;; XEmacs compatibility (defun enable-menu-item (path) "Make the named menu item be selectable. PATH is a list of strings which identify the position of the menu item in @@ -430,6 +328,7 @@ menu item called \"Item\" under the \"Foo\" submenu of \"Menu\"." (set-menubar-dirty-flag) item)) +;; XEmacs compatibility (defun add-menu-item (menu-path item-name function enabled-p &optional before) "Add a menu item to some menu, creating the menu first if necessary. If the named item exists already, it is changed. @@ -450,6 +349,7 @@ BEFORE, if provided, is the name of a menu item before which this item should (add-menu-item-1 t menu-path item-name function enabled-p before)) +;; XEmacs compatibility (defun delete-menu-item (path) "Remove the named menu item from the menu hierarchy. PATH is a list of strings which identify the position of the menu item in @@ -471,6 +371,7 @@ menu item called \"Item\" under the \"Foo\" submenu of \"Menu\"." item))) +;; XEmacs compatibility (defun relabel-menu-item (path new-name) "Change the string of the specified menu item. PATH is a list of strings which identify the position of the menu item in @@ -494,26 +395,6 @@ NEW-NAME is the string that the menu item will be printed as from now on." (set-menubar-dirty-flag) item)) -(defun add-menu (menu-path menu-name menu-items &optional before) - "Add a menu to the menubar or one of its submenus. -If the named menu exists already, it is changed. -MENU-PATH identifies the menu under which the new menu should be inserted. - It is a list of strings; for example, (\"File\") names the top-level \"File\" - menu. (\"File\" \"Foo\") names a hypothetical submenu of \"File\". - If MENU-PATH is nil, then the menu will be added to the menubar itself. -MENU-NAME is the string naming the menu to be added. -MENU-ITEMS is a list of menu item descriptions. - Each menu item should be a vector of three elements: - - a string, the name of the menu item; - - a symbol naming a command, or a form to evaluate; - - and a form whose value determines whether this item is selectable. -BEFORE, if provided, is the name of a menu before which this menu should - be added, if this menu is not on its parent already. If the menu is already - present, it will not be moved." - (or menu-name (error "must specify a menu name")) - (or menu-items (error "must specify some menu items")) - (add-menu-item-1 nil menu-path menu-name menu-items t before)) - (defvar put-buffer-names-in-file-menu t) -- 2.39.2