I am trying to setup the slime mode in emacs for using common lisp. When I attemp to start slime with M-x slime I get an error message saying:
process inferior-lisp not running.
So, I checked the value of the variable inferior-lisp-program which turned out to be "/opt/sbcl/bin/sbcl". sbcl is an acronym for an implementation of common lisp known as steel bank common lisp. Note that this variable is defined in file slime.el. As I do not have sbcl (the previous directory does not even exist on my machine) installed on my machine (which runs os x 10.8.3) this will not work.
I have the clisp implementation which is located in the directory: /opt/local/bin/. I tried to change the value of the variable inferior-lisp-program by:
(setq inferior-lisp-program '/opt/local/bin/clisp/)
However, this did not work and I do not know what else to try.
How can I get inferior-lisp to run and hence get slime to work?
EDIT: Here is some extra information I believe that could be helpful. If I try to just start common lisp in emacs by executing M-x run-lisp I get the following output from emacs:
(progn (load "/Users/s2s2/.emacs.d/slime/swank-loader.lisp" :verbose t) (funcall \
(read-from-string "swank-loader:init")) (funcall (read-from-string "swank:start-s\
erver") "/var/folders/wf/yjgymt8j14v2tqwjnny68wq00000gn/T/slime.28222"))
Can't exec program: /opt/sbcl/bin/sbcl
Process inferior-lisp exited abnormally with code 1
Can't exec program: /opt/sbcl/bin/sbcl
Process inferior-lisp exited abnormally with code 1
Hope this helps! All help is greatly appreciated!
The variable slime-lisp-implementations has higher priority than inferior-lisp-program for slime if set; try this instead (adjust parameters accordingly):
(setq slime-lisp-implementations
'((clisp ("/opt/local/bin/clisp" "-q -I"))
(sbcl ("/usr/local/bin/sbcl") :coding-system utf-8-unix)))
The first thing to try is to run the command in a regular shell window - just type or copy and paste the executable path there and see what bash tells you:
$ sbcl < /dev/null
bash: sbcl: command not found
$ clisp < /dev/null
<<clisp splash screen>>
$ which clisp
/usr/bin/clisp
Once you find out what the correct executable is, you set inferior-lisp to it:
(setq inferior-lisp "/usr/bin/clisp")
Notes:
It should be a string, not a symbol, so you need the quotes ".
It should point to a file, not a directory, so your trailing slash / is wrong
Related
In ABCL, during development I sometimes get runaway functions. I want to be able to stop execution and return to top level LISP without killing the LISP/JVM process (in my emacs shell) and losing my current LISP environment.
I've tried various control keys (e.g., Control-C, Control-D,...) but at best end up killing LISP or the JVM.
;;; How to stop this function and return to LISP interactive
;;; without killing lisp...?
(defun runaway ()
(let ((result nil))
(dotimes (count 10 result)
(sleep 2)
(print count))))
C-c C-cTerminate batch job (Y/N)? n
n
Process inferior-lisp exited abnormally with code 130
Try using Emacs with Slime instead, because Slime does not kill the process but interrupt the thread and enters the debugger if you press C-c C-c.
You should probably add an executable script abcl.sh somewhere in your PATH, as follows:
#!/bin/sh
exec java -jar .../abcl/abcl-bin-1.5.0/abcl.jar
You have to replace ... with your own path to abcl.jar.
Then, from Emacs, you should be able to start it.
Do C-u M-x slime to force the slime command to prompt for an executable, and give abcl.sh to it. It should start the process and connect to it using the Slime protocol.
In windows, I set the variable inferior-lisp-program to be (shell-quote-argument "D:/Program Files/ccl/wx86cl.exe").
But when I run inferior lisp with the command run-lisp, emacs responds:
Searching for program: no such file or directory, "D:/Program
It seemed that emacs treats "D:/Program Files/ccl/wx86cl.exe" as two arguments "D:/Program and Files/ccl/wx86cl.exe" separated by a space character.
How can I make emacs treat "D:/Program Files/ccl/wx86cl.exe" as a whole?
Try using the old "Progra~1" compatibility name for "Program Files". So,
(setq inferior-lisp-program "D:/Progra~1/ccl/wx86cl.exe")
How can I tell emacs not to pop up the *Shell Command Output* buffer when calling a shell command like this?
(shell-command MY_COMMAND)
Currently emacs splits the current window into two, showing the (mostly irrelevant) output buffer. To me it would be completely sufficient if I could look it up later if I feel like it.
Maybe using shell-command was the root of the problem. I think I found a solution with call-process which works, although there may be a more elegant way:
(call-process-shell-command
"cat ~/.emacs.d/init.el"
nil "*Shell Command Output*" t
)
shell-command takes an optional argument OUTPUT-BUFFER where you can specify the buffer to output to. If it is t (actually not a buffer-name and not nil) it will be output in the current buffer. So we wrap this into a with-temp-buffer and will never have to bother with it:
(with-temp-buffer
(shell-command "cat ~/.emacs.d/init.el" t))
In my experience, if the shell command itself produces no output, then the emacs *Shell Command Output* buffer won't pop open.
Therefore, to avoid the output buffer, silence the output of the command.
One easy way is:
add " > /dev/null 2>&1" to the end of any shell command.
(Caveat: I'm unsure if /dev/null exists on 100% of platforms where one can run emacs, but on every Linux distro it should be fine.)
If the call to elisp function shell-command is in an elisp script, then you could change this:
(shell-command cmd)
to this:
(shell-command (concat cmd " > /dev/null 2>&1"))
If you occasionally do want to monitor the output, then you could create one wrapper function that suppresses the output via /dev/null, and one wrapper function with no suppression, and toggle between them as you wish.
The above advice was tested on: GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2017-09-20 on lcy01-07, modified by Debian
This utility function might help. It returns the actual value of the shell command
(defun shell-command-as-string (cmd)
(with-temp-buffer
(shell-command-on-region (point-min) (point-max)
cmd t)
(buffer-string)))
What's even better, is to use
(shell-command (concat cmd " 1>&2") t t)
This way, the output is saved in the error buffer, should you want to look at it. But it does not pop up automatically.
I have followed instructions from How can I run Cygwin Bash Shell from within Emacs? this question and I have gone further and added the (setq explicit-bash-args '("--login" "-i")) command, however emacs continues to only display the dos prompt when I type M-x shell. In summery my .emacs file looks like this:
(defun cygwin-shell ()
"Run cygwin bash in shell mode."
(interactive)
(let ((explicit-shell-file-name "C:/cygwin/bin/bash"))
(call-interactively 'shell)))
(setq explicit-bash-args '("--login" "-i"))`
Please be gentle with the answers as I am right at the bottom of the famous vertical emacs learning curve!
If you implemented the answer from that question, note that you have to do M-x cygwin-shell to start bash. If you want to use it for every M-x shell you need to call
(setq explicit-shell-file-name "C:/cygwin/bin/bash")
Since you stated that you are learning, here's a few tips when trying this out.
type C-x C-f ~/.emacs to open your .emacs file in your user path.
Enter your function above at the end
M-x load-file [RET] .emacs: loads the buffer (no need to restart emacs)
C-h a: If you are interested in some specific action, you can look it up
C-h v [RET] variable: can inspect the variable, check the value of explicit-bash-args for instance
And, btw, I'm not sure what the "--login -i" does, but someone stated in a comment that you should have that so "ls" would work. If you have your cygwin bin path in your PATH environment variable, bash will find ls anyway. No need to escape the path variable either, this is handled by bash (do an echo $PATH in bash when you get it working and you'll see).
I am using the following tutorial:
http://www.pchristensen.com/blog/articles/installing-clisp-emacs-and-slime-on-windows-xp/
I have set-up all the directories and downloaded all the necessary files. However, on step 4. I am using the emacs command "eval-buffer". I type in my settings, ran "eval-buffer", received feedback (in the bottom bar), and assumed everything worked correctly. Then when I ran M-x "slime" I received the error:
Spawning child process: invalid argument
I assumed I had typed something incorrectly in my .emacs file so I re-edited it. However, now when I attempt to run M-x "eval-buffer" I receive no feedback and I don't believe my new code executes.
My file, by the way, is:
(setq inferior-lisp-program "C:/Documents and Settings/U9UW/Desktop/root/bin/clisp/full/lisp.exe -B C:/Documents and Settings/U9UW/Desktop/root/bin/clisp/full -M
C:/Documents and Settings/U9UW/Desktop/root/bin/clisp/full/lispinit.mem -ansi -q")
(add-to-list 'load-path "C:/Documents and Settings/U9UW/Desktop/root/bin/emacs/site-lisp/slime/")
(require 'slime)
(slime-setup)
eval-buffer actually was evaluating. To fix the problem "Spawning child process: invalid argument", one has to replace the first line with:
(setq inferior-lisp-program “clisp”)