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

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

Re: properly setting up ~/.emacs.d for daemon usage


From: Yuri Khan
Subject: Re: properly setting up ~/.emacs.d for daemon usage
Date: Mon, 12 Dec 2016 23:46:47 +0700

On Mon, Dec 12, 2016 at 9:10 PM, Filipe Silva <address@hidden> wrote:

> 1) The gui theme I use, zerodark (By Nicolas Petton, who is redesign
> elpa.gnu.org), queries display-graphic-p everytime it goes about defining a
> palete element:
>
> https://github.com/NicolasPetton/zerodark-theme/blob/master/zerodark-theme.el#L158-L162

    (defun true-color-p ()
      "Return non-nil on displays that support 256 colors."
      (or
        (display-graphic-p)
        (= (tty-display-color-cells) 16777216)))

    (let ((class '((class color) (min-colors 89)))
          (default (if (true-color-p) "#abb2bf" "#afafaf"))
          […]
          (background (if (true-color-p) "#282c34" "#333333"))
          […])
      (custom-theme-set-faces
        'zerodark
        `(default ((,class (:background ,background :foreground ,default))))
        […])

There should be no reason to check capabilities of the current display
at theme initialization time. Instead, the theme should state its
preferred attributes for each supported type of display and let the
face system deal with it.

What the above code does is, taking into account only the frame which
is selected at the time of initialization:

* if its display is graphical or its terminal supports exactly
16777216 colors, then it sets the default face for 89-or-more-colored
displays to #abb2bf on #282c34;
* alternatively, if the display of that frame is non-graphical and its
terminal supports a number of color other than 16777216, then it sets
the default face for 89-or-more-colored displays to #afafaf on
#333333.

What it seems it *intended* to be doing is, unconditionally:

* set the default face to #abb2bf on #282c34 for any color display
supporting at least 16777216 colors (and it should not matter if it’s
graphical as long as it supports 24-bit color); and
* set the default face to #afafaf on #333333 for all other displays; and
* hope nothing breaks too badly on displays that are too primitive to
display even that (which notably includes the Linux tty).

    (let ((truecolor '((class color) (min-colors 16777216))))
      (custom-theme-set-faces
        'zerodark
        `(default ((default (:background "#333333" :foreground "#afafaf"))
                   (,truecolor (:background "#282c34" :foreground "#abb2bf"))))
        […])

> 3) there are some packages, like
> https://github.com/7696122/evil-terminal-cursor-changer,
> that only make sense in a tty frame. Since emacs --daemon does not know
> what I'm going to use, (unless I use approach 2. which does not solve issue
> 1.)  I can't really setup a condition that loads or not the package
> accordingly.

So load them always, and report bugs against them if they break in
presence of frames of type they don’t expect.



reply via email to

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