As I asked here, I couldn't make it run Aquamacs/slime/clojure, but I could use Auqamacs/clojure with 'M-x conjure-mode', then C-c C-z (run clojure) and C-c C-e (run expression).
I don't have an experience with SLIME, but I feel that C-c C-z and C-c C-e is just enough for lisp/conjure REPL or debugging.
What features SLIME has more than these features? What people use SLIME for?
So, so, so much more.
M-. to go to a definition.
C-c C-k to compile the current buffer.
M-p & M-n to go forwards and backward in REPL history.
M-<tab> for completion.
A debugger. A wonderful REPL.
And so much more.
Slime gives so much: look at its manual.
It shouldn't be too hard to set up: this post is a great starting point.
Tab completion of java class members in addition to clojure functions and such.
Apart from what had already been said:
Highlighting errors, warnings and notes in source code buffers.
Inspector. An object viewer.
Paredit. Paredit adds comfort and ease to editing lisp code.
Macroexpansion.
Related
Is there a mode for Cider that will allow me to treat it like a REPL in ansi-term? That is, is there a way (like C-c C-j, C-c C-k in ansi-term) that lets me switch into treating it like a normal Emacs file vs. locked in place/using normal shell functionality (e.g. C-p for previous command)?
I'm Cider's maintainer. No, nothing like this exists. The REPL is implemented in a custom manner, without leveraging any standard Emacs machinery. We plan to reimplement it in terms of comint-mode, which would make a least some of the things you mentioned possible, but don't expect anything quite like ansi-term.
I would like to write julialang code in emacs. Is there an easy way to do it like, for example, when you do python code (all these reserved words in colors and indentation)?
Here is what I have done so far:
I created the file
~/.emacs.d/init.el
with the line (after cloning https://github.com/emacs-ess/ESS/wiki/Julia):
(load "/path-to-ESS/ESS/lisp/ess-site.el")
julia is in my path also. Still, emacs does not recognize julia code
I think that this may help. It seems to be emacs support for Julia.
emacs-ess / ESS
Julia
Overview
ESS support for julia language, among other things, includes
font-lock, indentation, sending code to sub-process, interactive
documentation, imenu, completion and eldoc.
Usage
Start
To start julia type M-x julia RET. You can start multiple julia
processes if you so desire.
To autostart or switch form script to julia subprocess use C-c C-z. To
switch from process buffer to the most recent script buffer also use
C-c C-z. To associate a buffer with a different julia process press
C-c C-s.
Evaluation
To send chunks of code from your script use C-c C-c, C-M-x, C-RET etc.
To load the whole file: C-c C-l. See evaluating code section in ESS
manual. (tip: look up the documentation string of these commands with
for example C-h k C-c C-c)
Help
To access documentation for any help topic or object use C-c C-d C-d.
To call apropos: C-c C-d C-a. To look up for a topic in julia standard
library reference: C-c C-d C-r. To look up a topic in the julia
manual: C-c C-d m. To search julia website: C-c C-d C-w.
To see all help commands defined in ess-doc-map: C-c C-d C-h. See Help
section in ESS documentation.
I am new to Emacs. I find it is powerful and very convenient IF one can master its set of commands. I also believe anyone can do this with patience, and the eagerness to learn and USE the software. However it will be much nicer for beginners, and seasonal users to have some command helper plugin that do following thing:
When the user start typing any CONTROL or META, COMMAND, or any special keys, a "ajax-like" or "smart search" window appear below or in the minibuffer showing help text like, for example: If I hold "CONTROL", command helper windows shows:
C-p Up one line
C-n Down one line
C-f Forward one character
C-b Backward one character
C-a Beginning of line
C-e End of line
C-x ...
Then if I continue to type "x" while holding "CONTROL", the window will update and show something like:
C-x C-a add-mode-abbrev
C-x C-b list-buffers
C-x C-c save-buffers-kill-emacs
C-x C-d list-directory
C-x C-e eval-last-sexp
C-x C-f find-file
C-x C-h inverse-add-mode-abbrev
C-x TAB indent-rigidly
C-x C-l downcase-region
C-x C-n set-goal-column
C-x C-o delete-blank-lines
I have tried googling it, but it doesn't seem exist yet. So I guess this is more a feature request for EMACS rather then a question. But it is great if somebody can write a plugin/module to do this.
I do not believe this is out there, but I also believe that it is not really needed. It would just clutter the screen, though, maybe for a rookie it might be indeed useful.
For now, you might consider printing a cheatsheet.
Do not lose hope, I learned it without any sort of help, the key is indeed to just use it often.
Also, there is quite a good logic behind it all, so if you read up the structure in a cheatsheet or anywhere else, then it might help you "guess" what is the right key combo sooner than later.
EDIT: I actually myself asked a similar question, at least the same functionality was required. I accepted an answer which apparently mentions that Icicles offers this functionality.
Also, one advise is that after you type the prefix key, e.g. C-c, typing C-h afterwards will show you the possible completions.
This leads me to the following:
I believe we could use code like:
"If last key is a prefix key, run C-h*, switch back to previous buffer and rehit the last prefix key"
*this is a general method, working even for my own poorly designed minor mode
I also don't know an existing package that would do that, but here's a couple of tips.
To get an overview of all available bindings, press C-h b. The displayed buffer looks fairly raw, because it includes all ways used to enter special characters (and they are usually at the top), but you can search it with C-s if you remember at least a part of the command name.
If you know the prefix (e.g. C-x) but don't remember what comes next, you can follow it with C-h instead (type C-x C-h). That will bring up a similar buffer that only contains bindings that start with the same prefix. It's one of the more obscure features, I think.
Speaking of "if I hold Ctrl", though, showing hints when you've just pressed Ctrl and nothing else if currently impossible to implement at the Lisp level. That would require some lower-level changes.
There are too many keybindings in emacs for this to be practically useful.
I agree with the other responses and just wanted to add that I found the built-in tutorial very useful for getting past the basics. You can reach the tutorial with C-h t.
You'll probably end up changing several of the default bindings, but learning them will help you find your way around new modes (assuming that they work in an "emacsy" way).
I come back to this be cause I found a perfect solution and can't live without it: The emacs-helm and which-key
Is it possible to view Clojure function documentation in Emacs? Namely, can I configure Emacs to lookup Clojure functions under the cursor?
I'm using clojure-mode and SLIME. Oddly, I can't even use apropos or dir in SLIME's repl, although they're automatically loaded by lein repl.
Try the function slime-describe-symbol, which is usually bound to C-c C-d d.
Place the point somewhere near the function name and hit C-c, then C-d, and then d.
There's also slime-describe-function, bound to C-c C-d f, but I rarely use it, as it's less general than the aforementioned symbol-related lookup function.
To see all the documentation-related functions, press C-c C-d C-h. These bindings are not specific to Clojure; they are instead defined by SLIME, and will work as well if not better for other Lisp dialects.
I find the combination of slime-apropos and eldoc minor mode (make sure you have swank-clojure 1.4.0 as it fixes both of those) better than the slime-describe-symbol/function commands mentioned above.
From SLIME REPL you can run (use 'clojure.repl). This will make functions like apropos and doc available
In Emacs I'm editing some source code, and I hit <tab>. Emacs indents the line to n spaces. I'd like to change the amount that indents for that kind of line. How do I figure out what rule emacs applied to indent that line by n spaces?
I want to change n, but I need to figure out which of the many indentation-related variables Emacs just used.
A generic answer is difficult. Some modes will make this more apparent than others, but in the general case (as they are free to implement indentation however they wish) I don't think you'll get away from needing to read some elisp.
Starting with the binding for TAB will work, but might be slightly time-consuming depending on how many layers of indirection are involved.
If you know that the major mode in question implements its own indentation, then one (non-rigorous, but fast) approach that you could try to help track down the functions being called is to use ELP, the built in elisp profiler. elp-instrument-package will instrument for profiling all functions with names matching the prefix string argument you specify. Therefore you might do something like the following in a PHP file (noting that php-mode tells you that it is derived from c-mode)
M-x elp-instrument-package RET php- RET
M-x elp-instrument-package RET c- RET
M-x elp-instrument-package RET indent RET
Now type TAB in your source code, and run M-x elp-results to see which of those instrumented functions were called.
At this point you're on your own -- look for the likely suspects, and see what the code is doing -- but it can be a handy way to filter the search.
Once you've finished, use M-x elp-restore-all to prevent any further profiling.
If you're using a mode based on cc-mode (e.g. c-mode, c++-mode, java-mode, etc.), you can hit C-c C-s and it'll tell you what syntactic category the line is. If you want to change it, hit C-c C-o and you'll be guided through the process. Check out the cc-mode docs on customization for more details: https://www.gnu.org/s/emacs/manual/html_node/ccmode/Customizing-Indentation.html
If you happen to enjoy getting your hands really dirty, there's always the elisp debugger to tell you just what Emacs is up to.
If you hit C-h k TAB you'll find the function that Emacs is running (e.g. indent-for-tab-command) then you can do M-x debug-on-entry RET indent-for-tab-command RET. Now whenever you hit TAB you'll pop up a debugger and can watch the execution step by step.
Depending on your taste for debugging, it's either a maddening or enlightening experience. Either way, don't forget to M-x cancel-debug-on-entry when you're done.