Is there a way to display the current namespace instead of the filename in the bottom of a Clojure buffer?
Thanks a lot. Will try it!
The Spacemacs Madeline is very customisable and there are several themes and you can also create your own custom mode line https://github.com/syl20bnr/spacemacs/blob/develop/doc/DOCUMENTATION.org#mode-line I assume you would need to write a function to get the current namespace and add a hook to call it when ever you open or switch to a buffer, then update the mode line. There are scripts like the battery indicator that might give you clues. Not something I would personally invest the time in as the namespace partly made from the file name anyway.
I am wondering why the clojure mode doesn’t dispayl the current namespace in modeline. It seems to me like a basic need.
I don't understand why it would be considered a basic need, can you elaborate?
When I switch to a buffer, I’d like to know what buffer I am in.
Currently only the short buffer name is displayed (e.g. core.clj
) which is sometimes not enough to get the context
Edit: short answer: try the doom
modeline theme, update .spacemacs with:
dotspacemacs-mode-line-theme '(doom)
Original long answer...
I believe there are options to configure how much of the path is shown and different mode-line themes have different defaults. I assume showing more of the path would be less work for you to configure than writing a function that extracts the Clojure namespace of a file open in a buffer.
If its a nested namespace then yes more context could be useful, although I am wondering how much of the namespace would need to be shown in order to be useful. There is only a limited amount of space on the mode line and it would not be as useful as simply jumping to the top of the buffer and back again. Having the full project path should give you as much context as the actual namespace (as they should be the same, baring a - and _ difference.
I guess I don't rely on the mode line in Emacs that much, the file name is more than sufficient for me or using g g
to jump to the top of the buffer and look at the ns
declaration, which would provide much greater context as it shows the interned namespaces and functions, so far more than could be shown in the mode-line.
I avoid core
as a namespace, although that does give sufficient meaning to me as it should be the main entry into the project. The file name is next to the project name, as I use a workspace for each project. The REPL connection also has the project name too, so I wouldnt need any other information if I had core.clj
name in the prompt.
I have been using more meaningful namespace names especially now I use deps.edn and clj-new
, rather than use Leiningnen to generate projects.
Thanks for the info about doom-modeline I’ll give it a try