emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding faces to customize


From: Juri Linkov
Subject: Re: Finding faces to customize
Date: Sat, 02 Jul 2005 03:08:29 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

> Your patch looks good to me.  Please install it.
>
>       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).
>
> Could you tell me more about the problem?  If this package no longer
> works, we ought to fix it.  Is there an actual bug?

With fixed crm.el, I want to submit a new patch which uses
completing-read-multiple.  It allows to simultaneously read multiple
face names separated by comma, and even to use complete-in-turn on
each of them.

Index: lisp/faces.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/faces.el,v
retrieving revision 1.327
diff -c -r1.327 faces.el
*** lisp/faces.el       30 Jun 2005 15:04:57 -0000      1.327
--- lisp/faces.el       2 Jul 2005 00:08:08 -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 ----
***************
*** 896,917 ****
      (unless multiple
        (if faces
          (setq faces (list (car faces)))))
      (let* ((input
            ;; Read the input.
!           (completing-read
             (if (or faces string-describing-default)
                 (format "%s (default %s): " prompt
!                        (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
          output
--- 895,921 ----
      (unless multiple
        (if faces
          (setq faces (list (car faces)))))
+     (require 'crm)
      (let* ((input
            ;; Read the input.
!           (completing-read-multiple
             (if (or faces string-describing-default)
                 (format "%s (default %s): " prompt
!                        (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
!           (cond ((or (equal input "") (equal input '("")))
!                  faces)
!                 ((stringp input)
!                  (mapcar 'intern (split-string input ", *" t)))
!                 ((listp input)
!                  (mapcar 'intern input))
!                 (input))))
        ;; Return either a list of faces or just one face.
        (if multiple
          output

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]