doomemacs / themes

A megapack of themes for GNU Emacs.
MIT License
2.15k stars 387 forks source link

The background color is not transparent but blue when launching doom-emacs via emacsclient in terminal #539

Closed ylorn closed 3 years ago

ylorn commented 3 years ago

Setup

Doom Info

SYSTEM  type       darwin
    config     x86_64-apple-darwin19.6.0
    shell      /usr/local/bin/zsh
    uname      Darwin 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64
    path       (~/.gem/bin ~/Library/Python/3.7/bin ~/.emacs.d/bin /usr/local/opt/curl/bin /usr/local/opt/openssl/bin /usr/local/opt/sqlite/bin /usr/local/bin /usr/local/sbin /usr/bin /bin /usr/sbin /sbin /usr/local/opt/fzf/bin /usr/local/Cellar/emacs-mac/emacs-27.1-mac-8.0/libexec/emacs/27.1/x86_64-apple-darwin19.6.0)
EMACS   dir        ~/.emacs.d/
    version    27.1
    build      Nov 09, 2020
    buildopts  --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-mac/emacs-27.1-mac-8.0/share/info/emacs --prefix=/usr/local/Cellar/emacs-mac/emacs-27.1-mac-8.0 --with-mac --enable-mac-app=/usr/local/Cellar/emacs-mac/emacs-27.1-mac-8.0 --with-gnutls --with-modules --with-rsvg
    features   RSVG DBUS GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER GMP
    traits     (batch server-running)
DOOM    dir        ~/.doom.d/
    version    2.0.9
    build      HEAD -> develop 92c9127b8 2020-11-07 00:20:07 -0500
    elc-files  0
    modules    (:completion company (ivy +prescient +icons) :ui doom doom-dashboard doom-quit hl-todo indent-guides minimap (modeline +light) ophints (popup +defaults) tabs treemacs unicode vc-gutter vi-tilde-fringe window-select workspaces :editor (evil +everywhere) file-templates fold multiple-cursors snippets :emacs (dired +icons) electric (ibuffer +icons) undo vc :term eshell vterm :checkers syntax spell grammar :tools debugger docker (eval +overlay) lookup lsp magit make pdf tmux upload :os macos tty :lang (cc +lsp) emacs-lisp (json +lsp) javascript lua markdown org python (ruby +rails) sh (swift +lsp) yaml :email (mu4e +gmail) :app irc (rss +org) twitter :config (default +bindings +smartparens))
    packages   ((dmenu) (elfeed) (emms) (emojify) (evil-tutor) (mastodon) (md4rd) (org-bullets) (peep-dired) (rainbow-mode) (sublimity) (tldr) (wc-mode) (writeroom-mode) (leetcode) (mac-pseudo-daemon))
    unpin      (n/a)
    elpa       (n/a)

Shell Info

~
āžœ echo $SHELL
/usr/local/bin/zsh

~
āžœ echo $TERM
xterm-256color

~/.doom.d/config.el

(use-package doom-themes
  :config
  (setq doom-themes-enable-bold t
        doom-themes-enable-italic t)
  (load-theme 'doom-one t)
  (doom-themes-visual-bell-config)
  ;; for treemacs users
  (setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme
  (doom-themes-treemacs-config)
  (doom-themes-org-config))

(setq doom-font (font-spec :family "SF Mono" :size 15)
      doom-variable-pitch-font (font-spec :family "New York Medium" :size 15)
      doom-big-font (font-spec :family "SF Mono" :size 24))
(custom-set-faces!
  '(font-lock-comment-face :slant italic)
  '(font-lock-keyword-face :weight bold))

Problem

Steps to Reproduce

  1. Open /Applications/Emacs.app
  2. M-x server-start
  3. Open /System/Applications/Utilities/Terminal.app
  4. Open file in terminal via emacsclient -nw -t /path/to/file

Observation

  1. The fonts, font styles (weight, slant, etc.), font color schemes are displayed correctly in terminal
  2. The background color is not transparent as it should be to display the terminal background color underlying the emacs editor.

Comparison

the same file opened by emacsclient -nw -t (left) v.s. emacsclient -c (right)

Screen Shot

Error Message

When opening the file through emacsclient -nw -t /path/to/file, the emacs produces the following message:

Doom loaded 277 packages across 62 modules in 2.066s
Package cl is deprecated [2 times]
Updating buffer list...
Formats have changed, recompiling...done
Updating buffer list...done
ibuffer-projectile: groups set
Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help
Loading /Users/[hidden]/.emacs.d/.local/cache/recentf...done
Setting up indent for shell type zsh
Indentation variables are now local.
Indentation setup for shell type zsh
Analyzing the buffer...done
Guessing...done
Nothing to change
Note: sh-basic-offset, tab-width, evil-shift-width adjusted to 4
When done with a buffer, type C-x #
Invalid face attribute :background nil [7 times]

What confuses me is the last line:

Invalid face attribute :background nil [7 times]

Because I am under the impression that when bg (or bg-alt) is nil, it becomes transparent and display whatever color beneath it. But apparently, the file opened in the terminal has a background color of #21242b instead of being transparent.

Fixes Attempted

I tried both above but still can not tackle this problem.

hlissner commented 3 years ago

See https://gist.github.com/hlissner/8e667f71da070951b1569be0eceb6a89 for a solution. Sorry for the gist; this solution was pulled out of our Doom Emacs Discourse server (which hasn't been published yet).

This issue is a duplicate of hlissner/doom-emacs#3761 and is caused by using solaire-mode in a terminal frame spawned from the daemon.

jdelStrother commented 3 years ago

FWIW in case anyone else ends up here - The wiki advice says:

This advice only applies to Emacs 26.x. True color support is built into 27.1+ and newer.

but I was seeing blue backgrounds in emacsclient 27.1. After adding a 24bit terminfo and setting TERM=xterm-24bit, my emacsclient terminal colour are all fixed šŸ¤·ā€ā™‚ļø