fix(cli): "Unknown terminal type" error on bin/org-capture

Fix: #5438
This commit is contained in:
Henrik Lissner 2021-11-24 22:03:21 +01:00
parent 9dad26961a
commit 2f39d3fced
2 changed files with 9 additions and 14 deletions

View file

@ -14,10 +14,10 @@ cleanup() {
} }
# If emacs isn't running, we start a temporary daemon, solely for this window. # If emacs isn't running, we start a temporary daemon, solely for this window.
if ! emacsclient --suppress-output --eval nil; then if ! emacsclient --suppress-output --eval nil 2>/dev/null; then
echo "No Emacs daemon/server is available! Starting one..."
emacs --daemon emacs --daemon
trap cleanup EXIT INT TERM trap cleanup EXIT INT TERM
daemon=1
fi fi
# org-capture key mapped to argument flags # org-capture key mapped to argument flags
@ -37,13 +37,7 @@ esac
# Fix incompatible terminals that cause odd 'not a valid terminal' errors # Fix incompatible terminals that cause odd 'not a valid terminal' errors
[ "$TERM" = "alacritty" ] && export TERM=xterm-256color [ "$TERM" = "alacritty" ] && export TERM=xterm-256color
if [ $daemon ]; then # Non-daemon servers flicker a lot if frames are created from terminal, so we do
emacsclient -a "" \ # it internally instead.
-c -F '((name . "doom-capture") (width . 70) (height . 25) (transient . t))' \ emacsclient -a "" \
-e "(+org-capture/open-frame \"$str\" ${key:-nil})" -e "(+org-capture/open-frame \"$str\" ${key:-nil})"
else
# Non-daemon servers flicker a lot if frames are created from terminal, so we
# do it internally instead.
emacsclient -a "" \
-e "(+org-capture/open-frame \"$str\" ${key:-nil})"
fi

View file

@ -15,8 +15,9 @@
(width . 70) (width . 70)
(height . 25) (height . 25)
(transient . t) (transient . t)
,(when (and IS-LINUX (not (getenv "DISPLAY"))) ,@(when IS-LINUX
`(display . ":0")) `((window-system . ,(if (boundp 'pgtk-initialized) 'pgtk 'x))
(display . ,(or (getenv "DISPLAY") ":0"))))
,(if IS-MAC '(menu-bar-lines . 1))) ,(if IS-MAC '(menu-bar-lines . 1)))
"TODO") "TODO")