emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/apropos.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/apropos.el,v
Date: Tue, 10 Jun 2008 02:44:50 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        08/06/10 02:44:49

Index: lisp/apropos.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/apropos.el,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -b -r1.129 -r1.130
--- lisp/apropos.el     8 Jun 2008 04:32:43 -0000       1.129
+++ lisp/apropos.el     10 Jun 2008 02:44:48 -0000      1.130
@@ -190,6 +190,7 @@
 
 (define-button-type 'apropos-function
   'apropos-label "Function"
+  'apropos-short-label "f"
   '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 "m"
   '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 "c"
   '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 "v"
   '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 "F"
   '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 "g"
   '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 "w"
   '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 "p"
   'help-echo "mouse-2, RET: Display more help on this plist"
   'follow-link t
   'action (lambda (button)
@@ -408,6 +416,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.
@@ -493,7 +505,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))))
 
@@ -683,7 +696,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
@@ -910,6 +924,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*'.
@@ -971,6 +988,7 @@
                   (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))
@@ -1015,7 +1033,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
@@ -1028,6 +1046,8 @@
          (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
@@ -1045,19 +1065,25 @@
 
 (defun apropos-print-doc (i type do-keys)
   (when (stringp (setq i (nth i apropos-item)))
-    (insert "  ")
-    (insert-text-button (button-type-get type 'apropos-label)
+    (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
+       (if apropos-compact-layout
+           (button-type-get type 'apropos-label)
+         (format "<%s>" (button-type-get type 'apropos-short-label)))
                         'type type
-                        ;; Can't use the default button face, since
-                        ;; user may have changed the variable!
-                        ;; Just say `no' to variables containing faces!
+       ;; 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))))
 
-
 (defun apropos-follow ()
   "Invokes any button at point, otherwise invokes the nearest label button."
   (interactive)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]