From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Finding faces to customize Date: Tue, 28 Jun 2005 03:00:33 +0300 Organization: JURTA Message-ID: <87mzpbnsu8.fsf@jurta.org> References: <42BEEE4F.8080709@student.lu.se> <8764w0pu61.fsf@jurta.org> <42BF4DAE.9020309@student.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1119929154 13316 80.91.229.2 (28 Jun 2005 03:25:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 28 Jun 2005 03:25:54 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 28 05:25:53 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dn6j5-00088I-6k for ged-emacs-devel@m.gmane.org; Tue, 28 Jun 2005 05:25:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dn6qj-0007hu-NT for ged-emacs-devel@m.gmane.org; Mon, 27 Jun 2005 23:33:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dn6lz-0006H0-QV for emacs-devel@gnu.org; Mon, 27 Jun 2005 23:28:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dn6lk-00068C-UY for emacs-devel@gnu.org; Mon, 27 Jun 2005 23:28:17 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dn6lk-00064b-4e for emacs-devel@gnu.org; Mon, 27 Jun 2005 23:28:16 -0400 Original-Received: from [194.126.101.98] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dn6ll-000666-Hh for emacs-devel@gnu.org; Mon, 27 Jun 2005 23:28:17 -0400 Original-Received: from mail.neti.ee (80-235-41-107-dsl.mus.estpak.ee [80.235.41.107]) by Relayhost2.neti.ee (Postfix) with ESMTP id 6C6A91E97; Tue, 28 Jun 2005 06:23:46 +0300 (EEST) Original-To: Lennart Borgman In-Reply-To: <42BF4DAE.9020309@student.lu.se> (Lennart Borgman's message of "Mon, 27 Jun 2005 02:51:58 +0200") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee 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:39714 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:39714 >>>I dislike the new italic style for arguments in the help. >>>So I decided I wanted to customize it. But how do I find it? >>>(Without reading the code of course ;-) >> >>On an argument name you can type `C-u C-x = TAB RET TAB RET' >>or `M-x customize-face RET RET' >> > Thanks, that helped I could find the face without problem. BTW, the default prompt for `customize-face' has several problems. 1. The `face' property on a character under the point takes precedence over the face name extracted from the buffer. So if the point is located on the face name in the `defface' specification, then the default will be `font-lock-variable-name-face' instead of the face from `defface', because the face name is fontified in that font-lock face. The patch below joins all faces (from `face' property and face names under the point) into one list. The patch is backward-compatible for the argument `multiple' since it places faces from the `face' property in front of the face name extracted from the buffer, so the first element will be the same as now if `multiple' is nil. 2. When the `face' property has a list of faces, these faces are displayed in the default prompt as words separated by comma. It would be natural to expect that M-n in the minibuffer will allow their editing, but this doesn't work. The patch adds the default argument for completing-read, and splits the result afterwards. One drawback of such approach is that it doesn't allow completion for multiple face names (there is the file emacs-lisp/crm.el distribued with Emacs that could be used here but it is not up-to-date). Also it can accept invalid face name (to allow a comma-separated input string to be accepted), but this is not a big problem. `complete-in-turn' still works on a single face. Index: lisp/faces.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/faces.el,v retrieving revision 1.325 diff -c -r1.325 faces.el *** lisp/faces.el 25 Jun 2005 23:48:27 -0000 1.325 --- lisp/faces.el 28 Jun 2005 01:43:35 -0000 *************** *** 869,875 **** (aliasfaces nil) (nonaliasfaces nil) faces) ! ;; Make a list of the named faces that the `face' property uses. (if (and (listp faceprop) ;; Don't treat an attribute spec as a list of faces. (not (keywordp (car faceprop))) --- 869,878 ---- (aliasfaces nil) (nonaliasfaces nil) faces) ! ;; Try to get a face name from the buffer. ! (if (memq (intern-soft (thing-at-point 'symbol)) (face-list)) ! (setq faces (list (intern-soft (thing-at-point 'symbol))))) ! ;; Add the named faces that the `face' property uses. (if (and (listp faceprop) ;; Don't treat an attribute spec as a list of faces. (not (keywordp (car faceprop))) *************** *** 879,888 **** (push f faces))) (if (symbolp faceprop) (push faceprop faces))) - ;; If there are none, try to get a face name from the buffer. - (if (and (null faces) - (memq (intern-soft (thing-at-point 'symbol)) (face-list))) - (setq faces (list (intern-soft (thing-at-point 'symbol))))) ;; Build up the completion tables. (mapatoms (lambda (s) --- 882,887 ---- *************** *** 904,916 **** (if faces (mapconcat 'symbol-name faces ", ") string-describing-default)) (format "%s: " prompt)) ! (complete-in-turn nonaliasfaces aliasfaces) nil t)) ;; Canonicalize the output. (output (if (equal input "") faces (if (stringp input) ! (list (intern input)) input)))) ;; Return either a list of faces or just one face. (if multiple --- 903,917 ---- (if faces (mapconcat 'symbol-name faces ", ") string-describing-default)) (format "%s: " prompt)) ! (complete-in-turn nonaliasfaces aliasfaces) ! nil nil nil nil ! (if faces (mapconcat 'symbol-name faces ", ")))) ;; Canonicalize the output. (output (if (equal input "") faces (if (stringp input) ! (mapcar 'intern (split-string input ", *" t)) input)))) ;; Return either a list of faces or just one face. (if multiple -- Juri Linkov http://www.jurta.org/emacs/