Sean Whitton <spwhit...@spwhitton.name> writes:

> the best I can come up with is
>
>     (defface org-hide
>       '((((background light) (type ns)) (:foreground "white"))
>         (((background light) (type w32)) (:foreground "white"))
>         (((background dark) (type ns)) (:foreground "black"))
>         (((background dark) (type w32)) (:foreground "black"))
>         (((background light)) (:foreground "white" :inherit fixed-pitch))
>         (((background light)) (:foreground "white" :inherit fixed-pitch)))
>       "Face used to hide leading stars in headlines.
>     The foreground color of this face should be equal to the background
>     color of the frame."
>       :group 'org-faces)
>
> which is not good code.  Is there any alternative?

(defface org-hide
   (mapcar
    (pcase-lambda (`(,term ,bg))
      `(((background ,bg) (type ,term))
        (:foreground ,(pcase bg ('light "white") ('dark "black"))
         ,@(when term '(:inherit fixed-pitch)))))
     (let (args)
       (dolist (term '(ns w32 nil) args)
         (dolist (bg '(light dark))
           (push (list term bg) args)))))
   

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to