HenryT Posted July 11, 2020 Share Posted July 11, 2020 Hello! The Opusmodus commands for Emacs that are listed in file "Slime in Opusmodus" don't work for me. Written commands, like "(circle-pitch-plot 'bartok :point-radius 4)", work ok, a window opens from Opusmodus and shows the plot. But not the ?alqsv-commands, that are shown in mini buffer, but don't do anything, except command "?", that shows commands listed. I'm using Aquamacs 3.5 and my Clozure version is 1.12. Is this setup ok? Best wishes, Henry Quote Link to comment Share on other sites More sharing options...
opmo Posted July 11, 2020 Share Posted July 11, 2020 There is nothing to do for ?alqsv-commands with a plot. It is for snippets. The command '? explain what each symbol do. Quote I'm using Aquamacs 3.5 and my Clozure version is 1.12. Is this setup ok? Is OK. Have you try Emacs. Quote Link to comment Share on other sites More sharing options...
torstenanders Posted July 11, 2020 Share Posted July 11, 2020 I cannot answer for the builtin Opusmodus Slime functionality, but I developed something similar some time ago on my own, which works in Aquamacs for me. Try copying the Emacs Lisp code below into your Emacs initialisation file (e.g., ~/.emacs), start Aquamacs again and open a Lisp file. The code below adds to Emacs buffers in Lisp mode an Opusmodus menu with some standard commands like for previewing a snippet, stopping the playback etc. together with shortcuts shown in the menu. It is all a bit hacky, but works for me and perhaps also for others It should also be easy to add menu items and keyboard shortcuts for any other commands (like plotting) that work from Lisp. ;; Custom function for previewing Openmusic snippets etc (defun slime-eval-and-preview-opmo-snippet-before-point () "Evaluate the Openmusic snippet (an expression) preceding point and preview that snippet." (interactive) (let* ((score (slime-last-expression)) ;; wrap call to preview-score around the score before point (full-expr (concat "(preview-score (list :snippet " score "))"))) (slime-interactive-eval full-expr))) (defun slime-eval-and-preview-opmo-score-before-point () "Evaluate the score (an expression in the tot score format) preceding point and preview that score (notation and playback)." (interactive) (let* ((score (slime-last-expression)) ;; wrap call to preview-score around the score before point (full-expr (concat "(preview-score " score ")"))) (slime-interactive-eval full-expr))) (defun slime-stop-opmo-playback () "Stop the currently playing Openmusic sound playback." (interactive) (slime-interactive-eval "(sequencer:sequencer-stop *audition-sequencer*)")) (defun slime-opmo-midi-playback () "(Re-)play the last Opusmodus score with a separate MIDI playback window." (interactive) (slime-interactive-eval "(display-midi *last-score* :display :window)")) (add-hook 'lisp-mode-hook (lambda () (local-set-key (kbd "<A-f2>") #'slime-eval-and-preview-opmo-snippet-before-point) (local-set-key (kbd "<A-f3>") #'slime-eval-and-preview-opmo-score-before-point) (local-set-key (kbd "<A-f4>") #'slime-opmo-midi-playback) (local-set-key (kbd "<A-f1>") #'slime-stop-opmo-playback) )) ;; Creating a new "Opusmodus" menu in the menu bar to the right of "Lisp" menu. ;; This new menu is only shown when in lisp-mode (define-key-after lisp-mode-map [menu-bar opusmodus] (cons "Opusmodus" (make-sparse-keymap "hoot hoot")) 'lisp) ;; Creating a menu item, under the menu by the id “[menu-bar opusmodus]” (define-key lisp-mode-map [menu-bar opusmodus preview-score] '("Preview score cmd-f3" . slime-eval-and-preview-opmo-score-before-point)) (define-key lisp-mode-map [menu-bar opusmodus preview-snippet] '("Preview snippet cmd-f2" . slime-eval-and-preview-opmo-snippet-before-point)) (define-key lisp-mode-map [menu-bar opusmodus stop-playback] '("Stop playback cmd-f1" . slime-stop-opmo-playback)) (define-key lisp-mode-map [menu-bar opusmodus replay-score] '("(Re)play last score cmd-f4" . slime-opmo-midi-playback)) Stephane Boussuge 1 Quote Link to comment Share on other sites More sharing options...
HenryT Posted July 11, 2020 Author Share Posted July 11, 2020 Sorry, I was a little bit unclear. What I tried to say was that the Audition and Notation snippets don't work with the ?alqsv-commands. Plotting was an example of something that works. Henry Quote Link to comment Share on other sites More sharing options...
torstenanders Posted July 11, 2020 Share Posted July 11, 2020 I can confirm that audition and notation of snippets unfortunately does not work for me either with the builtin Slime in Opusmodus. E.g., I am trying to place the cursor behind an Opusmodus function call an execute the relevant short cut (e.g., C-c o a), but nothing happens. C-c o ? seems to work, though. Anyway, my own Slime interface works, at least for me... Quote Link to comment Share on other sites More sharing options...
HenryT Posted July 11, 2020 Author Share Posted July 11, 2020 Ok, I'll give it a try. It seems to have all I need. Thanks for help! Henry Quote Link to comment Share on other sites More sharing options...
torstenanders Posted November 2, 2020 Share Posted November 2, 2020 I just noted that the code I shared above depends on other definitions in my library (e.g., the function preview-score). Below is an update that instead uses only builtin Opusmodus functions. Holler in case this is not working for you, as the code on my machine is a bit different, and I did not test the code below... (specifically, the version below only works for the scores with instruments from the ps set gm, while my own code is more flexible, but then again depends on other custom definitions). ;; Emacs lisp code: put into your Emacs init file, e.g., ~/.emacs ;; Custom function for previewing Openmusic snippets etc (defun slime-eval-and-preview-opmo-snippet-before-point () "Evaluate the Openmusic snippet (an expression) preceding point and preview that snippet." (interactive) (let* ((score (slime-last-expression)) (full-expr (concat "(ps 'gm (list :treble " score "))")) ) ;; (print (concat "debug: " full-expr)) (slime-interactive-eval full-expr))) (defun slime-eval-and-preview-opmo-score-before-point () "Evaluate the score (an expression in the tot score format) preceding point and preview that score (notation and playback)." (interactive) (let* ((score (slime-last-expression)) (full-expr (concat "(ps 'gm " score ")")) ) (slime-interactive-eval full-expr))) (defun slime-stop-opmo-playback () "Stop the currently playing Openmusic sound playback." (interactive) (slime-interactive-eval "(sequencer:sequencer-stop *audition-sequencer*)")) (defun slime-opmo-midi-playback () "(Re-)play the last Opusmodus score with a separate MIDI playback window." (interactive) (slime-interactive-eval "(display-midi *last-score* :display :window)")) (add-hook 'lisp-mode-hook (lambda () (local-set-key (kbd "<A-f2>") #'slime-eval-and-preview-opmo-snippet-before-point) (local-set-key (kbd "<A-f3>") #'slime-eval-and-preview-opmo-score-before-point) (local-set-key (kbd "<A-f4>") #'slime-opmo-midi-playback) (local-set-key (kbd "<A-f1>") #'slime-stop-opmo-playback) )) ;; Creating a new "Opusmodus" menu in the menu bar to the right of "Lisp" menu. ;; This new menu is only shown when in lisp-mode (define-key-after lisp-mode-map [menu-bar opusmodus] (cons "Opusmodus" (make-sparse-keymap "hoot hoot")) 'lisp) ;; Creating a menu item, under the menu by the id “[menu-bar opusmodus]” (define-key lisp-mode-map [menu-bar opusmodus preview-score] '("Preview score cmd-f3" . slime-eval-and-preview-opmo-score-before-point)) (define-key lisp-mode-map [menu-bar opusmodus preview-snippet] '("Preview snippet cmd-f2" . slime-eval-and-preview-opmo-snippet-before-point)) (define-key lisp-mode-map [menu-bar opusmodus stop-playback] '("Stop playback cmd-f1" . slime-stop-opmo-playback)) (define-key lisp-mode-map [menu-bar opusmodus replay-score] '("(Re)play last score cmd-f4" . slime-opmo-midi-playback)) opmo 1 Quote Link to comment Share on other sites More sharing options...
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.