From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: How to find someone working on a (mixed) major mode for LilyPond? Date: Sun, 13 Sep 2015 19:06:52 +0200 Message-ID: <878u8axn83.fsf@fencepost.gnu.org> References: <87fv2m6ytx.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1442164032 28939 80.91.229.3 (13 Sep 2015 17:07:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Sep 2015 17:07:12 +0000 (UTC) Cc: emacs-devel@gnu.org To: Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 13 19:07:07 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZbAk5-0003t1-H4 for ged-emacs-devel@m.gmane.org; Sun, 13 Sep 2015 19:07:05 +0200 Original-Received: from localhost ([::1]:36528 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbAk5-0000uG-4F for ged-emacs-devel@m.gmane.org; Sun, 13 Sep 2015 13:07:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbAk1-0000u8-IF for emacs-devel@gnu.org; Sun, 13 Sep 2015 13:07:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZbAk0-0008R9-FR for emacs-devel@gnu.org; Sun, 13 Sep 2015 13:07:01 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47092) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbAk0-0008R5-CA for emacs-devel@gnu.org; Sun, 13 Sep 2015 13:07:00 -0400 Original-Received: from localhost ([127.0.0.1]:60911 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.82) (envelope-from ) id 1ZbAjs-0004Sf-Jt; Sun, 13 Sep 2015 13:06:52 -0400 Original-Received: by lola (Postfix, from userid 1000) id 110CCE519B; Sun, 13 Sep 2015 19:06:52 +0200 (CEST) In-Reply-To: (Richard Stallman's message of "Sun, 13 Sep 2015 11:21:09 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:189898 Archived-At: Richard Stallman writes: > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > I think it would be really good to make progress in dual-language > editing in Emacs, especially if we can improve the general facilities > so as to make such modes easier to write. > > I urge people to help you in this project. To illustrate: here is an extract from ly/music-functions-init.ly: compoundMeter = #(define-music-function (args) (pair?) (_i "Create compound time signatures. The argument is a Scheme list of lists. Each list describes one fraction, with the last entry being the denominator, while the first entries describe the summands in the enumerator. If the time signature consists of just one fraction, the list can be given directly, i.e. not as a list containing a single list. For example, a time signature of (3+1)/8 + 2/4 would be created as @code{\\compoundMeter #'((3 1 8) (2 4))}, and a time signature of (3+2)/8 as @code{\\compoundMeter #'((3 2 8))} or shorter @code{\\compoundMeter #'(3 2 8)}.") (let* ((mlen (calculate-compound-measure-length args)) (beat (calculate-compound-base-beat args)) (beatGrouping (calculate-compound-beat-grouping args)) (timesig (cons (ly:moment-main-numerator mlen) (ly:moment-main-denominator mlen)))) #{ \once \override Timing.TimeSignature.stencil = #(lambda (grob) (grob-interpret-markup grob (make-compound-meter-markup args))) \set Timing.timeSignatureFraction = #timesig \set Timing.baseMoment = #beat \set Timing.beatStructure = #beatGrouping \set Timing.beamExceptions = #'() \set Timing.measureLength = #mlen #} )) It defines a command \compoundMeter that can be used in LilyPond passages according to the instructions in the gettext-enabled DOC string. At the first # the parser is thrown into Scheme mode and reads one sexp (incidentally ending at the end of the quoted passage). The body of the let* is a "music expression" in LilyPond syntax bracketed in #{...#}. It contains various Scheme expressions again, namely #(lambda...), #beat, #beatGrouping, #'() and #mlen. Again, following any of the # one sexp is read and then syntax returns to Lilypond. For something like SMIE, one would likely regard all of #sexp as a single token, but this token is Scheme syntax internally and should (apart from any included #{...#} of course) ideally be totally the same as Emacs' Scheme mode. In LilyPond mode itself, however, ( and ) are not matched delimiters. When used, \compoundMeter is followed by one LilyPond expression obeying the predicate pair?. That can be something like #'(...) (list or dotted pair/list), but it can also be something like 3/4 (which is LilyPond shordhand for #'(3 . 4)). 3/4 cannot be represented as Scheme #3/4 since that would make it indistinguishable from 6/8 which is a different musical meter altogether. There are similar equivalences all around: instead of \once \override Timing.TimeSignature.stencil = ##f you could write #(once (property-override '(Timing TimeSignature stencil) #f)) for the equivalent effect. So a typical LilyPond file is going back and forth between Scheme and LilyPond a whole lot: most numeric expressions are entered in Scheme mode, and pretty much any control structure or expression while any music content inside of such structures is then delivered via #{...#} in LilyPond mode. As a result, there are a whole lot of Scheme/LilyPond syntax transitions in a typical file. And it would be really nice to use scheme-mode for the Scheme parts without incurring a large overhead for switching between the principal modes. -- David Kastrup