From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: tweak to apropos-command display Date: Tue, 22 Feb 2005 22:46:01 +0100 Message-ID: References: <1814.220.255.78.196.1108996512.squirrel@220.255.78.196> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1109108702 17683 80.91.229.2 (22 Feb 2005 21:45:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 22 Feb 2005 21:45:02 +0000 (UTC) Cc: Chong Yidong , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 22 22:45:01 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D3hpJ-00012s-KI for ged-emacs-devel@m.gmane.org; Tue, 22 Feb 2005 22:44:18 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D3i6X-0001ak-DP for ged-emacs-devel@m.gmane.org; Tue, 22 Feb 2005 17:02:05 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D3i4x-00013z-24 for emacs-devel@gnu.org; Tue, 22 Feb 2005 17:00:27 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D3i4w-00013L-2u for emacs-devel@gnu.org; Tue, 22 Feb 2005 17:00:26 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D3i4v-000137-Rh for emacs-devel@gnu.org; Tue, 22 Feb 2005 17:00:25 -0500 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D3hr3-0000aT-2M; Tue, 22 Feb 2005 16:46:05 -0500 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepa.post.tele.dk (Postfix) with SMTP id 3F13847FEBD; Tue, 22 Feb 2005 22:45:59 +0100 (CET) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Tue, 22 Feb 2005 13:11:06 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: main.gmane.org gmane.emacs.devel:33744 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:33744 Richard Stallman writes: > When apropos-command is displaying the keybindings associated with a > command, it often runs past the edge of the screen (esp. when displaying > M-x COMMAND RET) This makes the output very difficult to read. > > How about this change instead? > > ! (insert "(invoke using M-x)"))) I like M-x ... RET better. The following patch does that. It also improves handling of menu bar entries in two ways: 1) If menu-bar-mode is disabled, it doesn't mention menu bar bindings. 2) It pretty prints menu bar entries like this: e.g. "File Menu" rather than " " *** apropos.el 12 Feb 2005 14:46:58 +0100 1.101 --- apropos.el 22 Feb 2005 22:42:30 +0100 *************** *** 795,801 **** (with-output-to-temp-buffer "*Apropos*" (let ((p apropos-accumulator) (old-buffer (current-buffer)) ! symbol item) (set-buffer standard-output) (apropos-mode) (if (display-mouse-p) --- 795,801 ---- (with-output-to-temp-buffer "*Apropos*" (let ((p apropos-accumulator) (old-buffer (current-buffer)) ! symbol item menu-items) (set-buffer standard-output) (apropos-mode) (if (display-mouse-p) *************** *** 839,848 **** (i 0) loser) (while (< i (length key)) ! (if (or (framep (aref key i)) ! (bufferp (aref key i))) (setq loser t)) ! (setq i (1+ i))) (or loser (setq filtered (cons key filtered)))) (setq keys (cdr keys))) --- 839,853 ---- (i 0) loser) (while (< i (length key)) ! (let ((elt (aref key i))) ! (cond ! ((or (framep elt) (bufferp elt)) (setq loser t)) ! ((and (= i 0) (eq elt 'menu-bar)) ! (if menu-bar-mode ! (setq menu-items (cons key menu-items)) ! (setq loser t))))) ! (setq i (if loser (length key) (1+ i)))) (or loser (setq filtered (cons key filtered)))) (setq keys (cdr keys))) *************** *** 852,858 **** (mapconcat (lambda (key) (setq key (condition-case () ! (key-description key) (error))) (if apropos-keybinding-face (put-text-property 0 (length key) --- 857,871 ---- (mapconcat (lambda (key) (setq key (condition-case () ! (if (and (memq key menu-items) ! (> (length key) 1) ! (symbolp (aref key 1))) ! (let ((m (symbol-name (aref key 1))) ! (case-fold-search t)) ! (if (string-match "^\\(.*\\)-menu$" m) ! (setq m (match-string 1 m))) ! (format "%s Menu" (capitalize m))) ! (key-description key)) (error))) (if apropos-keybinding-face (put-text-property 0 (length key) *************** *** 860,872 **** key)) key) item ", ")) ! (insert "M-x") ! (put-text-property (- (point) 3) (point) ! 'face apropos-keybinding-face) ! (insert " " (symbol-name symbol) " ") ! (insert "RET") ! (put-text-property (- (point) 3) (point) ! 'face apropos-keybinding-face))) (terpri) (apropos-print-doc 2 (if (commandp symbol) --- 873,884 ---- key)) key) item ", ")) ! (insert "M-x ... RET") ! (when apropos-keybinding-face ! (put-text-property (- (point) 11) (- (point) 8) ! 'face apropos-keybinding-face) ! (put-text-property (- (point) 3) (point) ! 'face apropos-keybinding-face)))) (terpri) (apropos-print-doc 2 (if (commandp symbol) -- Kim F. Storm http://www.cua.dk