From: Alex Schroeder <alex@emacswiki.org>
Cc: emacs-devel@gnu.org
Subject: Re: customize-face
Date: Fri, 26 Apr 2002 17:33:55 +0200 [thread overview]
Message-ID: <87662eh3to.fsf@emacswiki.org> (raw)
In-Reply-To: <200204260319.g3Q3JMa04938@aztec.santafe.edu> (Richard Stallman's message of "Thu, 25 Apr 2002 21:19:22 -0600 (MDT)")
Richard Stallman <rms@gnu.org> 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 <alex@gnu.org>
;; Author: Alex Schroeder <alex@gnu.org>
;; Maintainer: Alex Schroeder <alex@gnu.org>
;; 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.
\f
;;; 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
next prev parent reply other threads:[~2002-04-26 15:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-25 11:16 customize-face Gerd Moellmann
2002-04-25 12:12 ` customize-face Andreas Schwab
2002-04-25 14:01 ` customize-face Edward O'Connor
2002-04-25 15:05 ` customize-face Eli Zaretskii
2002-04-26 3:19 ` customize-face Richard Stallman
2002-04-26 15:33 ` Alex Schroeder [this message]
2002-04-25 14:40 ` customize-face Kai Großjohann
2002-04-25 14:56 ` customize-face Eli Zaretskii
2002-04-25 14:25 ` customize-face Gerd Moellmann
2002-04-26 3:18 ` customize-face 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=87662eh3to.fsf@emacswiki.org \
--to=alex@emacswiki.org \
--cc=emacs-devel@gnu.org \
/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).