From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: complete list of keybindings Date: Wed, 12 Aug 2009 04:12:02 +0200 Organization: Informatimago Message-ID: <87ocql3hn1.fsf@galatea.local> References: <87ws5a2b4w.fsf@galatea.local> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1250044856 570 80.91.229.12 (12 Aug 2009 02:40:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Aug 2009 02:40:56 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 12 04:40:49 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mb3lh-00039p-AX for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Aug 2009 04:40:49 +0200 Original-Received: from localhost ([127.0.0.1]:51109 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mb3lf-0000oQ-FV for geh-help-gnu-emacs@m.gmane.org; Tue, 11 Aug 2009 22:40:47 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 67 Original-X-Trace: individual.net tB6j+GDvMSkSA3F8C8bf1wjv2D8S3a6cwXtpm1s0BBqi9tgI0f Cancel-Lock: sha1:MTIxNDQ2Y2ExMTdmYjczMWM2ZDczMmRkOTQyNzkyN2ZhNTVjMGQzYw== sha1:XTFslOjdf4fDmPTNHi1DnUY608s= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin) Original-Xref: news.stanford.edu gnu.emacs.help:171894 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:67068 Archived-At: Lennart Borgman writes: > Does this really catch longer key bindings? No, for prefixes, it just write the prefix handling function, or print the keymap. (that's why there's no specific processing for the various mode variants). You may improve it and send me a patch ;-) > And chars above 127? Read the source! It says "to 127" right there! Scanning the while unicode would be even slower. Well, we could skip inserting lines form unbound keys, this is where the time is spent actually. >> (defmacro rloop (clauses &rest body) >>  (if (null clauses) >>      `(progn ,@body) >>      `(loop ,@(car clauses) do (rloop ,(cdr clauses) ,@body)))) >> >> (defun all-bindings () >>  (interactive) >>  (message "all-bindings: wait a few seconds please...") >>  (let ((data >>         (with-output-to-string >>             (let ((bindings '())) >>               (rloop ((for C in '("" "C-"))       ; Control >>                       (for M in '("" "M-"))       ; Meta >>                       (for A in '("" "A-"))       ; Alt >>                       (for S in '("" "S-"))       ; Shift >>                       (for H in '("" "H-"))       ; Hyper >>                       (for s in '("" "s-"))       ; super >>                       (for x from 32 to 127)) >>                      (let* ((k (format "%s%s%s%s%s%s%c" C M A S H s x)) >>                             (key (ignore-errors (read-kbd-macro k)))) >>                        (when key >>                          (push >>                           (list k >>                                 (format "%-12s  %-12s  %S\n" k key >>                                         (or >>                                          ;; (string-key-binding key) >>                                          ;; What is this string-key-binding? >>                                          (key-binding key)))) >>                           bindings)))) >>               (dolist (item >>                         (sort bindings >>                               (lambda (a b) >>                                 (or (< (length (first a)) >>                                        (length (first b))) >>                                     (and (= (length (first a)) >>                                             (length (first b))) >>                                          (string< (first a) >>                                                   (first b))))))) >>                 (princ (second item))))))) >>    (switch-to-buffer (format "Keybindings in %s" (buffer-name))) >>    (erase-buffer) >>    (insert data) >>    (goto-char (point-min)) >>    (values))) -- __Pascal Bourguignon__