From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: window groups Date: Sat, 07 Jun 2008 22:39:51 -0400 Message-ID: References: <483D4E9A.9020001@gmx.at> <87wsldgkgz.fsf@stupidchicken.com> <87abi9j57j.fsf@catnip.gol.com> <87ve0wbxhb.fsf@stupidchicken.com> <874p8gkafs.fsf@catnip.gol.com> <483F4216.9060606@emf.net> <483FA7C6.7060408@gmx.at> <48402E69.4000003@emf.net> <48411600.3000309@gmx.at> <4841545B.50004@gmx.at> <4841893F.6040402@emf.net> <4841D347.3030908@gmx.at> <48436DD8.4060107@emf.net> <4843BEB1.9020900@gmx.at> <484508B0.9070007@gmx.at> <48452A6F.9080507@gmx.at> <87zlq2ivj0.fsf@escher.local.home> <7id64pts.fsf@smtpserver.esmertec.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1212892808 2759 80.91.229.12 (8 Jun 2008 02:40:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Jun 2008 02:40:08 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?iso-8859-1?Q?Ren=E9?= Kyllingstad , "John S. Yates\, Jr." Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 08 04:40:50 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K5Apt-0002hc-5j for ged-emacs-devel@m.gmane.org; Sun, 08 Jun 2008 04:40:49 +0200 Original-Received: from localhost ([127.0.0.1]:57801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5Ap6-000160-3v for ged-emacs-devel@m.gmane.org; Sat, 07 Jun 2008 22:40:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K5Ap0-00014w-S6 for emacs-devel@gnu.org; Sat, 07 Jun 2008 22:39:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K5Aoz-00013x-NA for emacs-devel@gnu.org; Sat, 07 Jun 2008 22:39:54 -0400 Original-Received: from [199.232.76.173] (port=43003 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5Aoz-00013l-Gq for emacs-devel@gnu.org; Sat, 07 Jun 2008 22:39:53 -0400 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]:33007 helo=ironport2-out.teksavvy.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K5Aoz-0004YL-PZ for emacs-devel@gnu.org; Sat, 07 Jun 2008 22:39:54 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AikCACPjSkjO+ISodGdsb2JhbACBVJAzASebYw X-IronPort-AV: E=Sophos;i="4.27,607,1204520400"; d="scan'208";a="22277990" Original-Received: from smtp.pppoe.ca (HELO smtp.teksavvy.com) ([65.39.196.238]) by ironport2-out.teksavvy.com with ESMTP; 07 Jun 2008 22:39:52 -0400 Original-Received: from pastel.home ([206.248.132.168]) by smtp.teksavvy.com (Internet Mail Server v1.0) with ESMTP id OIV94551; Sat, 07 Jun 2008 22:39:51 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id E65918864; Sat, 7 Jun 2008 22:39:51 -0400 (EDT) In-Reply-To: <7id64pts.fsf@smtpserver.esmertec.com> (=?iso-8859-1?Q?=22Ren?= =?iso-8859-1?Q?=E9?= Kyllingstad"'s message of "Tue, 03 Jun 2008 15:21:03 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. 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 Xref: news.gmane.org gmane.emacs.devel:98652 Archived-At: > That was one thing that has annoyed me since switching from XEmacs. I also > miss the compact disiplay of hyper-apropos bound to C-h a in XEmacs. Here > is an example as was recently asked for: > The key virtue is columnar layout which is visually easier to parse and > faster to navigate. My final sample shows that gnu emacs does not eschew > long lines. The patch below adds an apropos-compact-layout customization to get something similar to what XEmacs provides. Check it out, Stefan --- apropos.el.~1.127.~ 2008-05-06 23:35:06.000000000 -0400 +++ apropos.el 2008-06-07 22:31:01.000000000 -0400 @@ -190,6 +190,7 @@ (define-button-type 'apropos-function 'apropos-label "Function" + 'apropos-short-label "" 'help-echo "mouse-2, RET: Display more help on this function" 'follow-link t 'action (lambda (button) @@ -197,6 +198,7 @@ (define-button-type 'apropos-macro 'apropos-label "Macro" + 'apropos-short-label "" 'help-echo "mouse-2, RET: Display more help on this macro" 'follow-link t 'action (lambda (button) @@ -204,6 +206,7 @@ (define-button-type 'apropos-command 'apropos-label "Command" + 'apropos-short-label "" 'help-echo "mouse-2, RET: Display more help on this command" 'follow-link t 'action (lambda (button) @@ -216,6 +219,7 @@ ;; Likewise for `customize-face-other-window'. (define-button-type 'apropos-variable 'apropos-label "Variable" + 'apropos-short-label "" 'help-echo "mouse-2, RET: Display more help on this variable" 'follow-link t 'action (lambda (button) @@ -223,6 +227,7 @@ (define-button-type 'apropos-face 'apropos-label "Face" + 'apropos-short-label "" 'help-echo "mouse-2, RET: Display more help on this face" 'follow-link t 'action (lambda (button) @@ -230,6 +235,7 @@ (define-button-type 'apropos-group 'apropos-label "Group" + 'apropos-short-label "" 'help-echo "mouse-2, RET: Display more help on this group" 'follow-link t 'action (lambda (button) @@ -238,6 +244,7 @@ (define-button-type 'apropos-widget 'apropos-label "Widget" + 'apropos-short-label "" 'help-echo "mouse-2, RET: Display more help on this widget" 'follow-link t 'action (lambda (button) @@ -245,6 +252,7 @@ (define-button-type 'apropos-plist 'apropos-label "Plist" + 'apropos-short-label "

" 'help-echo "mouse-2, RET: Display more help on this plist" 'follow-link t 'action (lambda (button) @@ -402,6 +410,10 @@ \\{apropos-mode-map}") +(defvar apropos-multi-type t + "If non-nil, this apropos query concerns multiple types. +This is used to decide whether to print the result's type or not.") + ;;;###autoload (defun apropos-variable (pattern &optional do-all) "Show user variables that match PATTERN. @@ -487,7 +499,8 @@ (string-match "\n" doc))))))) (setcar (cdr (car p)) score) (setq p (cdr p)))) - (and (apropos-print t nil nil t) + (and (let ((apropos-multi-type do-all)) + (apropos-print t nil nil t)) message (message "%s" message)))) @@ -617,7 +658,8 @@ (apropos-score-str p)) f v p) apropos-accumulator)))))) - (apropos-print nil "\n----------------\n")) + (let ((apropos-multi-type do-all)) + (apropos-print nil "\n----------------\n"))) ;;;###autoload @@ -844,6 +886,9 @@ nil function)) +(defcustom apropos-compact-layout nil + "If non-nil, use a single line per binding." + :type 'boolean) (defun apropos-print (do-keys spacing &optional text nosubst) "Output result of apropos searching into buffer `*Apropos*'. @@ -885,12 +930,10 @@ (substitute-command-keys "and type \\[apropos-follow] to get full documentation.\n\n")) (if text (insert text "\n\n")) - (while (consp p) + (dolist (apropos-item p) (when (and spacing (not (bobp))) (princ spacing)) - (setq apropos-item (car p) - symbol (car apropos-item) - p (cdr p)) + (setq symbol (car apropos-item)) ;; Insert dummy score element for backwards compatibility with 21.x ;; apropos-item format. (if (not (numberp (cadr apropos-item))) @@ -905,22 +948,25 @@ 'face apropos-symbol-face) (if (and (eq apropos-sort-by-scores 'verbose) (cadr apropos-item)) - (insert " (" (number-to-string (cadr apropos-item)) ") ")) + (insert " (" (number-to-string (cadr apropos-item)) ")")) ;; Calculate key-bindings if we want them. + (unless apropos-compact-layout (and do-keys (commandp symbol) (not (eq symbol 'self-insert-command)) (indent-to 30 1) (if (let ((keys - (save-excursion - (set-buffer old-buffer) + (with-current-buffer old-buffer (where-is-internal symbol))) filtered) ;; Copy over the list of key sequences, ;; omitting any that contain a buffer or a frame. - (while keys - (let ((key (car keys)) - (i 0) + ;; FIXME: Why omit keys that contain buffers and + ;; frames? This looks like a bad workaround rather + ;; than a proper fix. Does anybod know what problem + ;; this is trying to address? --Stef + (dolist (key keys) + (let ((i 0) loser) (while (< i (length key)) (if (or (framep (aref key i)) @@ -928,8 +974,7 @@ (setq loser t)) (setq i (1+ i))) (or loser - (setq filtered (cons key filtered)))) - (setq keys (cdr keys))) + (push key filtered)))) (setq item filtered)) ;; Convert the remaining keys to a string and insert. (insert @@ -950,7 +995,7 @@ 'face apropos-keybinding-face) (put-text-property (- (point) 3) (point) 'face apropos-keybinding-face)))) - (terpri) + (terpri)) (apropos-print-doc 2 (if (commandp symbol) 'apropos-command @@ -963,11 +1008,12 @@ (apropos-print-doc 6 'apropos-face t) (apropos-print-doc 5 'apropos-widget t) (apropos-print-doc 4 'apropos-plist nil)) + (set (make-local-variable 'truncate-partial-width-windows) t) + (set (make-local-variable 'truncate-lines) t) (setq buffer-read-only t)))) (prog1 apropos-accumulator (setq apropos-accumulator ()))) ; permit gc - (defun apropos-macrop (symbol) "Return t if SYMBOL is a Lisp macro." (and (fboundp symbol) @@ -980,20 +1026,26 @@ (defun apropos-print-doc (i type do-keys) - (if (stringp (setq i (nth i apropos-item))) - (progn - (insert " ") - (insert-text-button (button-type-get type 'apropos-label) + (when (stringp (setq i (nth i apropos-item))) + (if apropos-compact-layout + (insert (propertize "\t" 'display '(space :align-to 32)) " ") + (insert " ")) + ;; If the query is only for a single type, there's + ;; no point writing it over and over again. + (when apropos-multi-type + (insert-text-button (button-type-get type + (if apropos-compact-layout + 'apropos-short-label + 'apropos-label)) 'type type ;; Can't use the default button face, since ;; user may have changed the variable! ;; Just say `no' to variables containing faces! 'face apropos-label-face 'apropos-symbol (car apropos-item)) - (insert ": ") + (insert (if apropos-compact-layout " " ": "))) (insert (if do-keys (substitute-command-keys i) i)) - (or (bolp) (terpri))))) - + (or (bolp) (terpri)))) (defun apropos-follow () "Invokes any button at point, otherwise invokes the nearest label button."