help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Handling non-interactive use with faces


From: carlmarcos
Subject: Re: Handling non-interactive use with faces
Date: Thu, 11 Aug 2022 21:47:25 +0200 (CEST)


-- 
 Sent with Tutanota, enjoy secure & ad-free emails. 



Aug 11, 2022, 18:42 by eliz@gnu.org:

>> Date: Thu, 11 Aug 2022 20:32:10 +0200 (CEST)
>> From: carlmarcos@tutanota.com
>> Cc: help-gnu-emacs@gnu.org
>>
>> Aug 11, 2022, 16:08 by eliz@gnu.org:
>>
>> >> Date: Thu, 11 Aug 2022 17:56:23 +0200 (CEST)
>> >> Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
>> >> From: carlmarcos--- via Users list for the GNU Emacs text editor 
>> >> <help-gnu-emacs@gnu.org>
>> >>
>> >> > You need to add a pcase alternative for a face or face name, and then
>> >> > you call your function with that face as a single argument.
>> >>
>> >> I am struggling to figure out what kind of `pcase' I should use for the 
>> >> scheme you suggest.
>> >>
>> >
>> > I guess use stringp for face names and facep for faces?
>> >
>> That would require two pcase statements, first to handle face names with 
>> stringp, then for faces with facep.
>>
>
> Yes, and?...
>
> (And why are you using pcase here to begin with?)
>

Have done as follows.  Would you do it differently?

(defun laxy-descface (facenm)
  "Describe the typeface properties of face name FACENM."

  (interactive
   (list
    (let* ( (cseq '("default" "mode-line" "mode-line-inactive"
    "list" "text-property")) )
      (completing-read "Face_property: " cseq nil t "text-property"))))

  (cond
   ((stringp facenm)

    (pcase facenm
      ("text-property"
       (describe-face (get-text-property (point) 'face)))
      ("default"
       (describe-face (intern facenm)))
      ("mode-line"
       (describe-face (intern facenm)))
      ("mode-line-inactive"
       (describe-face (intern facenm)))
      ("list"
       (list-faces-display))) )

   ((facep facenm)
    (describe-face facenm))))



reply via email to

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