all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: Finding faces to customize
Date: Tue, 28 Jun 2005 03:00:33 +0300	[thread overview]
Message-ID: <87mzpbnsu8.fsf@jurta.org> (raw)
In-Reply-To: <42BF4DAE.9020309@student.lu.se> (Lennart Borgman's message of "Mon, 27 Jun 2005 02:51:58 +0200")

>>>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/

  parent reply	other threads:[~2005-06-28  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-26 18:05 Finding faces to customize Lennart Borgman
2005-06-26 23:36 ` Juri Linkov
2005-06-27  0:51   ` Lennart Borgman
2005-06-27  5:40     ` Juanma Barranquero
2005-06-28  0:00     ` Juri Linkov [this message]
2005-06-28 18:47       ` Richard M. Stallman
2005-06-28 18:47       ` Richard M. Stallman
2005-06-28 23:59         ` Juri Linkov
2005-07-01  4:03           ` Richard M. Stallman
2005-07-02  0:05             ` Juri Linkov
2005-07-03 15:48               ` Richard M. Stallman
2005-07-02  0:08         ` Juri Linkov
2005-07-03 15:48           ` Richard M. 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

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

  git send-email \
    --in-reply-to=87mzpbnsu8.fsf@jurta.org \
    --to=juri@jurta.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.