Mercurial > hg > xemacs-beta
comparison lisp/prim/help.el @ 173:8eaf7971accc r20-3b13
Import from CVS: tag r20-3b13
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:49:09 +0200 |
parents | 5a88923fcbfe |
children | 6075d714658b |
comparison
equal
deleted
inserted
replaced
172:a38aed19690b | 173:8eaf7971accc |
---|---|
1144 (save-excursion | 1144 (save-excursion |
1145 (set-buffer standard-output) | 1145 (set-buffer standard-output) |
1146 ;; Return the text we displayed. | 1146 ;; Return the text we displayed. |
1147 (buffer-string)))))) | 1147 (buffer-string)))))) |
1148 | 1148 |
1149 (defun sorted-key-descriptions (keys &optional separator) | |
1150 "Sort and separate the key descriptions for KEYS. | |
1151 The sorting is done by length (shortest bindings first), and the bindings | |
1152 are separated with SEPARATOR (`, ' by default)." | |
1153 (mapconcat 'key-description | |
1154 (sort keys #'(lambda (x y) | |
1155 (< (length x) (length y)))) | |
1156 (or separator ", "))) | |
1157 | |
1149 (defun where-is (definition) | 1158 (defun where-is (definition) |
1150 "Print message listing key sequences that invoke specified command. | 1159 "Print message listing key sequences that invoke specified command. |
1151 Argument is a command definition, usually a symbol with a function definition." | 1160 Argument is a command definition, usually a symbol with a function definition." |
1152 (interactive | 1161 (interactive |
1153 (let ((fn (function-called-at-point)) | 1162 (let ((fn (function-called-at-point)) |
1154 (enable-recursive-minibuffers t) | 1163 (enable-recursive-minibuffers t) |
1155 val) | 1164 val) |
1156 ;; #### should use `read-command' | 1165 (setq val (read-command |
1157 (setq val (completing-read (if fn | 1166 (if fn (format "Where is command (default %s): " fn) |
1158 (format "Where is command (default %s): " fn) | 1167 "Where is command: "))) |
1159 "Where is command: ") | 1168 (list (if (equal (symbol-name val) "") |
1160 obarray 'commandp t nil | 1169 fn val)))) |
1161 'read-command-history)) | |
1162 (list (if (equal val "") | |
1163 fn (intern val))))) | |
1164 (let ((keys (where-is-internal definition))) | 1170 (let ((keys (where-is-internal definition))) |
1165 (if keys | 1171 (if keys |
1166 (message "%s is on %s" definition | 1172 (message "%s is on %s" definition (sorted-key-descriptions keys)) |
1167 (mapconcat 'key-description | 1173 (message "%s is not on any keys" definition))) |
1168 (sort keys #'(lambda (x y) | |
1169 (< (length x) (length y)))) | |
1170 ", ")) | |
1171 (message "%s is not on any keys" definition))) | |
1172 nil) | 1174 nil) |
1173 | 1175 |
1174 ;; Synched with Emacs 19.35 | 1176 ;; Synched with Emacs 19.35 |
1175 (defun locate-library (library &optional nosuffix path interactive-call) | 1177 (defun locate-library (library &optional nosuffix path interactive-call) |
1176 "Show the precise file name of Emacs library LIBRARY. | 1178 "Show the precise file name of Emacs library LIBRARY. |