Jump to content

Opusmodus and Emacs-Slime Setup


Recommended Posts

Build-in Slime in Opusmodus coming soon.

Here is the 'Emacs-Slime Setup.lisp' extension file:

;;;---------------------------------------------------------
;;; SLIME in Opusmodus
;;;---------------------------------------------------------

#! ;;; HOWTO

If you're accustomed to Emacs and Common Lisp, you may prefer
SLIME, the Superior Lisp Interaction Mode for Emacs, to editing lisp
in regular Opusmodus windows and its listener.
There are a number of places to get Emacs for MacOS. One that works
well is:

  https://emacsforosx.com
  
SLIME ships with Opusmodus, in the
"/Applications/Opusmodus.app/Contents/Resources/third-party/slime"
directory. There are two parts to Slime:

  1. Swank, the server, a Common Lisp system, which runs inside
     of the Opusmodus App.
  2. Slime, the client, which is an Emacs lisp package.
  
To start the Swank server when Opusmodus starts, comment out
the (start-swank) form at the end of this file, and restart
Opusmodus (or execute (start-swank) in the Listener to do it now, but
not next time Opusmodus starts).

To load Slime into your Emacs, define the following in your ~/.emacs
startup file:

  (load "/Applications/Opusmodus.app/Contents/Resources/third-party/slime/emacs-opusmodus.el")
  (load-opusmodus-slime)
  
If you want to use the Mac Command key for Emacs meta, instead of the
default of the Mac Option key, and make C-o in dired open the file at
point, in the Mac application that is assigned for editing that type
of file, also add, after that:

  (opusmodus-options)
  
Then, restart Emacs, and do 'm-x slime-connect'.
For Host, use the default of localhost.
For Port, use 4005, or the port you specified in the (start-swank)
call. 4005 will likely be the default.

With (ignore-errors (slime-connect "localhost" 4005))
in your ~/.emacs startup file, the slime will start automatically
at Emacs start.

A "*slime-repl ccl*" buffer should appear. You can get to that buffer
at any time with 'c-c s r' in Emacs. It is a read-eval-print loop,
executing inside the Opusmodus App. Use it just as you do the
Opusmodus Listener.

There are some Opusmodus commands that may be executed from
Emacs. They are all on the "om-selector", accessible via "C-c o". That
will bring up a query for a single character ("Select [?alqsv]"). You
may type one of:

?:    Show this help buffer.
a:    Audition and Notation (snippet).
l:    Audition and Notation last score.
q:    Quit selector.
s:    Stop audition.
v:    Voices Audition and Notation (snippet).

The "snippet" is the lisp form before the insertion point, as in
Opusmodus. The commands (other than ? and q) behave as the like-named
commands in the Opusmodus Tools/Snippet menu, except they open a new
(reusable) notation window, instead of a new notation panel.
When connected to Slime, errors in the Opusmodus Listener will bring
up a backtrace dialog in the connected Emacs, NOT the CCL debugger in
the Listener. Be careful to use the "Return to toplevel" restart from
there, not one of the ones that kills the thread, or you'll break your
Opusmodus, and will have to restart it.

!# ;;; End of HOWTO

;; To start the Swank server when Opusmodus starts, you need to
;; uncomment the (start-swank) expression below: It can take a first
;; arg to change the port from the default of 4005, and a second arg
;; to change the directory from which to load Swank from the default
;; of inside the application bundle (you should only do this if you
;; need to run a different version of Swank, to be compatible with a
;; different version of Slime in your Emacs).

(in-package :om)
; (start-swank)

Janusz

Link to comment
Share on other sites

  • opmo changed the title to Opusmodus and Emacs-Slime Setup
  • opmo pinned this topic
  • opmo unpinned this topic
×
×
  • Create New...

Important Information

Terms of Use Privacy Policy