Mercurial > hg > xemacs-beta
comparison lisp/menubar-items.el @ 464:5aa1854ad537 r21-2-47
Import from CVS: tag r21-2-47
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:45:51 +0200 |
parents | 0784d089fdc9 |
children | 52626a2f02ef |
comparison
equal
deleted
inserted
replaced
463:a158004111cd | 464:5aa1854ad537 |
---|---|
52 ;; This file is dumped with XEmacs (when window system and menubar support is | 52 ;; This file is dumped with XEmacs (when window system and menubar support is |
53 ;; compiled in). | 53 ;; compiled in). |
54 | 54 |
55 ;;; Code: | 55 ;;; Code: |
56 | 56 |
57 (defun menu-truncate-list (list n) | 57 (defun Menubar-items-truncate-list (list n) |
58 (if (<= (length list) n) | 58 (mapcar #'(lambda (x) |
59 list | 59 (if (<= (length x) 50) x (concat "..." (substring x -50)))) |
60 (butlast list (- (length list) n)))) | 60 (if (<= (length list) n) |
61 list | |
62 (butlast list (- (length list) n))))) | |
61 | 63 |
62 (defun submenu-generate-accelerator-spec (list &optional omit-chars-list) | 64 (defun submenu-generate-accelerator-spec (list &optional omit-chars-list) |
63 "Add auto-generated accelerator specifications to a submenu. | 65 "Add auto-generated accelerator specifications to a submenu. |
64 This can be used to add accelerators to the return value of a menu filter | 66 This can be used to add accelerators to the return value of a menu filter |
65 function. It correctly ignores unselectable items. It will destructively | 67 function. It correctly ignores unselectable items. It will destructively |
430 (let ((items | 432 (let ((items |
431 (submenu-generate-accelerator-spec | 433 (submenu-generate-accelerator-spec |
432 (mapcar #'(lambda (string) | 434 (mapcar #'(lambda (string) |
433 (vector string | 435 (vector string |
434 (list 'grep string))) | 436 (list 'grep string))) |
435 (menu-truncate-list grep-history 10))))) | 437 (Menubar-items-truncate-list grep-history 10))))) |
436 (append menu '("---") items)))) | 438 (append menu '("---") items)))) |
437 ["%_Grep..." grep :active (fboundp 'grep)] | 439 ["%_Grep..." grep :active (fboundp 'grep)] |
438 ["%_Kill Grep" kill-compilation | 440 ["%_Kill Grep" kill-compilation |
439 :active (and (fboundp 'kill-compilation) | 441 :active (and (fboundp 'kill-compilation) |
440 (fboundp 'compilation-find-buffer) | 442 (fboundp 'compilation-find-buffer) |
538 (let ((items | 540 (let ((items |
539 (submenu-generate-accelerator-spec | 541 (submenu-generate-accelerator-spec |
540 (mapcar #'(lambda (string) | 542 (mapcar #'(lambda (string) |
541 (vector string | 543 (vector string |
542 (list 'compile string))) | 544 (list 'compile string))) |
543 (menu-truncate-list compile-history 10))))) | 545 (Menubar-items-truncate-list compile-history 10))))) |
544 (append menu '("---") items)))) | 546 (append menu '("---") items)))) |
545 ["%_Compile..." compile :active (fboundp 'compile)] | 547 ["%_Compile..." compile :active (fboundp 'compile)] |
546 ["%_Repeat Compilation" recompile :active (fboundp 'recompile)] | 548 ["%_Repeat Compilation" recompile :active (fboundp 'recompile)] |
547 ["%_Kill Compilation" kill-compilation | 549 ["%_Kill Compilation" kill-compilation |
548 :active (and (fboundp 'kill-compilation) | 550 :active (and (fboundp 'kill-compilation) |