This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-08
Channels
- # announcements (11)
- # babashka (13)
- # beginners (11)
- # biff (2)
- # calva (17)
- # cider (19)
- # clojure (60)
- # clojure-berlin (1)
- # clojure-dev (20)
- # clojure-europe (48)
- # clojure-nl (1)
- # clojure-norway (98)
- # clojure-spec (7)
- # clojure-uk (5)
- # core-typed (32)
- # cursive (13)
- # datomic (12)
- # dev-tooling (5)
- # emacs (7)
- # figwheel-main (2)
- # graalvm (4)
- # hyperfiddle (4)
- # introduce-yourself (1)
- # malli (14)
- # missionary (32)
- # off-topic (7)
- # overtone (4)
- # pedestal (10)
- # proletarian (4)
- # re-frame (8)
- # releases (11)
- # tools-build (1)
- # tools-deps (4)
- # xtdb (38)
I was trying to configure how *cider-log*
is displayed by configuring display-buffer-alist
, but my configuration did not seem to have an effect. Is it because cider-log.el
uses switch-to-buffer-other-window
to always open a window for the log?
my attempt was
(add-to-list
'display-buffer-alist
'("\\*cider-log\\*" (display-buffer-reuse-window display-buffer-same-window)))
I did try setting switch-to-buffer-obey-display-actions
but that did not seem to help.
If I redefine cider-log--switch-to-buffer
with my own variant, where switch-to-buffer-other-window
is replaced with display-buffer
then it works as I expected. But on the other hand I know almost nothing about elisp so maybe I'm just doing something wrong.
I have
(add-to-list 'special-display-buffer-names '("*cider-log*" vemv.completions/split-window-vertically-small))
and it has worked reliably.
I use special-display-buffer-names
out of habit (it's a deprecated var / mechanism - display-buffer-alist
is more modern).
Maybe you can give it a quick try in case it helps for the time being> If I redefine cider-log--switch-to-buffer
with my own variant, where switch-to-buffer-other-window
is replaced with display-buffer
then it works as I expected.
Yeah maybe my setup works because it does something different.
It would seem plausible that display-buffer
is more flexible than switch-to-buffer-other-window
, so we'd be open to a PR in that direction
mkay. Adding *cider-log*
to special-display-buffer-names
causes the buffer to open in separate frame entirely
In my example,
vemv.completions/split-window-vertically-small
is a defun that receives a buffer
- one can do whatever with it
I have no idea about what's the preferred way to do stuff in emacs, but https://www.masteringemacs.org/article/demystifying-emacs-window-manager is quite adamant that libraries shouldn't use switch-to-buffer
and I guess that might apply to switch-to-buffer-other-window
.
> I find that some packages and functions disregard all rhyme and reason and use switch-to-buffer
instead of display-buffer
when they want to show a buffer to the user.
> This is wrong. And the net result is that your display rules won’t apply if this variable is not set to t
.
haha, I can barely manage writing my emacs config, it'll be a while before I'm brave enought to even dare thinking about opening a elisp PR 🙂
great, thanks. but no hurry, I'm sure there's more important stuff than this to work on
In any case, the new logging functionality seems to work quite nicely, at least once I learn how to use logview
better
I've enjoyed it across a couple commercial projects by now, total game changer.
I use timbre/with-context+
a lot now, those contexts end up accessible in the Inspector which one can easily pop up by hitting RET on a log entry
yeah, logging context stuff can be quite nice when debugging
does the cider+logview support filtering by context btw? Like if some log item has {:user 123 ...}
can I then somehow apply a filter to show only those lines?
Logjam (the JVM lib underpinning this stuff) says:
* `exceptions`
* `level`
* `pattern`
* `start-time`
* `end-time`
* `threads`
* `loggers-allowlist`
* `loggers-blocklist
`
So no, it's not there at the moment. Could be an interesting feature indeed!
tbh, normally I use the logging with "one interaction at a time" (one req/res cycle, one deftest, etc) so I don't need a lot of filtering, but yeah I could see it being useful
You can create an issue https://github.com/clojure-emacs/logjam if you'd see yourself using it all the time.