-
-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate or change default setting for cider-auto-mode
#3346
Comments
This sounds good to me. Anyway, could you please exhaustively list the problems caused by this var? It's useful to have that info at hand. |
Btw, it might be a good idea to make this a bit smarter, even if it's no longer the default - e.g. to check if |
|
That's a fair question. 😆 Oh, well... At the very least this should be guarded by |
That function is called unconditionally, regardless of cider-auto-mode. Right?
WDTY of #3346 (comment) ? I also feel that going that route (making things smarter here and there) would also be a sufficient, non-breaking change. |
Yeah, making the I still think the default setting should still be Of course that's just my opinion and it's up to the maintainers to weigh the benefits of a breaking change ⚖️ |
In general we try to avoid breaking changes. We had #2960 From what I've seen we're not dogmatic about it, but the less they happen, the more we will reinforce good habits. |
For reference: my proposed change to the user manual in #3355, after changing the default value to nil: -== Disable Automatic cider-mode in clojure-mode Buffers
+== Enable CIDER in clojure-mode buffers
-By default, CIDER enables `cider-mode` in all `clojure-mode` buffers
-after it establishes the first CIDER connection. It will also add a
-`clojure-mode` hook to enable `cider-mode` on newly-created `clojure-mode`
-buffers. You can override this behavior, however:
+The main entry point for CIDER is `cider-mode`, an Emacs https://www.gnu.org/software/emacs/manual/html_node/emacs/Minor-Modes.html[minor mode]
+which enables its key bindings, dynamic syntax highlighting, and code navigation tools, among many other features.
+
+You'll most likely want to use it together with the major mode https://github.com/clojure-emacs/clojure-mode/[clojure-mode], by adding the following to your Emacs config:
[source,lisp]
----
-(setq cider-auto-mode nil)
+(add-hook 'clojure-mode-hook #'cider-mode)
----
+This causes `cider-mode` to be automatically enabled on all `clojure-mode` buffers,
+as well as its derived modes like `clojurescript-mode`.
+
+TIP: Many Emacs starter kits like Spacemacs and Prelude come with this already pre-configured.
+You can also toggle CIDER in any buffer with the command kbd:[M-x cider-mode].
+
+NOTE: Previous versions of CIDER enabled the option `cider-auto-mode` by default,
+which automatically enabled `cider-mode` in all `clojure-mode` buffers after
+establishing the first CIDER connection, added itself to `clojure-mode-hook`,
+and disabled `cider-mode` on all buffers after the last connection was closed.
+
+The default setting for this option was changed in Cider 1.8, and we recommend
+that most users explicitly configure mode hooks per the above snippet. |
Context from #3343:
The default
t
setting forcider-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
andcider-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
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
The text was updated successfully, but these errors were encountered: