This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-16
Channels
- # announcements (62)
- # babashka (12)
- # babashka-sci-dev (73)
- # beginners (16)
- # biff (10)
- # calva (65)
- # cider (13)
- # clerk (8)
- # clojure (31)
- # clojure-europe (16)
- # clojure-nl (1)
- # clojure-norway (19)
- # clojure-spec (24)
- # clojure-uk (5)
- # clojuredesign-podcast (18)
- # clojurescript (18)
- # dev-tooling (2)
- # emacs (30)
- # etaoin (4)
- # gratitude (3)
- # hyperfiddle (20)
- # integrant (2)
- # jobs (4)
- # kaocha (7)
- # malli (1)
- # observability (11)
- # off-topic (11)
- # pathom (12)
- # podcasts-discuss (7)
- # portal (12)
- # quil (3)
- # re-frame (6)
- # releases (1)
- # sql (22)
- # squint (5)
- # testing (79)
- # tools-deps (3)
- # xtdb (20)
Anyway knows an ideal way of opening a file with emacsclient, evaluating some sexprs once it's loaded as provided in advance from the CLI?
It works to emacsclient foo.clj
in an iTerm tab and then emacsclient --eval "(cider-connect-clj)"
in another tab - this way you can effectively script the already-open emacsclient.
A cheap approach is, from a script, to open the file first, and in the background, wait 1.5 seconds and then perform the eval. But it's not ideal 🙂
Possible approach: dump the instructions to a file with a special extension (e.g. .lisp_eval
), create a mode for it which simply evals its contents when it's open
can you construct it something like
emacsclient -c -nw -e '(progn (find-file "foo.clj") (cider-connect-clj))'
? Maybe with a shell function? I have this in my zshrc
:
emacs-pipe() {
local TMP;
if [[ "$1" == "-" ]]; then
TMP="$(mktemp /tmp/emacsstdinXXX)";
cat >"$TMP";
if ! emacsclient -s ${EMACS_SOCKET_NAME} --alternate-editor /usr/bin/false --create-frame --tty --eval "(let ((b (create-file-buffer \"*stdin*\"))) (switch-to-buffer b) (insert-file-contents \"${TMP}\") (delete-file \"${TMP}\"))" \
> /dev/null 2>&1; then
# emacs --eval "(let ((b (create-file-buffer \"*stdin*\"))) (switch-to-buffer b) (insert-file-contents \"${TMP}\") (delete-file \"${TMP}\"))" &
fi;
else
emacsclient -s ${EMACS_SOCKET_NAME} --alternate-editor /usr/bin/false --create-frame --tty --no-wait "$@" > /dev/null 2>&1 &
fi;
}
zle -N emacs-pipe
which might contain enough hacks?did you get this sorted? https://www.masteringemacs.org/article/fuzzy-finding-emacs-instead-of-fzf ... this might have more ideas?
I tried the first approach you laid out but it didn't appear to work - emacs opened for a glimpse, then closed. will check the other one + the article soon!
weird ... when I run this emacsclient -s ${EMACS_SOCKET_NAME} -c -nw -e '(progn (find-file "src/scratch.clj") (cider-connect-clj))'
I get this
I'm running GNU Emacs 28.3 (build 1, x86_64-redhat-linux-gnu, X toolkit, cairo version 1.17.8, Xaw3d scroll bars) of 2023-09-24
huh .... no, it doesn't ... it's not because it's in a function, it works if I've already connected to cider and I'm connecting a new repl, but not if it's connecting for the first time
function thnig { emacsclient -s ${EMACS_SOCKET_NAME} --alternate-editor /usr/bin/false --create-frame --tty --eval "(progn (find-file \"$1\") (ignore-errors (cider-connect-clj)) )" }
thnig src/scratch.clj
works on my machineAt some point, Cider (I presume) has started to put application error log messages to the minibuffer. How can I turn this off? It is very noisy
I had a similar report but it didn't provide further details. It's not the intended behavior, certainly. What logging solution do you use?
We are using taoensso timbre. Moment, I have to scrub some sensitive things from the screenshot
yeah, I noticed this too with timbre + midje tests
This is what it looks like in the minibuffer. The minibuffer keeps resizing too
Not sure if tests trigger this, but at the moment there are no tests running and that happens.
I restart the repl and try to get it to log an error and see if it happens without running tests
for what it's worth we aren't using midje
Fully fixed and available on MELPA https://github.com/clojure-emacs/cider/releases/tag/v1.13.1
Nice! Thank you @U45T93RA6!