After installing emacs and attempting to run-lisp, I get
Searching for program: No such file or directory, lisp
Then, after trying to run lisp again, a new inferior-lisp buffer opens, but if I try entering anything in, I get:
Output file descriptor of inferior-lisp<1> is closed
Any idea what I should do?
You should set inferior-lisp-program variable. Be careful 'cos some Lisps expect the core to be specified in the command-line or reside in a current directory (especially if you're on Windows).
If you're a newbie and just want to get familiar with lisp there is a built-in Elisp interpreter. Run M-x ielm to get it.
From the info page on emacs (31.11 Running an External Lisp):
To run an inferior Lisp process, type M-x run-lisp'. This runs the
program namedlisp', the same program you would run by typing lisp'
as a shell command, with both input and output going through an Emacs
buffer namedlisp'.
It look like you do not have an program in your path that is call "lisp".
Related
I am wondering if there is a way to have the output of the current execution in emacs cider when using cider-connect.
For instance :
I run lein repl on a project directory
then connect to it in emacs using cider-connect.
Now let's say that I have (println "cider is amazing by the way") in the code of one of my ring handlers, this will only be printed in the console I ran lein repl when a request is made.
How can I have this output also in my nrepl buffer ?
Sorry to say, I suspect that you cannot do this in the way you describe. The output is going strait to the console of that device and not through anything related to nrepl on the way. This also makes sense if you consider that nrepl is often not even running on the same computer. (the "n" in nrepl is for "network").
Perhaps you can arrange for that output to be teed to a file where you can get at it? Then you could start a thread on your nrepl buffer that cated that file. Or have a buffer in emacs that watches the remote file.
If you start leiningen via cider-jack-in you should get the output in the repl buffer.
One way to use this with a remote setup could be to call C-u M-x cider-jack-in and use a specialized server command that will essentially trigger the lein repl command (say over ssh) on the remote machine -- I haven't checked whether this will actually work, but I don't see any reason why it shouldn't. If you can access the code over tramp, it shouldn't matter much whether the code is remote or not.
I'm using emacs live to set up my clojure environment. 1) What command would cause nrepl to try and evaluate the entire file upon jack-in? 2) Is there some place where session state is saved?
For some unknown reason emacs is now trying to evaluate the entire clojure file when I execute M-x nrepl-jack-in. It used to not do that. I have an error in my file and, since the execution fails, I can't start nrepl with this file. This is not the first time I've run into some semantics that change. I've tried restarting emacs but that doesn't help.
Thanks
nrepl's jack-in behavior is dependent on the location of the file backing the buffer you are visiting when you invoke the jack-in command.
To get a vanilla no-project repl, be sure to run nrepl-jack-in from a buffer where there is no Clojure project. To run a repl in a specific project via jack-in, run it while visiting a file in the top level of that project (project.clj is a prime cantidate).
I'm trying to drive emacs on OSX using Dragon Naturally Speaking running inside a Windows VM. Rather than running emacs in the VM, I'd like to drive an emacs (built from the HEAD of the repository) already running on the mac side of things. So, after a hunt through the emacs lisp manual I came up with the following snippets of lisp (currently running from the scratch buffer while I work stuff out):
;; This part is run from an emacsclient -t session
(defvar slave-frame last-event-frame)
;; and this is run in a GUI frame
(defadvice handle-switch-frame (after update-slave-redirect-advice activate)
(unless (eq last-event-frame slave-frame)
(redirect-frame-focus slave-frame last-event-frame)))
And all is well. I type into the terminal window, displaying buffer A and my typing appears in the GUI frame busily dsplaying buffer B. Great. Until I do C-x C-f or any other command that needs the minibuffer, at which point I get the error Terminal 1 is locked, cannot read from it.
I'm I barking up the wrong tree here, or is there a way to make redirect-frame-focus work nicely with commands that use the minibuffer?
Piers,
What behavior do you want, redirection to a minibuffer on the (Windows) client or a minibuffer on the server? Also, what version/flavor of emacs are you using?
When using emacs for writing erlang source code, I have made the following configuration.
In the emacs, 6 windows are open at the same time, 4 windows for source code writing, 1 windows for terminal shell, 1 windows for erlang shell.
After one source code modification, I have use command "m-x ter" to switch "terminal shell", then using "m-p" for recovering last history command, then pressing "enter" to run.
Then using "c-x, left " to switch to erlang shell, then press m-p to repeat last command.
The above two switch process seems a little long, could you have better solution?
The compile function is the general mechanism for such things, and the compile-command variable tells it what to do (as a shell command to run).
By default, the command is make, so if you have a Makefile, you're already sorted.
If not, and writing one isn't appropriate, then you can customise compile-command for your files, perhaps using local variables.
File-local variables for this purpose are covered in the linked Q&A.
You can also use Directory-local variables if you want it to automatically apply to all files under a given directory.
Or if there's a general pattern which can be applied to all erlang files, everywhere, then you might set up compile-command using the erlang mode hook.
Finally, you can just supply the command on demand. Called interactively, M-x compile prompts you for the command to run, and uses the previous command as the default for the next time.
I'm using Emacs, integrated with Leiningen's swank. Each time I need to start working with .clj file I have to:
Run emacs pack/my-ns.clj from console.
Type M-x lein-swank.
Compile buffer.
In Clojure REPL change namespace, i.e. type (in-ns 'pack.my-ns).
How can I automate this process to just run from console something like emacs-clj pack/my-ns.clj and get my environment ready to use?
I don't have an answer to the question you posed, but you should be able to replace your 4th step with C-c M-p while in your Clojure file and then emacs should prompt you as to what namespace you want to be in with the namespace of the file auto-detected so you can simply hit enter. C-c M-p maps to slime-repl-set-package.
Update:
Just stumbled across this. Should be able to take what is said in that answer and modify it so upon initial connection to swank files get compiled. Could also set it up to automatically switch to namespace and make the repl buffer active.
Swank should automatically load the namespace pointed to by :repl-init-script in project.clj when it starts, so if you want to set that to your starting namespace, that should get you started.