comparison lisp/menubar.el @ 4310:a6d7e031a10b

Fix two Tailor glitches. For some reason, Tailor didn't copy these changes from CVS to Mercurial. Do so manually, really synching us with the latest from CVS.
author Mike Sperber <sperber@deinprogramm.de>
date Thu, 06 Dec 2007 20:10:16 +0100
parents 79c5457563f6
children 308d34e9f07d
comparison
equal deleted inserted replaced
4309:3fbaef93f665 4310:a6d7e031a10b
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 (menu-path new-item before in-menu) 213 (defun add-menu-item-1 (leaf-p 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-item &optional before in-menu) 286 (defun add-menu-button (menu-path menu-leaf &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-ITEM is a menu or menu item. See the documentation of `current-menubar'. 292 MENU-LEAF is a menubar leaf node. 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 menu-path menu-item before in-menu)) 299 (add-menu-item-1 t menu-path menu-leaf 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 menu-path submenu before in-menu)) 318 (add-menu-item-1 nil menu-path submenu before in-menu))
319
320 ;; purespace is no more, so this function is unnecessary 319 ;; purespace is no more, so this function is unnecessary
321 ;(defun purecopy-menubar (x) 320 ;(defun purecopy-menubar (x)
322 ; ;; this calls purecopy on the strings, and the contents of the vectors, 321 ; ;; this calls purecopy on the strings, and the contents of the vectors,
323 ; ;; but not on the vectors themselves, or the conses - those must be 322 ; ;; but not on the vectors themselves, or the conses - those must be
324 ; ;; writable. 323 ; ;; writable.
567 and you can call those functions individually if necessary. 566 and you can call those functions individually if necessary.
568 You can also call `submenu-generate-accelerator-spec' yourself to add 567 You can also call `submenu-generate-accelerator-spec' yourself to add
569 accelerator specs -- this works even if the specs have already been added." 568 accelerator specs -- this works even if the specs have already been added."
570 (menu-split-long-menu (menu-sort-menu menu))) 569 (menu-split-long-menu (menu-sort-menu menu)))
571 570
571 ;;;###autoload
572 (defun menu-split-long-menu (menu) 572 (defun menu-split-long-menu (menu)
573 "Split MENU according to `menu-max-items' and add accelerator specs. 573 "Split MENU according to `menu-max-items' and add accelerator specs.
574 If MENU already has accelerator specs, they will be removed and new ones 574 If MENU already has accelerator specs, they will be removed and new ones
575 generated. You should normally use `menu-split-long-menu-and-sort' instead. 575 generated. You should normally use `menu-split-long-menu-and-sort' instead.
576 The menu should already be sorted to get meaningful results when it is 576 The menu should already be sorted to get meaningful results when it is