Doom-emacs: Emacsclient TTY crashes when :os tty enabled

Created on 26 Aug 2020  路  8Comments  路  Source: hlissner/doom-emacs

What did you expect to happen?
When the :os tty module is enabled and emacs is running as a daemon, I would expect the tty emacsclient to open in the current terminal when emacsclient --tty is run.

What actually happened?
The emacsclient tty frame opens and then immediately closes again. The daemon is still running and no messages are seen in *Messages*.

A graphical frame connects to the daemon and loads fine.

The following is the output from view-echo-area-messages:

Loading /usr/share/emacs/site-lisp/site-start.d/asy-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/autoconf-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/desktop-entry-mode-init.el (source)...done
tree-sitter-langs: Grammar bundle v0.5.0 was already installed; skipped
Starting Emacs daemon.
Doom loaded 233 packages across 46 modules in 1.996s
Invalid face attribute :family nil
Invalid face attribute :height nil
When done with this frame, type SPC q f

This does not occur with the :os tty module disabled.

Steps to reproduce:

  1. Launch an emacs daemon through emacs --daemon or the systemd user unit with the :os tty module enabled.
  2. Attempt to connect to a tty client frame through emacsclient -t somefile
  3. Observe the flash of an emacs tty frame opening and immediately closing.

System information:

SYSTEM  type       gnu/linux
        config     x86_64-redhat-linux-gnu
        shell      /bin/zsh
        uname      Linux 5.8.0-1.fc33.x86_64 #1 SMP Mon Aug 3 16:15:24 UTC 2020 x86_64
        path       (~/.cache/pypoetry/virtualenvs/dotfiles-myD4R_z1-py3.8/bin/ ~/.pyenv/shims/ ~/.cargo/bin/ ~/.poetry/bin/ ~/.local/bin/ ~/.pyenv/bin/ ~/.config/emacs/bin/ ~/bin/ /usr/local/bin/ /usr/local/sbin/ /usr/bin/ /usr/sbin/ ~/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zpm-zsh-SLASH-colorize/bin/)
EMACS   dir        ~/dotfiles/doom/emacs/
        version    27.1
        build      Aug 18, 2020
        buildopts  --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3 --with-gpm=no --with-xwidgets --with-modules --with-harfbuzz --with-cairo --with-json build_alias=x86_64-redhat-linux-gnu host_alias=x86_64-redhat-linux-gnu CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' LDFLAGS=-Wl,-z,relro PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig
        features   XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER GMP
        traits     (daemon server-running envvar-file)
DOOM    dir        ~/dotfiles/doom/doom/
        version    2.0.9
        build      HEAD -> develop 1c99aed0c 2020-08-25 21:22:56 -0400
        elc-files  0
        modules    (:completion company (ivy +icons +fuzzy +prescient) :ui doom doom-dashboard hl-todo ligatures minimap modeline nav-flash ophints (popup +defaults) treemacs vc-gutter vi-tilde-fringe window-select workspaces zen :editor (evil +everywhere) file-templates fold format snippets :emacs (dired +icons) electric (undo +tree) vc :term vterm :checkers syntax (spell +hunspell +flyspell) :tools direnv (eval +overlay) lookup (lsp +peek) (magit +forge) pdf :os tty :lang data emacs-lisp (json +lsp) (latex +latexmk +lsp +cdlatex) markdown (org +dragndrop +jupyter +pandoc +pretty) (python +lsp +pyright +poetry) (sh +lsp +fish) (yaml +lsp) :config (default +bindings +smartparens))
        packages   ((lorem-ipsum) (yasnippet-snippets) (magit-delta) (sublime-themes) (soothe-theme) (darktooth-theme) (grayscale-theme) (zenburn-theme) (kaolin-themes) (smart-mode-line) (modus-operandi-theme) (modus-vivendi-theme) (solaire-mode :disable t) (vimrc-mode) (systemd) (imenu-list) (atomic-chrome) (tree-sitter :recipe (:host github :repo ubolonton/emacs-tree-sitter :files (lisp/*.el))) (tree-sitter-langs :recipe (:host github :repo ubolonton/emacs-tree-sitter :files (langs/*.el langs/queries))))
        unpin      (n/a)
        elpa       (n/a)

:os tty external redaemon retty resolved

Most helpful comment

It's an upstream issue with evil-terminal-cursor-changer. The problem and the solution, but since the package has been abandoned, it's unlikely the PR will be merged, so we've switched to the PR repo.

With 43e3e4c this should be resolved. Let me know if that isn't the case and I'll reopen it. Thanks for bringing it to my attention!

All 8 comments

I also experience this on MacOS, though I can typically repeat my emacsclient invocation and it works successfully on the next attempt. @smsegal has done a better job of digging than I. My Emacs 27.1 is installed via Nix and emacs-overlay.

SYSTEM  type       darwin
        config     x86_64-apple-darwin18.7.0
        shell      /bin/sh
        uname      Darwin 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 18 20:50:10 PDT 2020; root:xnu-4903.278.43~1/RELEASE_X86_64 x86_64
        path       (~/.emacs.d/bin/ ~/src/not_me/elixir-ls/release ~/.nix-profile/bin ~/.emacs.d/bin ~/.cargo/bin ~/.asdf/shims ~/.asdf/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/X11/bin /nix/store/lv63r48x1byympm31d5ix3yha3virk41-python-2.7.18/bin /nix/store/3d72fh2gn3f0sp6dy3clsivppxi6dqsx-tmuxp-1.5.4/bin /nix/store/5r7a42bxvhi4h9y4cy7pn6rd5nzipcmj-python2.7-kaptan-0.5.12/bin /run/current-system/sw/bin /nix/var/nix/profiles/default/bin /nix/store/ilvbidskjkkg6fzpl0hmzml4m5z8c88l-emacs-unstable-emacs-27.1/libexec/emacs/27.1/x86_64-apple-darwin18.7.0/)
EMACS   dir        ~/.emacs.d/
        version    27.1
        build      Aug 26, 2020
        buildopts  --prefix=/nix/store/ilvbidskjkkg6fzpl0hmzml4m5z8c88l-emacs-unstable-emacs-27.1 --disable-build-details --with-modules --with-ns --disable-ns-self-contained CFLAGS=-DMAC_OS_X_VERSION_MAX_ALLOWED=101200
        features   RSVG GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS JSON PDUMPER GMP
        traits     (daemon server-running envvar-file)
DOOM    dir        ~/.config/doom/
        version    2.0.9
        build      HEAD -> develop 1c99aed0c 2020-08-25 21:22:56 -0400
        elc-files  0
        modules    (:completion company (ivy +prescient) :ui deft doom hl-todo hydra modeline nav-flash ophints (popup +defaults) treemacs vc-gutter vi-tilde-fringe window-select workspaces zen :editor (evil +everywhere) file-templates fold (format +onsave) multiple-cursors rotate-text snippets word-wrap :emacs dired electric ibuffer undo vc :term eshell shell term :checkers syntax :tools direnv docker (eval +overlay) gist (lookup +docsets) lsp (magit +forge) make pdf prodigy terraform tmux :os macos tty :lang data (elixir +lsp) emacs-lisp erlang json latex markdown nix (org +brain +dragndrop +gnuplot +hugo +journal +noter +pandoc +pomodoro +present +roam) plantuml rest ruby (rust +lsp) (sh +fish) web yaml :app calendar :config (default +bindings +smartparens))
        packages   ((alchemist :disable t) (doct :recipe (:host github :repo progfolio/doct :branch master) :pin 82387b252b) (jsonnet-mode :disable t) (org-drill :pin 4c114489e6) (org-graph-view :recipe (:host github :repo alphapapa/org-graph-view :branch wip) :pin 13314338d7))
        unpin      (n/a)
        elpa       (n/a)

I experienced the same issue. Hope it will be fixed soon

Is this still an issue on the latest Doom? I cannot reproduce it on 27.1 or 28 (gccEmacs)

Please try changing your theme (perhaps to doom-one or doom-dracula). It is possible those face errors are causing this.

When I was experiencing this, I traced it back to evil-terminal-cursor-changer via "config bisection" and disabled that via my packages.el. I haven't experienced it since, but I can try removing that code and see if it's still there.

Edit: Doesn't seem to be happening any longer on the machine I'm currently on, but I've changed so many variables since late August that it's almost meaningless - MacOS -> NixOS, gccEmacs, etc.

Understood. I'll assume the issue has been resolved upstream, somewhere, and close this for the time being. Thanks for letting me know!

This is still a problem in a fresh install of Doom Emacs.

  1. Removed my .doom.d
  2. Generated a new one.
  3. Enable tty in init.el
  4. Refresh with doom sync
  5. Open emacs, open terminal, and then write emacsclient --tty <file>
  6. Still doesn't work. Instantly closes down.

All it says in Messages is:
[persp-mode] Warning: Can not restore the window configuration, because of the error -- (error Window #<window 6 on *doom*> too small to accommodate state) [1] main | Deleted '#1' workspace

System: Arch Linux, Emacs 27 (installed through the Arch repos)
WM: i3-gaps
Theme: doom-one when fresh install otherwise doom-dracula on main

It's an upstream issue with evil-terminal-cursor-changer. The problem and the solution, but since the package has been abandoned, it's unlikely the PR will be merged, so we've switched to the PR repo.

With 43e3e4c this should be resolved. Let me know if that isn't the case and I'll reopen it. Thanks for bringing it to my attention!

Can confirm it's fixed for me! Thanks @hlissner.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

governorgoat picture governorgoat  路  3Comments

idoo picture idoo  路  3Comments

driftcrow picture driftcrow  路  3Comments

Vvkmnn picture Vvkmnn  路  3Comments

nasoundead picture nasoundead  路  3Comments