How do I tell emacs that if the file starts with "#!/usr/bin/env bb" then it should use "clojure-mode" ? (or if the file ends in .bb)
I must have typed M-x clojure-mode - like 20 times today
Something like this, but with a couple of tweaks, in your ~/.emacs.d/init.el should do it: (setq auto-mode-alist (cons '("\\.c$" . c++-mode) auto-mode-alist))
Probably (setq auto-mode-alist (cons '("\\.bb$" . clojure-mode) auto-mode-alist))
That will do it for the file name. I do not know how to make Emacs recognize the shebang line
There are Emacs-specific comment lines with special syntax inside the comments that Emacs recognizes for setting mode and any other local Emacs variables you want.
@bherrmann are you using inf-clojure ? I’m working on rewriting it so hopefully it gets much better across all the different repl types
Glad to hear this! We haven’t been able to give it enough love recently. What are you planning to tackle there exactly?
I’ve almost got a draft up. I’m wanting to be able to see which capabilities each repl type has and make it easy to ensure that it works for whatever repl is being used
The defcustoms were all over the place
Yeah, it’s definitely not my finest work. 😄
I think somewhere I had suggested to have the expressions for each REPL type in some maps to avoid the crazy amount of vars we have for them now.
Probably adding some minimal support for prepl would be nice - we already have support for the socket repl and prepl is the same, but with structured output, which now is easy to parse with parseedn
.
ah yes!
Here are Emacs docs on setting local variables inside of specially formatted comments: https://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html#Specifying-File-Variables
Cool, didn't know that. Love Emacs haha
I'm just using vanialla emacs (with cider installed) with a .emacs that I've dragged along with me for like 30 years.
So no connected repl running bb?
(setq auto-mode-alist (cons '("\\.bb$" . clojure-mode) auto-mode-alist))
this fixes the .bb file loadingI've used cider-connect with bb, but only a little yesterday.... typically... I have a terminal where I do the running, and emacs where I do the editing.... I'm aware of the productivity gains from only evaling in emacs... but I'm new to bb... so I'm keeping it where I can watch it closely...
This seems to put emacs in the right mode....
#!/usr/bin/env bb
;; Local Variables:
;; mode: clojure
;; End: