how to use clojure session in org mode? - emacs

I wrote this org document to learn about literate programming w/ org mode. I like it, but w/o a session the development experience is subpar.
org-babel-initiate-session yields No org-babel-initate-session for clojure!. But because I can execute the code blocks for output I believe my setup is correct.
How do I get a clojure session going?

Related

How to use Emacs as multiple IDEs with EVIL running in them all

Im just starting to look into Emacs as a IDE. There are lots of articles about how to setup Emacs as an IDE for languages XYZ. Most of these articles talk about how to switch content in your emacs.d. However this would only work if you use Emacs for one language?
Say for example I want to use Emacs with Clojue, Javascript and Python. For Clojure i want to use LiveMode and for Javascript i want to use some other mode and the same for Python. All highly specialized with a background repl running. How would I go about setting emacs up for this and what if I would like to use for example EVIL mode on all the IDE:s? Would it be possible to switch IDE setup at runtime depending on file ending or do i have to restart Emacs loading different settings each time?
Emacs allows to use so-called modes with files, e.g. python-mode for Python files etc. Automated enabling of modes for a specific file is either happening through file-local special variables or via associations of file-types via auto-mode-alist.
Modes actually provide these "special" settings you are talking about. If you want to add a special additional behavior in some mode, you typically add the required setup functions in the so-called mode-hook.
It might happen you run into incompatibilities between various extensions or modes, but this is a pretty rare case.

Emacs django-mode does not detect virtualenv

I am new to emacs, but I know how to navigate the basics.
I simply want Django integration with emacs 24 on ubuntu.
Django-mode seems to be the only game in town, but is there a tutorial that is written with more complete steps? A typical use case would be someone who is not an expert in emacs, but wants to add Django support to emacs.
I have virtualenv and virtualenvwrapper all set up properly. But django-mode is not detecting my virtualenv no matter what I do.
I have a great deal of trouble with the quoted paragraph below on Directory local variables as the documentation is poorly written.
Is this file .dir-locals.el optional? Many of his explanations are confusing. Do I need iPython? I would think not, but I'm guessing the python-shell-interpreter is not optional.
I have made a .dir-locals.el file and added my virtualenv path, but django-mode is not detecting my virtualenv. In emacs it says: virtualenv none.
There are also screenshots of a menu bar that allows alot of neat stuff like running ./manage.py collectstatic, etc....but no mention of how to activate the menu. Maybe this is a basic emacs command but I don't know it and would appreciate it if someone could show me how to set up emacs with django.
Are there any other alternatives or is django mode the way to go? Did I miss a huge chunk of documentation (like is it hiding inside emacs)
Thanks!
Directory Local variables Now we have all set there's a really
important topic to talk about and that's Directory Local Variables.
python.el is directory local variables aware and is in favor of
directory based configurations, that's why understanding this topic is
that important. So I suggest you to read the relevant part of the
manual with M-: (info "(emacs)Directory Variables").
The .dir-locals.el is a file which contains an Association List, but
don't let the name scare you, the following is a quite complete
example of what I'm using to open the current project.
((python-mode (python-shell-interpreter . "python")
(python-shell-interpreter-args .
"/home/fgallina/Code/Projects/anue-site/anue/manage.py shell")
(python-shell-prompt-regexp . "In \[[0-9]+\]: ")
(python-shell-prompt-output-regexp . "Out\[[0-9]+\]: ")
(python-shell-completion-setup-code . "from IPython.core.completerlib
import module_completion")
(python-shell-completion-module-string-code .
"';'.join(module_completion('''%s'''))\n")
(python-shell-completion-string-code .
"';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
(python-shell-extra-pythonpaths
"/home/fgallina/Code/Projects/anue-site/anue/apps/")
(python-shell-virtualenv-path . "/home/fgallina/.virtualenvs/anue")))
http://from-the-cloud.com/en/emacs/2013/01/28_emacs-as-a-django-ide-with-python-djangoel.html
There was recent a question at Help-gnu-emacs#gnu.org whose answers pertains to your case also
http://lists.gnu.org/archive/html/help-gnu-emacs/2013-06/msg00425.html
WRT this answer only replace Pymacs by django-mode.
For the moment, just use Emacs as editor. Otherwise see some risk to end up in frustration.
IPython is great to learn Python itself, basically it provides an enhanced interactive shell. On IPython is built Enthought -- a Python Distribution providing scientists with a comprehensive set of tools to perform rigorous data analysis and visualization.
Don't see it related to Django so far.

Can I run clj file directly on emacs?

I'm using clojure-box on windows.
Because the Emacs is totally new thing for me, I got some trouble with using it.
Can I save the real code(without user>> and result, etc) from Emacs? it seems C-x C-s oversave many things..
how can I run the .clj script directly on Emacs? I'm from python so the way Idle running script is wonderful
(just press F5, then script is excuted, then continue the REPL with having variables, functions in the script)
Is there anyway to do thing easy like that?
yes! emacs has several ways to do this. check out the emacs starter kit
People tend not to save the REPL as a whole.It is more common to paste parts of it into a normal Clojure buffer and then hit control-c control-l to load the buffer into the REPL. This keeps the REPL in synk with the file/buffer and will also print any output your script generates.
there is much more to using emacs with Clojure than I can express in one answer though the emacs starter kit is, well, a good place to start.

Add/edit functions of Emacs Editor

I need to implement some new functions on an editor. I picked Emacs - although my main programming knowledge is in Java and C - and I want to add some functions and edit some existing functions of Emacs Editor. I looked at the source code of it and I'm a bit lost. I was wondering whether anyone can give me some advice about where to start and whether there are any tutorials that can help?
P.S. One specific question would be how one can start to write a new mode with all new features and behaviour? or how I can disable some basic functions like copy/paste?
Cheers
An Introduction to Programming in Emacs Lisp http://www.gnu.org/software/emacs/emacs-lisp-intro/ or type in emacs:
M-: (info "(eintr)Top") RET
Emacs Lisp Manual http://www.gnu.org/software/emacs/manual/elisp.html or type in emacs:
M-: (info "(elisp)Top") RET
There are some tutorials out there specifically geared towards writing a major mode.
emacs extension guide [pdf]
how to write a major mode...
Other than that, writing modes in Emacs is just writing Lisp functions.
One thing I will note is that what you're proposing to do here may be pointless; if you implement a permission system as a major mode, a user can simply switch modes to turn it off. That's fine if the point of this permission system is to avoid clobbering edits (in which case I assume your users will cooperate with your aims). If you're expecting your users to be adversarial, then Emacs is the wrong tool for this.
Here is the manual section on defining major and minor modes:
C-hig (elisp) Modes RET
It is often beneficial to derive a new mode from an existing one which provides similar basic functionality to what you need.
If there's nothing which matches closely enough, examining the source code for modes which provide some of the same behaviour would be the next best thing.
I note that 'deriving' a mode from nil seems to be the common way of creating a completely new major mode. That way you still get all the benefits of the define-derived-mode macro.

Ocaml - Emacs tuareg mode

I just started to use the tuareg mode in emacs for ocaml programming. So can someone tell me what are the main advantages of using it? Can someone suggest me any tutorial for that?
Tuareg-mode is good because it can parse code and calculate indentation & font-lock basing on this information. Plus it provides pretty good possibilities to interactive work with code.
Regarding tutorial - I don't think that such exists (although I planned to write it long time ago). All information for installation is in README file, and you can learn about available commands by visiting file with OCaml source code, and pressing C-h m to get description of mode, or by getting description of tuareg-mode function (if tuareg.el is loaded already).
Useful addition to these descriptions is Tuareg mode refcard that lists all (or almost) available commands.
Tuareg is really nice for:
Highlighting your code
Indenting your code correctly
Easily sending portions of code to a REPL
Easily compiling your code
Syntax highlight, indentation, as (almost) all language modes.
Compile or evaluate in a top level from a single buffer (you no longer need to open a ocaml toplevel in a command line to test some crap functions)
Caml-types minor mode : after a successful or partial compilation, you can easily point a variable and get the type the compiler inferred for it.