rme Posted August 23, 2017 Posted August 23, 2017 If you want to use Emacs and SLIME with Opusmodus, that is possible. Here are steps that work: If you haven't already done so, install Quicklisp. Evaluate (ql:quickload "quicklisp-slime-helper"). Follow its instructions and put (load (expand-file-name "~/quicklisp/slime-helper.el")) into your ~/.emacs file. Start Opusmodus, and evaluate (cl-user::start-swank). This should print something like ";; Swank started at port: 4005". Now, start your Emacs. Type M-x slime-connect and you'll be prompted for a host (use the default, which is 127.0.0.1) and then a port. The port needs to match the port (default 4005) that was printed out earlier. You are now connected to Opusmodus. You should be able to say stuff like (list-plot '(1 2 3)) from the SLIME repl and have it work. The function cl-user::start-swank basically does (load "home:quicklisp;setup") and then (ql:quickload :swank) and then (swank:create-server :port 4005 :dont-close t), so there's no magic going on there. If you run into trouble, let me know and I'll try to help out. torstenanders, ydepps, Stephane Boussuge and 1 other 3 1 Quote
opmo Posted August 24, 2017 Posted August 24, 2017 Thank you Matthew for the instructions. All is working fine. Alternatively you could put (ql:quickload "quicklisp-slime-helper") (cl-user::start-swank) into the 'Quicklisp Start.lisp' file which you find in the Opusmodus/Extension folder. This way all you need to do is to start Opusmodus then Emacs and finally type M-x slime-connect ydepps 1 Quote
torstenanders Posted August 26, 2017 Posted August 26, 2017 Thanks a lot, this is brilliant! Torsten Quote
torstenanders Posted August 26, 2017 Posted August 26, 2017 With the setup above, Opusmodus also works from within Org Babel (http://orgmode.org/org.html#Working-with-source-code) -- in case anyone of you wants to do Literate Programming with Opusmodus :) I like using Emacs Orgmode for writing documentation, papers, slides for classes etc., and having code "live" in your text is great. Torsten Quote
torstenanders Posted August 26, 2017 Posted August 26, 2017 No -- no extra setup required, only the setup above. Then you can open an Org file with Common Lisp snippets and evaluate them as explained in the Org mode doc. Best, Torsten Quote
torstenanders Posted August 26, 2017 Posted August 26, 2017 Using Opusmodus with autocompletion is fun: purcell/ac-slime GITHUB.COM Emacs auto-complete plugin for Slime symbols. Contribute to purcell/ac-slime development by creating an account on GitHub. After installing (simply with M-x package-list-packages, and then selecting ac-slime) and configuring it as described at the website link above, I additionally enforced that autocompletion is loaded whenever I load a Lisp file in Emacs with the following line in my .emacs file. (add-hook 'lisp-mode-hook (function (lambda () (auto-complete-mode 1)))) Best, Torsten damian 1 Quote
torstenanders Posted August 26, 2017 Posted August 26, 2017 Slime provides convenient ways to access documentation, e.g., by calling describe with a shortcut (^C ^D ^D). However, for some reason calling describe on functions and variables in Clozure CL (the Lisp compiler of Opusmodus) does not show their actual documentation string (other Lisp compilers include such information). So, I added that myself. If you use the Emacs+Slime interface for Opusmodus, consider putting the definitions below in a file that is automatically loaded by Opusmodus (e.g., any file in ~/Opusmodus/Extensions/). Best, Torsten ;;; Extend describe output (defmethod describe-object :after ((thing symbol) stream) "Add documentation string of functions and variables at end of describe output." (declare (ignore stream)) (let ((fbound (fboundp thing))) (when fbound (let ((doc (ccl::%get-documentation fbound t))) (when doc (format T "DOCUMENTATION:~%") (format T doc))))) (when (boundp thing) (format T "DOCUMENTATION:~%") (format T (ccl::%get-documentation thing 'variable))) ) (defmethod describe-object :after ((thing function) stream) (declare (ignore stream)) (format T (ccl::%get-documentation thing t))) Quote
torstenanders Posted August 27, 2017 Posted August 27, 2017 On 8/26/2017 at 3:51 PM, torstenanders said: No -- no extra setup required, only the setup above. Then you can open an Org file with Common Lisp snippets and evaluate them as explained in the Org mode doc. Best, Torsten Edit: The setup can be improved by adding the following line to your ~/.emacs file. Without this added setting, you can evaluated Lisp in an Org buffer Lisp code block when opening the code block in Lisp mode (C-c '). With the addition, you can also evaluated the code blocks directly in the Org buffer with C-c C-c. (require 'ob-lisp) Example: - Start Opusmodus and Emacs and get them talking to each other as explained above - Open/create an Org file in Emacs and add a Lisp code block, e.g., the following #+begin_src lisp (+ 1 2) #+end_src - Evaluate this code block by moving the cursor somewhere inside and then press C-c C-c -- the result is added to the buffer. - Open this code block by moving the cursor somewhere inside and then press C-c ' -- a temporary buffer in Lisp mode with the code is shown, with all bells and whistles of the Emacs Lisp environment you set up For more information on code blocks, how to export them, communication between code block, the various customisations etc. see the Org manual: Org mode for Emacs – Your Life in Plain Text ORGMODE.ORG Org: an Emacs Mode for Notes, Planning, and Authoring Best, Torsten Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.