From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Emacs music everywhere/REPL Elisp/Nyquist/XLISP Date: Thu, 25 Nov 2021 04:44:26 +0100 Message-ID: <87wnkwhpb9.fsf@zoho.eu> Reply-To: Emanuel Berg Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5571"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:Yrz5eKwa5/V9w+3Ehre+wKT2M/4= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 25 04:45:00 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mq5gy-0001FU-1K for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 25 Nov 2021 04:45:00 +0100 Original-Received: from localhost ([::1]:37958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mq5gw-0000XW-8M for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 24 Nov 2021 22:44:58 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mq5gd-0000XK-Hn for help-gnu-emacs@gnu.org; Wed, 24 Nov 2021 22:44:39 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]:56564) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mq5gb-0006ex-Uj for help-gnu-emacs@gnu.org; Wed, 24 Nov 2021 22:44:39 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mq5gZ-0000t5-Nc for help-gnu-emacs@gnu.org; Thu, 25 Nov 2021 04:44:35 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TO_NO_BRKTS_PCNT=2.128 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:134681 Archived-At: Hello music lovers, I thought one would do music with Emacs, and have the interactiveness of Emacs Lisp (I was about to say Lisp, but I've only seen it 100% in Elisp, even in SLIME and SBCL I couldn't get further than what amounted to a very fancy REPL, with the tedious loading and redoing on error ...). So terminology - the REPL prompt is interactive - Elisp is - what is it - everywhere? Anyway this is another case of the same phenomenon (as my SLIME experience), it is the music composing language/software Nyquist which is based on XLISP (which I've never heard of, but there are a lot of Lisp dialects, thanks to the simplicity of said REPL ironically) - anyway here, if you take a look at the code below, if I can feed code into the interactive interpreter (Lisp cruncher or prompt), why can't I/how can I just `eval-last-sexp' as I do in Emacs? If one changes mode to `inferior-lisp-mode' can't it introduce (optimally replace/rewire for the mode being) eval-last-sexp and corresponding functions with the likes of "inferior-lisp-eval-last-sexp" and what will happen is the code read will be fed into the REPL prompt or rather it would be evaluated and executed under the hood just the same! Question 2 - can't we clone Nyquist and move the C to us and have it available from Elisp so one do not have to bother with XLISP and inferior-etc at all? Fork? Question 3 - here is the source: [first - Elisp, second - XLISP] ;;; -*- lexical-binding: t -*- ;;; ;;; this file: ;;; https://dataswamp.org/~incal/emacs-init/ny.el ;;; ;;; original commands/docstrings: ;;; https://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/examples/emacs/how-to/init-nyquist.html ;;; ;;; all Nyquist files: ;;; https://dataswamp.org/~incal/ny/ (require 'inf-lisp) (let*((ny-buff "*Nyquist*") (ny-proc "inferior-lisp") (inferior-lisp-buffer ny-buff) ) (defun ny-running-p () "Return non-nil iff a Nyquist process is running." (get-process ny-proc) ) (declare-function ny-running-p nil) (defun ny-start () "Start a new Nyquist process." (run-lisp "/bin/ny") (switch-to-buffer (format "*%s*" ny-proc)) (rename-buffer ny-buff) (setq inferior-lisp-buffer ny-buff) ) (declare-function ny-start nil) (defun ny-kill () "Kill the Nyquist process and buffer." (when (get-buffer ny-buff) (kill-buffer ny-buff) ) (when (processp ny-proc) (delete-process ny-proc) )) (declare-function ny-kill nil) (defun ny () "Switch to the Nyquist buffer, if not running start one." (interactive) (if (and (ny-running-p) (get-buffer ny-buff) ) (switch-to-buffer ny-buff) (ny-kill) (ny-start) )) (declare-function ny nil) ) ;; this file: ;; https://dataswamp.org/~incal/ny/init-incal.lsp (defun load-init () (load "/home/incal/ny/init-incal.lsp") ) (setq *snd-list-devices* nil) (setq *snd-device* 7) (defun midi-note-p (note) (when (and (<= 0 note) (<= note 127) ) t) ) (defun orgel-note-p (note) (when (and (<= 1 note) (<= note 88) ) t) ) (defun piano-note-p (note) (when (and (<= 1 note) (<= note 61) ) t) ) (defun play-midi (note) (when (midi-note-p note) (play (osc note)) )) (defun play-midi-orgel (note) (when (orgel-note-p note) (play (osc (+ 20 note))) )) (defun play-midi-piano (note) (when (piano-note-p note) (play (osc (+ 35 note))) )) (defun play-midi-interval (beg end) (when (and (midi-note-p beg) (midi-note-p end) (< beg end) ) (do ((n beg (setq n (+ 1 n)))) ((< end n)) (play (osc n)) ))) -- underground experts united https://dataswamp.org/~incal