unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
Subject: Re: list-faces-display
Date: Tue, 31 May 2005 13:15:21 +0200	[thread overview]
Message-ID: <f7ccd24b0505310415788f7fb3@mail.gmail.com> (raw)
In-Reply-To: <f7ccd24b05053006392d56ac0d@mail.gmail.com>

Anyway, this is the patch I propose, if deemed a fix and not a feature.

-- 
                    /L/e/k/t/u


Index: faces.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/faces.el,v
retrieving revision 1.310
diff -u -2 -r1.310 faces.el
--- faces.el	31 May 2005 11:10:43 -0000	1.310
+++ faces.el	31 May 2005 11:07:42 -0000
@@ -1155,16 +1155,21 @@
   (interactive (list (and current-prefix-arg
                           (read-string "List faces matching regexp: "))))
-  (let ((faces (sort (face-list) #'string-lessp))
+  (let ((all-faces (zerop (length regexp)))
 	(frame (selected-frame))
+	(max-length 0)
+	face line-format
  	disp-frame window face-name)
-    (when (> (length regexp) 0)
-      (setq faces
-            (delq nil
-                  (mapcar (lambda (f)
-                            (when (string-match regexp (symbol-name f))
-                              f))
-                          faces)))
-      (unless faces
-        (error "No faces matching \"%s\"" regexp)))
+    (setq faces
+	  (delq nil
+		(mapcar (lambda (f)
+			  (let ((s (symbol-name f)))
+			    (when (or all-faces (string-match regexp s))
+			      (setq max-length (max (length s) max-length))
+			      f)))
+			(sort (face-list) #'string-lessp))))
+    (unless faces
+      (error "No faces matching \"%s\"" regexp))
+    (setq max-length (1+ max-length)
+	  line-format (format "%%-%ds" max-length))
     (with-output-to-temp-buffer "*Faces*"
       (save-excursion
@@ -1181,5 +1186,5 @@
  	(dolist (face faces)
  	  (setq face-name (symbol-name face))
-	  (insert (format "%25s " face-name))
+	  (insert (format line-format face-name))
 	  ;; Hyperlink to a customization buffer for the face.  Using
 	  ;; the help xref mechanism may not be the best way.
@@ -1206,5 +1211,5 @@
 	    (forward-line 1)
  	    (while (not (eobp))
-	      (insert "                          ")
+	      (insert-char ?\s max-length)
 	      (forward-line 1))))
  	(goto-char (point-min)))

  reply	other threads:[~2005-05-31 11:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-30 13:39 list-faces-display Juanma Barranquero
2005-05-31 11:15 ` Juanma Barranquero [this message]
2005-05-31 11:17   ` list-faces-display Juanma Barranquero
2005-06-01  9:39 ` list-faces-display Richard Stallman
2005-06-01 10:04   ` list-faces-display Juanma Barranquero
2005-06-02  6:40     ` list-faces-display Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7ccd24b0505310415788f7fb3@mail.gmail.com \
    --to=lekktu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).