cider icon indicating copy to clipboard operation
cider copied to clipboard

Deprecate or change default setting for `cider-auto-mode`

Open yuhan0 opened this issue 1 year ago • 8 comments

Context from #3343:

About cider-enable-on-all-existing-clojure-buffers, I'm unconvinced why this function exists at all? Cider users should already have it added to their clojure-mode-hook, otherwise it seems intrusive to automatically add it and force Cider on all other buffers, even ignoring the performance issues. I also found in my local copy of Cider that I had commented out cider-possibly-disable-on-existing-clojure-buffers a few years ago for some reason, I think due to unexpected behaviour on repl disconnect.

That's mostly for the benefit of people who are using both CIDER and inf-clojure, as them enabling them the minor modes in clojure-mode-hook would create some issues with conflicting functionality. So, it was basically some shortcut to prevent them from doing a bit of manual work. Not sure how many people rely on this - at any rate I'm not attached to this functionality at all and I'm open to rethinking/removing it.

The default t setting for cider-auto-mode causes performance and other issues detailed in the above issue, and only benefits a (presumably small) subset of Cider users with workflows involving inf-clojure and not adding cider-mode to their major mode hooks before until the first Cider-initiated connection.

I suggest the default config should at least be changed to nil, solving the downsides for most users. Users of inf-clojure can re-enable it in their own configs if needed. If the feature is deprecated or removed entirely, it is also relatively simple to implement in one's own config, adding custom functions to cider-connected-hook and cider-disconnected-hook.

Possible issues:

New and inexperienced users of Emacs/Cider might unknowingly depend on this behaviour, manually calling M-x cider-mode in a clojure buffer the first time they start Emacs, jacking in and then magically not having to do it in subsequent buffers. (Perhaps treating it like some sort of global minor mode)

I think the docs should encourage the usual Emacs convention of adding minor modes to a major mode hook, instead of supporting incorrect mindsets or habits which may cause future confusion for users.

https://docs.cider.mx/cider/config/basic_config.html#disable-automatic-cider-mode-in-clojure-mode-buffers

Environment & Version information

CIDER version information

;; CIDER 1.7.0 (Côte d'Azur), nREPL 1.0.0
;; Clojure 1.11.1, Java 20

Lein / Clojure CLI version

Clojure CLI version 1.11.1.1273

Emacs version

GNU Emacs 29.0.90

Operating system

macOS 12.5.1

JDK distribution

Temurin jdk-20.0.1+9

yuhan0 avatar May 19 '23 13:05 yuhan0