comparison lisp/menubar.el @ 4164:79c5457563f6

[xemacs-hg @ 2007-09-05 06:50:44 by michaels] 2007-09-05 Mike Sperber <mike@xemacs.org> * menubar.el (add-menu-item-1): Remove bogus `leaf-p' argument. (add-menu-button): Follow above change; also remove bogus docstring talking about "leaf node". (add-submenu): Follow above change.
author michaels
date Wed, 05 Sep 2007 06:50:45 +0000
parents 979c4c930bb5
children a6d7e031a10b
comparison
equal deleted inserted replaced
4163:75562ac25d7b 4164:79c5457563f6
208 (t 208 (t
209 (signal 'error (list (gettext "no such submenu") 209 (signal 'error (list (gettext "no such submenu")
210 (car item-path-list))))) 210 (car item-path-list)))))
211 (cons result parent))))) 211 (cons result parent)))))
212 212
213 (defun add-menu-item-1 (leaf-p menu-path new-item before in-menu) 213 (defun add-menu-item-1 (menu-path new-item before in-menu)
214 ;; This code looks like it could be cleaned up some more 214 ;; This code looks like it could be cleaned up some more
215 ;; Do we really need 6 calls to find-menu-item? 215 ;; Do we really need 6 calls to find-menu-item?
216 (let* ((item-name 216 (let* ((item-name
217 (cond ((vectorp new-item) (aref new-item 0)) 217 (cond ((vectorp new-item) (aref new-item 0))
218 ((consp new-item) (car new-item)) 218 ((consp new-item) (car new-item))
281 ;; otherwise, add the item to the end. 281 ;; otherwise, add the item to the end.
282 (nconc menu (list new-item)))))) 282 (nconc menu (list new-item))))))
283 (set-menubar-dirty-flag) 283 (set-menubar-dirty-flag)
284 new-item)) 284 new-item))
285 285
286 (defun add-menu-button (menu-path menu-leaf &optional before in-menu) 286 (defun add-menu-button (menu-path menu-item &optional before in-menu)
287 "Add a menu item to some menu, creating the menu first if necessary. 287 "Add a menu item to some menu, creating the menu first if necessary.
288 If the named item exists already, it is changed. 288 If the named item exists already, it is changed.
289 MENU-PATH identifies the menu under which the new menu item should be inserted. 289 MENU-PATH identifies the menu under which the new menu item should be inserted.
290 It is a list of strings; for example, (\"File\") names the top-level \"File\" 290 It is a list of strings; for example, (\"File\") names the top-level \"File\"
291 menu. (\"File\" \"Foo\") names a hypothetical submenu of \"File\". 291 menu. (\"File\" \"Foo\") names a hypothetical submenu of \"File\".
292 MENU-LEAF is a menubar leaf node. See the documentation of `current-menubar'. 292 MENU-ITEM is a menu or menu item. See the documentation of `current-menubar'.
293 BEFORE, if provided, is the name of a menu item before which this item should 293 BEFORE, if provided, is the name of a menu item before which this item should
294 be added, if this item is not on the menu already. If the item is already 294 be added, if this item is not on the menu already. If the item is already
295 present, it will not be moved. 295 present, it will not be moved.
296 IN-MENU, if provided, means use that instead of `current-menubar' as the 296 IN-MENU, if provided, means use that instead of `current-menubar' as the
297 menu to change." 297 menu to change."
298 ;; Note easymenu.el uses the fact that menu-leaf can be a submenu. 298 ;; Note easymenu.el uses the fact that menu-leaf can be a submenu.
299 (add-menu-item-1 t menu-path menu-leaf before in-menu)) 299 (add-menu-item-1 menu-path menu-item before in-menu))
300 300
301 ;; I actually liked the old name better, but the interface has changed too 301 ;; I actually liked the old name better, but the interface has changed too
302 ;; drastically to keep it. --Stig 302 ;; drastically to keep it. --Stig
303 (defun add-submenu (menu-path submenu &optional before in-menu) 303 (defun add-submenu (menu-path submenu &optional before in-menu)
304 "Add a menu to the menubar or one of its submenus. 304 "Add a menu to the menubar or one of its submenus.
313 be added, if this menu is not on its parent already. If the menu is already 313 be added, if this menu is not on its parent already. If the menu is already
314 present, it will not be moved. 314 present, it will not be moved.
315 IN-MENU, if provided, means use that instead of `current-menubar' as the 315 IN-MENU, if provided, means use that instead of `current-menubar' as the
316 menu to change." 316 menu to change."
317 (check-menu-syntax submenu nil) 317 (check-menu-syntax submenu nil)
318 (add-menu-item-1 nil menu-path submenu before in-menu)) 318 (add-menu-item-1 menu-path submenu before in-menu))
319
319 ;; purespace is no more, so this function is unnecessary 320 ;; purespace is no more, so this function is unnecessary
320 ;(defun purecopy-menubar (x) 321 ;(defun purecopy-menubar (x)
321 ; ;; this calls purecopy on the strings, and the contents of the vectors, 322 ; ;; this calls purecopy on the strings, and the contents of the vectors,
322 ; ;; but not on the vectors themselves, or the conses - those must be 323 ; ;; but not on the vectors themselves, or the conses - those must be
323 ; ;; writable. 324 ; ;; writable.