Mercurial > hg > xemacs-beta
changeset 679:6b890cfde2b1
[xemacs-hg @ 2001-11-29 18:39:21 by adrian]
[PATCH APPROVE COMMIT RECOMMEND 21.4.6] xemacs-21.5: Fix COMMAND-history handling in menubar-items.el <snaxfmkf.fsf@mailto.t-online.de>
author | adrian |
---|---|
date | Thu, 29 Nov 2001 18:39:21 +0000 |
parents | 8e8a7b205142 |
children | 455cef6481bd |
files | lisp/menubar-items.el |
diffstat | 1 files changed, 20 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/menubar-items.el Thu Nov 29 17:00:39 2001 +0000 +++ b/lisp/menubar-items.el Thu Nov 29 18:39:21 2001 +0000 @@ -54,12 +54,18 @@ ;;; Code: -(defun Menubar-items-truncate-list (list n) +(defun Menubar-items-truncate-history (list count label-length) + "Truncate a history LIST to first COUNT items. +Return a list of (label value) lists with labels truncated to last +LABEL-LENGTH characters of value." (mapcar #'(lambda (x) - (if (<= (length x) 50) x (concat "..." (substring x -50)))) - (if (<= (length list) n) + (if (<= (length x) label-length) + (list x x) + (list + (concat "..." (substring x (- label-length))) x))) + (if (<= (length list) count) list - (butlast list (- (length list) n))))) + (butlast list (- (length list) count))))) (defun submenu-generate-accelerator-spec (list &optional omit-chars-list) "Add auto-generated accelerator specifications to a submenu. @@ -447,10 +453,11 @@ menu (let ((items (submenu-generate-accelerator-spec - (mapcar #'(lambda (string) - (vector string - (list 'grep string))) - (Menubar-items-truncate-list grep-history 10))))) + (mapcar #'(lambda (label-value) + (vector (first label-value) + (list 'grep (second label-value)))) + (Menubar-items-truncate-history + grep-history 10 50))))) (append menu '("---") items)))) ["%_Grep..." grep :active (fboundp 'grep)] ["%_Kill Grep" kill-compilation @@ -555,10 +562,11 @@ menu (let ((items (submenu-generate-accelerator-spec - (mapcar #'(lambda (string) - (vector string - (list 'compile string))) - (Menubar-items-truncate-list compile-history 10))))) + (mapcar #'(lambda (label-value) + (vector (first label-value) + (list 'compile (second label-value)))) + (Menubar-items-truncate-history + compile-history 10 50))))) (append menu '("---") items)))) ["%_Compile..." compile :active (fboundp 'compile)] ["%_Repeat Compilation" recompile :active (fboundp 'recompile)]