Fork me on GitHub
#emacs
<
2020-04-13
>
bherrmann23:04:37

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)

bherrmann23:04:41

I must have typed M-x clojure-mode - like 20 times today

andy.fingerhut23:04:37

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))

andy.fingerhut23:04:53

Probably (setq auto-mode-alist (cons '("\\.bb$" . clojure-mode) auto-mode-alist))

andy.fingerhut23:04:41

That will do it for the file name. I do not know how to make Emacs recognize the shebang line

andy.fingerhut23:04:31

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.

dpsutton23:04:59

@bherrmann are you using inf-clojure ? I’m working on rewriting it so hopefully it gets much better across all the different repl types

👀 4
bozhidar10:04:23

Glad to hear this! We haven’t been able to give it enough love recently. What are you planning to tackle there exactly?

dpsutton13:04:13

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

dpsutton13:04:07

The defcustoms were all over the place

bozhidar13:04:31

Yeah, it’s definitely not my finest work. 😄

bozhidar13:04:35

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.

bozhidar13:04:41

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.

didibus22:04:15

Cool, didn't know that. Love Emacs haha

bherrmann23:04:56

I'm just using vanialla emacs (with cider installed) with a .emacs that I've dragged along with me for like 30 years.

dpsutton23:04:37

So no connected repl running bb?

bherrmann23:04:06

 (setq auto-mode-alist (cons '("\\.bb$" . clojure-mode) auto-mode-alist))
this fixes the .bb file loading

bherrmann23:04:03

I'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...

bherrmann23:04:35

This seems to put emacs in the right mode....

#!/usr/bin/env bb

;; Local Variables:
;; mode: clojure
;; End:

👍 12