From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alex Schroeder Newsgroups: gmane.emacs.devel Subject: Re: customize-face Date: Fri, 26 Apr 2002 17:33:55 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: <87662eh3to.fsf@emacswiki.org> References: <86vgagt4e7.fsf@gerd.dnsq.org> <15560.3158.403299.789844@george.floobin.cx> <200204260319.g3Q3JMa04938@aztec.santafe.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1019838257 23604 127.0.0.1 (26 Apr 2002 16:24:17 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 26 Apr 2002 16:24:17 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 1718W9-00068b-00 for ; Fri, 26 Apr 2002 18:24:17 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 1718Yr-0004tO-00 for ; Fri, 26 Apr 2002 18:27:05 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17180D-00080e-00; Fri, 26 Apr 2002 11:51:17 -0400 Original-Received: from relay01.cablecom.net ([62.2.33.101]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 1717g0-0004ct-00; Fri, 26 Apr 2002 11:30:24 -0400 Original-Received: from smtp.swissonline.ch (mail-4.swissonline.ch [62.2.32.85]) by relay01.cablecom.net (8.11.6/8.11.4/SOL/AWF/MXRELAY/06072001) with ESMTP id g3QFTU216124; Fri, 26 Apr 2002 17:29:34 +0200 (CEST) Original-Received: from confusibombus (dclient217-162-234-187.hispeed.ch [217.162.234.187]) by smtp.swissonline.ch (8.11.6/8.11.6/SMTPSOL/AWF/2002040101) with ESMTP id g3QFUCr23563; Fri, 26 Apr 2002 17:30:13 +0200 (MEST) Original-Received: from alex by confusibombus with local (Exim 3.12 #1 (Debian)) id 1717jP-0000Ak-00; Fri, 26 Apr 2002 17:33:55 +0200 Original-To: rms@gnu.org In-Reply-To: <200204260319.g3Q3JMa04938@aztec.santafe.edu> (Richard Stallman's message of "Thu, 25 Apr 2002 21:19:22 -0600 (MDT)") Original-Lines: 115 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i686-pc-linux-gnu) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:3304 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:3304 Richard Stallman writes: > Alex Schroeder's face-list.el provides `customize-face-at' and > `describe-face-at' for precisely this sort of situation. I find > them to be very useful, and bind them to C-c f c and C-c f d. > > Could you send me this code, and his email address? ;;; face-list.el --- convenience functions for face customization ;; Copyright (C) 2000 Alex Schroeder ;; Author: Alex Schroeder ;; Maintainer: Alex Schroeder ;; Version: 1.0.0 ;; Keywords: faces ;; This file is not part of GNU Emacs. ;; This is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free ;; Software Foundation; either version 2, or (at your option) any later ;; version. ;; This is distributed in the hope that it will be useful, but WITHOUT ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ;; for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ;; MA 02111-1307, USA. ;;; Commentary: ;; This code allows you to browse the list of defined faces and to ;; quickly call a face customization buffer for the face at point, ;; thereby facilitating the job of a color theme author. ;; Loading this code will advise `list-faces-display' to put the *Faces* ;; buffer into `faces-list-mode'. That modes provides two extra key ;; bindings; one of them calls `face-describe' for the face at point, ;; the other calls `customize-face' for the face at point. ;; The two functions to describe and customize the face at point can be ;; called from anywhere; they are `describe-face-at' and ;; `customize-face-at'. If you are working with Emacs and discover a ;; face you don't like, put point on some text with the offending face ;; and type M-x customize-face-at RET. ;;; Code: (defadvice list-faces-display (after do-faces-list-mode activate) "Start faces-list-mode after listing the faces." (set-buffer (get-buffer "*Faces*")) (faces-list-mode)) (defun faces-list-mode () "Major mode to examine and modify faces. Use \\[describe-face-at] to describe the face at point. Use \\[customize-face-at] to customize the face at point." (kill-all-local-variables) (setq major-mode 'faces-list-mode) (setq mode-name "Faces") (use-local-map faces-list-mode-map) (setq buffer-read-only t)) (defvar faces-list-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "e") 'customize-face-at) (define-key map (kbd "RET") 'customize-face-at) (define-key map (kbd "d") 'describe-face-at) (define-key map (kbd "?") 'describe-face-at) (define-key map (kbd "q") 'bury-buffer) map) "Mode map used for `faces-list-mode'.") (defun describe-face-at () "Describe face at point." (interactive) (describe-face (get-face-at))) (defun customize-face-at () "Customize face at point." (interactive) (customize-face (get-face-at))) (defun get-face-at () "Determine face at point using `get-char-property'. If char at point has no face property, examine the text on the same line as point as well." (let ((face (get-char-property (point) 'face))) (unless face (let ((start (point))) (while (null (or (setq face (get-char-property (point) 'face)) (eolp))) (forward-char 1)))) (unless face (let ((start (point))) (while (null (or (setq face (get-char-property (point) 'face)) (bolp))) (forward-char -1)))) (unless face (error "No face selected.")) (if (listp face) (setq face (car face))) face)) (provide 'face-list) ;;; face-list.el ends here