+1.3.102.jcn1
+============
+
+* Translated auto-beam properties to alist.
+
+* Rewrite of tfmtoafm in scm.
+
+* Rewrite of emacs LilyPond mode, based upon auctex interface.
+
+* Chord name fixes and additions (Atte Andr'e Jensen)
+
1.3.101.jcn2
============
MAJOR_VERSION=1
MINOR_VERSION=3
PATCH_LEVEL=102
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=jcn1
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
--- /dev/null
+#!@GUILE@ \
+-e main -s
+!#
+;;;; tfm2afm.scm -- convert tfm to afm, with the aid of tfmtodit
+;;;;
+;;;; source file of the GNU LilyPond music typesetter
+;;;;
+;;;; (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+
+(debug-enable 'backtrace)
+
+;;;; library funtions
+(use-modules
+ (ice-9 debug)
+ (ice-9 format)
+ (ice-9 getopt-long)
+ (ice-9 string-fun)
+ (ice-9 regex))
+
+;;; Script stuff
+(define program-name "tfm2afm")
+
+(define cur-output-name "-")
+(define cur-output-file '())
+
+(define subst-version "@TOPLEVEL_VERSION@")
+
+(define program-version
+ (if (eq? subst-version (string-append "@" "TOPLEVEL_VERSION" "@"))
+ "unknown"
+ subst-version))
+
+(define (show-version port)
+ (display (string-append
+ program-name " - LilyPond version " program-version "\n")
+ port))
+
+(define (show-help)
+ (display "Convert TFM to AFM
+
+Usage: tfm2afm [OPTION]... TFM-FILE
+
+Options:
+ -h,--help this help
+ -o,--output=FILE set output file
+ -v,--version show version
+
+Example: tfm2afm `kpsewhich cmr10.tfm`
+"))
+
+(define (gulp-file name)
+ (let* ((file (open-input-file name))
+ (text (read-delimited "" file)))
+ (close file)
+ text))
+
+(define (dump-file name text)
+ (let ((file (open-output-file name)))
+ (display text file)
+ (close file)))
+
+;; urg, this kind of naming costs too much indenting
+(define (split c s r)
+ (separate-fields-discarding-char c s r))
+
+
+;;; Script entry point
+(define (main args)
+ (let ((options (getopt-long args
+ `((output (single-char #\o)
+ (value #t))
+ (help (single-char #\h))
+ (version (single-char #\v))))))
+ (define (opt tag default)
+ (let ((pair (assq tag options)))
+ (if pair (cdr pair) default)))
+
+ (if (assq 'help options)
+ (begin (show-version (current-output-port)) (show-help) (exit 0)))
+
+ (if (assq 'version options)
+ (begin (show-version (current-output-port)) (exit 0)))
+
+ (show-version (current-error-port))
+ (let ((output-name (opt 'output "-"))
+ (files (let ((foo (opt '() '())))
+ (if (null? foo)
+ (list "-")
+ foo))))
+ (do-file (car files) output-name))))
+
+(define (string->dim scale string)
+ (/ (string->number string) scale))
+
+;; C 0 ; WX 7 ; N rests-0 ; B 0 -3125 7
+(define (afm-char scale number name width height depth)
+ (let ((w (string->dim scale width))
+ (h (string->dim scale height))
+ (d (string->dim scale depth)))
+ ;; ARG: can't find doco for (format): ~s prints string in quotes
+ ;;(format "C ~s ; WX ~d ; N ~s ; B 0 ~,3f ~,3f ~,3f ;\n"
+ ;; number (inexact->exact w) name d w h)
+ (string-append "C " number " ; "
+ (format "WX ~d ; " (inexact->exact w))
+ "N " name " ; "
+ (format "B 0 ~,3f ~,3f ~,3f ;\n" d w h))))
+
+;; # width[,height[,depth[,italic_correction[,left_italic_correction[,subscript_correction]]]]]
+(define (dit-to-afm-char scale x)
+ (if (> (string-length x) 0)
+ (let* ((l (split #\ht x list))
+ (name (car l))
+ (dimensions (append (split #\, (cadr l) list) '("0" "0" "0"))))
+ (let ((number (substring name (+ (string-index name #\- ) 1)))
+ (width (car dimensions))
+ (height (cadr dimensions))
+ (depth (caddr dimensions)))
+ (afm-char scale number name width height depth)))
+ ""))
+
+;;
+;; Hmm, this is a 10-liner in awk,
+;; what am I doing wrong?
+;;
+(define (do-file tfm-name output-name)
+ (let* ((font (basename tfm-name '.tfm))
+ (afm-name (string-append font '.afm))
+ (dit-name (string-append font '.dit))
+ (chart-name (string-append font '.chart))
+ (chart (let loop ((i 0) (s ""))
+ (if (= i 256)
+ s
+ (let ((n (number->string i)))
+ (loop (+ i 1) (string-append s n " Character-" n "\n")))))))
+
+ (dump-file chart-name chart)
+
+ (if (= 0 (primitive-fork))
+ (execlp 'tfmtodit tfm-name tfm-name chart-name dit-name)
+ (waitpid 0))
+
+ (let* ((dit (gulp-file dit-name))
+ (sections (split #\np (regexp-substitute/global
+ #f
+ "name \|\ninternalname \|\nspacewidth \|\nchecksum\|\ndesignsize \|\nkernpairs\n\|\ncharset\n"
+ dit 'pre "\f" 'post)
+ list))
+ (dit-vector (list->vector (cdr sections))))
+
+ (dump-file
+ afm-name
+ (let ((name (vector-ref dit-vector 0))
+ (internalname (vector-ref dit-vector 1))
+ (spacewidth (vector-ref dit-vector 2))
+ (checksum (vector-ref dit-vector 3))
+ (designsize (vector-ref dit-vector 4))
+ (kernpairs (vector-ref dit-vector 5))
+ (charset (split #\nl (vector-ref dit-vector 6) list)))
+ (let ((scale (/ (string->number designsize) 100)))
+ (string-append
+ "FontName cmr
+StartFontMetrics
+StartCharMetrics "
+ (number->string (- (length charset) 2))
+ "\n"
+ (apply string-append
+ (map (lambda (x) (dit-to-afm-char scale x))
+ charset))
+ "EndCharMetrics
+EndFontMetrics"
+ )))))))
+
+
+
\ No newline at end of file
-#!@SHELL@
-# tfmtoafm.sh --urg
-
-tfm=$1
-font=`basename $1 .tfm`
-
-if [ $# -ne 1 -o "$tfm" = "$font" ]; then
- echo "Usage: tfmtoafm TFM-FILE"
- echo
- echo "example: tfmtoafm cmr10.tfm"
- exit 2
-fi
-
-size=`echo $font | sed "s/[^0-9]*//"`
-afm=$font.afm
-fontfile=`kpsewhich $font.tfm`
-t1=/tmp/tfmtoafm1-$$
-t2=/tmp/tfmtoafm2-$$
-rm -f $t1 $t2 $font $afm
-
-for i in `seq 1 127`; do printf "%d Character-%d\n" $i $i >> $t1; done
-tfmtodit $fontfile $t1 $font
-rm $t1
-scaling=`awk -v OFMT='%.5f' '/designsize/ {print $2/'$size/1000} $font`
-tail -127 $font | cut -f 1-2 > $t1
-cat $t1 | cut -d, -f 1-2 > $t2
-rm $t1
-#nl -ba $t2 | awk -F '[ \t,]+' '{print "C "$2";\t"$3";\tB 0.00 0.00 "$4/'"$scaling"'" "$5/'"$scaling"'";"}' > $t1
-nl -ba $t2 | awk -F '[ \t,]+' '{print "C "$2" ; WX 0 ; N "$3" ; B 0.00 0.00 "$4/'"$scaling"'" "$5/'"$scaling"'" ;"}' > $t1
-
-count=`cat $t1 | wc -l`
-count=$((count + 1))
-cat > $afm <<EOF
-FontName cmr
-StartFontMetrics
-StartCharMetrics $count
-EOF
-# urg 0 is difficult but we need it
-head -1 $t1 | sed -e "s/C 1 ;/C 0 ;/" -e "s/-1 ;/-0 ;/" >> $afm
-cat $t1 >> $afm
-cat >> $afm <<EOF
-EndCharMetrics
-EndFontMetrics
-EOF
-rm $t1 $t2 $font
-
-\version "1.3.96"
%% This should only be necessary if your kpathsea setup is broken
-%%
-%% Make sure the correct msamxx.tfm is where lily can find it
-%% (ie cwd or lily's tfm dir).
-%%
-%% For normal (20pt) paper, do
-%%
-%% cp locate `msam9.tfm` $LILYPONDPREFIX/tfm
+%
+% Make sure the correct msamxx.tfm is where lily can find it
+% (ie cwd or lily's tfm dir).
+%
+% For normal (20pt) paper, do
+%
+% cp locate `msam9.tfm` $LILYPONDPREFIX/tfm
+%
-#(set! chord::names-alist-american
- (append
- '(
- ;; any changes here, see scm/chord-names.scm
+chord = \notes\transpose c''\chords{
+\property ChordNames.ChordNames \push #'style = #"jazz"
+% major chords
+c
+c:6 % 6 = major triad with added sixth
+c:maj % triangle = maj
+c:6.9^7 % 6/9
+c:9^7 % add9
+% minor chords
+c:m % m = minor triad
+c:m.6 % m6 = minor triad with added sixth
+c:m.7+ % m triangle = minor major seventh chord
+c:3-.6.9^7 % m6/9
+c:m.7 % m7
+c:3-.9 % m9
+c:3-.9^7 % madd9
- ;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (super "o7"))
- ;jazz: the delta, see jazz-chords.ly
- (((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (super ((font-family . math) "N")))
- (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (rows ((raise . 1) "o") ((raise . 0.5) ((kern . -0.5) ((font-relative-size . -3) "/"))) "7")) ; slashed o
+% dominant chords
+c:7 % 7 = dominant
+c:7.5+ % +7 = augmented dominant
+c:7.5- % 7b5 = hard diminished dominant
+c:9 % 7(9)
+c:9- % 7(b9)
+c:9+ % 7(#9)
+c:13^9.11 % 7(13)
+c:13-^9.11 % 7(b13)
+c:13^11 % 7(9,13)
+c:13.9-^11 % 7(b9,13)
+c:13.9+^11 % 7(#9,13)
+c:13-^11 % 7(9,b13)
+c:13-.9-^11 % 7(b9,b13)
+c:13-.9+^11 % 7(#9,b13)
- ;(((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (super "x7"))
- ; slashed o
- )
- chord::names-alist-american))
+% half diminished chords
+c:m5-.7 % slashed o = m7b5
+c:9.3-.5- % ø7(pure 9)
+
+% diminished chords
+c:m5-.7- % o = diminished seventh chord
-chord = \notes\transpose c''\chords{
- \property ChordNames.ChordNames \push #'style = #"american"
- c:m5-.7-
- c:m5-.7
}
\score{
- <
- \context ChordNames \chord
- \context Staff \chord
- >
+<
+\context ChordNames \chord
+\context Staff \chord
+>
\paper
{
- \translator {
- \ChordNamesContext
- ChordNames \push #'word-space = #1
- }
+ \translator { \ChordNamesContext ChordNames \push #'word-space = #1 }
+% \translator { \LyricsContext textScriptWordSpace = #0.3 }
}
}
-
void
Auto_beam_engraver::consider_end_and_begin (Moment test_mom)
{
- Moment one_beat = *unsmob_moment( get_property ("beatLength"));
+ SCM wild = gh_list (ly_symbol2scm ("*"), ly_symbol2scm ("*"), SCM_UNDEFINED);
+ SCM b = gh_list (ly_symbol2scm ("begin"), SCM_UNDEFINED);
+ SCM e = gh_list (ly_symbol2scm ("end"), SCM_UNDEFINED);
+ Moment one_beat = *unsmob_moment( get_property ("beatLength"));
int num = *unsmob_moment (get_property("measureLength")) / one_beat;
int den = one_beat.den_i ();
-
- String time_str = String ("time") + to_str (num) + "_" + to_str (den);
-
- String type_str;
- if (test_mom.num () != 1)
- type_str = to_str (test_mom.num ());
- if (test_mom.den () != 1)
- type_str = type_str + "_" + to_str (test_mom.den ());
+ SCM time = gh_list (gh_int2scm (num), gh_int2scm (den), SCM_UNDEFINED);
- /*
- URG
-
- FIXME: SHOULD USE ALIST
-
- */
+ SCM type = gh_list (gh_int2scm (test_mom.num_i ()),
+ gh_int2scm (test_mom.den_i ()), SCM_UNDEFINED);
+ // fixme
+ SCM settings = scm_eval2 (ly_symbol2scm ("auto-beam-settings"), SCM_EOL);
+
/*
Determine end moment for auto beaming (and begin, mostly 0==anywhere)
In order of increasing priority:
- i. every beat <den>
- ii. time<num>_<den>beamAutoEnd
- iii. time<num>_<den>beamAutoEnd<type>
- iv. beamAutoEnd
- v. beamAutoEnd<type>
+ i. every beat
+ ii. end * <num> <den>
+ iii. end <type> <num> <den>
+
+ iv. end * * *
+ v. end <type> * *
Rationale:
iv. generic override
v. override for specific duration type
- The user overrides should be required for common cases.
- */
+ */
+
+
+
+ //
+ //
+ // FIXME: arg: why all these guesses in reverse order?
+ //
+ //
+
/*
first guess: begin beam at any position
/*
second guess: property generic time exception
*/
- SCM begin = get_property ((time_str + "beamAutoBegin").ch_C());
- if (unsmob_moment (begin))
- begin_mom = * unsmob_moment (begin);
+ SCM begin = gh_assoc (gh_append3 (b, wild, time), settings);
+
+ if (begin != SCM_BOOL_F && unsmob_moment (gh_cdr (begin)))
+ begin_mom = * unsmob_moment (gh_cdr (begin));
- SCM end = get_property ((time_str + "beamAutoEnd").ch_C());
- if (unsmob_moment (end))
- end_mom = * unsmob_moment (end);
+ SCM end = gh_assoc (gh_append3 (e, wild, time), settings);
+ if (end != SCM_BOOL_F && unsmob_moment (gh_cdr (end)))
+ end_mom = * unsmob_moment (gh_cdr (end));
/*
third guess: property time exception, specific for duration type
*/
- if (type_str.length_i ())
- {
- SCM end_mult = get_property ((time_str + "beamAutoEnd" + type_str).ch_C());
- if (unsmob_moment (end_mult))
- end_mom = * unsmob_moment (end_mult);
-
- SCM begin_mult = get_property ((time_str + "beamAutoBegin" + type_str).ch_C());
- if (unsmob_moment (begin_mult))
- begin_mom = * unsmob_moment (begin_mult);
- }
+ SCM begin_mult = gh_assoc (gh_append3 (b, type, time), settings);
+ if (begin_mult != SCM_BOOL_F && unsmob_moment (gh_cdr (begin_mult)))
+ begin_mom = * unsmob_moment (gh_cdr (begin_mult));
+
+ SCM end_mult = gh_assoc (gh_append3 (e, type, time), settings);
+ if (end_mult != SCM_BOOL_F && unsmob_moment (gh_cdr (end_mult)))
+ end_mom = * unsmob_moment (gh_cdr (end_mult));
/*
fourth guess [user override]: property plain generic
*/
- begin = get_property ("beamAutoBegin");
- if (unsmob_moment (begin))
- begin_mom = * unsmob_moment (begin);
+ begin = gh_assoc (gh_append3 (b, wild, wild), settings);
+ if (begin != SCM_BOOL_F && unsmob_moment (gh_cdr (begin)))
+ begin_mom = * unsmob_moment (gh_cdr (begin));
-
-
- end = get_property ("beamAutoEnd");
- if (unsmob_moment (end))
- end_mom = * unsmob_moment (end);
+ end = gh_assoc (gh_append3 (e, wild, wild), settings);
+ if (end != SCM_BOOL_F && unsmob_moment (gh_cdr (end)))
+ end_mom = * unsmob_moment (gh_cdr (end));
/*
fifth guess [user override]: property plain, specific for duration type
*/
- if (type_str.length_i ())
- {
- SCM end_mult = get_property ((String ("beamAutoEnd") + type_str).ch_C());
- if (unsmob_moment (end_mult))
- end_mom = * unsmob_moment (end_mult);
-
- SCM begin_mult = get_property ((String ("beamAutoBegin") + type_str).ch_C());
- if (unsmob_moment (begin_mult))
- begin_mom = * unsmob_moment (begin_mult);
- }
+ begin_mult = gh_assoc (gh_append3 (b, type, wild), settings);
+ if (begin_mult != SCM_BOOL_F && unsmob_moment (gh_cdr (begin_mult)))
+ begin_mom = * unsmob_moment (gh_cdr (begin_mult));
+
+ end_mult = gh_assoc (gh_append3 (e, type, wild), settings);
+ if (end_mult != SCM_BOOL_F && unsmob_moment (gh_cdr (end_mult)))
+ end_mom = * unsmob_moment (gh_cdr (end_mult));
Rational r;
if (end_mom)
+;;;
;;; lilypond-mode.el --- Major mode for editing GNU LilyPond music scores
+;;;
+;;; source file of the GNU LilyPond music typesetter
+;;;
+;;; (c) 1999, 2000 Jan Nieuwenhuizen <janneke@gnu.org>
-;; Copyright (C) 1992,1993,1994 Tim Peters
-
-;; Author: 1999: Jan Nieuwenhuizen
-;; Author: 1997: Han-Wen Nienhuys
-;; Author: 1995-1996 Barry A. Warsaw
-;; 1992-1994 Tim Peters
-;; Created: Feb 1992
-;; Version: 0.0
-;; Last Modified: 12SEP97
-;; Keywords: mudela languages music
-
-;; This software is provided as-is, without express or implied
-;; warranty. Permission to use, copy, modify, distribute or sell this
-;; software, without fee, for any purpose and by any individual or
-;; organization, is hereby granted, provided that the above copyright
-;; notice and this paragraph appear in all copies.
-
-;; This started out as a cannabalised version of python-mode.el, by hwn
-;; For changes see the LilyPond ChangeLog
-;;
-;; TODO:
-;; * lily/ly/lilypond?
-;; * syntax
-;; - should handle block comments too.
-;; - handle lexer modes (\header, \melodic, \lyric) etc.
-;; - indentation
-;; - notenames?
-;; - fontlock: \melodic \melodic
-
-
-(defconst lily-version "1.3.19"
- "`lilypond-mode' version number.")
-
-(defconst lily-help-address "hanwen@cs.uu.nl"
- "Address accepting submission of bug reports.")
+;;; Inspired on auctex
-(defconst lily-font-lock-keywords
- (let* ((keywords '("spanrequest" "simultaneous" "sequential" "accepts"
- "autochange" "alternative" "bar" "breathe"
- "cadenza" "chordmodifiers" "chords" "clef" "cm" "consists"
- "consistsend" "context"
- "duration" "font" "grace" "header" "in" "lyrics"
- "key" "keysignature" "mark" "musicalpitch"
- "time" "times" "midi" "mm" "name" "notenames"
- "notes" "partial" "paper" "penalty" "push" "pop" "property" "pt"
- "relative" "remove" "repeat" "repetitions" "addlyrics"
- "scm" "scmfile" "score" "script"
- "shape" "skip" "textscript" "tempo" "translator" "transpose"
- "type" "version"
- ))
- (kwregex (mapconcat (lambda (x) (concat "\\\\" x)) keywords "\\|")))
-
- (list
- (concat ".\\(" kwregex "\\)[^a-zA-Z]")
- (concat "^\\(" kwregex "\\)[^a-zA-Z]")
- '(".\\(\\\\[a-zA-Z][a-zA-Z]*\\)" 1 font-lock-variable-name-face)
- '("^[\t ]*\\([a-zA-Z][_a-zA-Z]*\\) *=" 1 font-lock-variable-name-face)
- ))
- "Additional expressions to highlight in Mudela mode.")
-
-;; define a mode-specific abbrev table for those who use such things
-(defvar lilypond-mode-abbrev-table nil
- "Abbrev table in use in `lilypond-mode' buffers.")
-
-(define-abbrev-table 'lilypond-mode-abbrev-table nil)
-
-(defvar lilypond-mode-hook nil
- "*Hook called by `lilypond-mode'.")
-
-(defvar lily-mode-syntax-table nil
- "Syntax table used in `lilypond-mode' buffers.")
-
-;;
-(if lily-mode-syntax-table
- ()
- (setq lily-mode-syntax-table (make-syntax-table))
- (mapcar (function
- (lambda (x) (modify-syntax-entry
- (car x) (cdr x) lily-mode-syntax-table)))
- '(( ?\( . "()" ) ( ?\) . ")(" ) ; need matching parens for inline lisp
- ( ?\[ . "." ) ( ?\] . "." )
- ( ?\{ . "(}" ) ( ?\} . "){" )
- ( ?\< . "(>" )( ?\> . ")>")
- ( ?\$ . "." ) ( ?\% . "." ) ( ?\& . "." )
- ( ?\* . "." ) ( ?\+ . "." ) ( ?\- . "." )
- ( ?\/ . "." ) ( ?\= . "." )
- ( ?\| . "." ) (?\\ . "\\" )
- ( ?\_ . "." )
- ( ?\' . "w")
- ( ?\" . "\"" )
- ( ?\% . "<")
- ( ?\n . ">")
-
-; FIXME
-; ( ?% . ". 124b" )
-; ( ?{ . ". 23" )
- ))
-
- )
-
-(defconst lily-imenu-generic-re "^\\([a-zA-Z_][a-zA-Z0-9_]*\\) *="
- "Regexp matching Identifier definitions.")
-;; Sadly we need this for a macro in Emacs 19.
-(eval-when-compile
- ;; Imenu isn't used in XEmacs, so just ignore load errors.
- (condition-case ()
- (require 'imenu)
- (error nil)))
+(load-file "lilypond-font-lock.el")
-(defvar lily-imenu-generic-expression
- (list (list nil lily-imenu-generic-re 1))
- "Expression for imenu")
-
-
-;;; we're using some handy compile commands
+(require 'easymenu)
(require 'compile)
-(defcustom lily-command "lilypond"
- "* LilyPond executable."
- :type 'string
- :group 'lily)
+(defconst LilyPond-version "1.3.103"
+ "`LilyPond-mode' version number.")
-(defcustom lily-parameters ""
- "*."
- :type 'string
- :group 'lily)
+(defconst LilyPond-help-address "help-gnu-music@gnu.org"
+ "Address accepting submission of bug reports.")
-(defvar lily-regexp-alist
+(defvar LilyPond-mode-hook nil
+ "*Hook called by `LilyPond-mode'.")
+
+(defvar LilyPond-regexp-alist
'(("\\([a-zA-Z]?:?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2))
"Regexp used to match LilyPond errors. See `compilation-error-regexp-alist'.")
-(defcustom lily-tex-command "tex"
- "*."
+(defcustom LilyPond-include-path ".:/tmp"
+ "* LilyPond include path."
:type 'string
- :group 'lily)
+ :group 'LilyPond)
+
+
+(defun LilyPond-check-files (derived originals extensions)
+ "Check that DERIVED is newer than any of the ORIGINALS.
+Try each original with each member of EXTENSIONS, in all directories
+in LilyPond-include-path."
+ (let ((found nil)
+ (regexp (concat "\\`\\("
+ (mapconcat (function (lambda (dir)
+ (regexp-quote (expand-file-name dir))))
+ LilyPond-include-path "\\|")
+ "\\).*\\("
+ (mapconcat 'regexp-quote originals "\\|")
+ "\\)\\.\\("
+ (mapconcat 'regexp-quote extensions "\\|")
+ "\\)\\'"))
+ (buffers (buffer-list)))
+ (while buffers
+ (let* ((buffer (car buffers))
+ (name (buffer-file-name buffer)))
+ (setq buffers (cdr buffers))
+ (if (and name (string-match regexp name))
+ (progn
+ (and (buffer-modified-p buffer)
+ (or (not LilyPond-save-query)
+ (y-or-n-p (concat "Save file "
+ (buffer-file-name buffer)
+ "? ")))
+ (save-excursion (set-buffer buffer) (save-buffer)))
+ (if (file-newer-than-file-p name derived)
+ (setq found t))))))
+ found))
+
+(defun LilyPond-running ()
+ (let ((process (get-process "lilypond")))
+ (and process
+ (eq (process-status process) 'run))))
-(defcustom lily-xdvi-command "xdvi"
- "*."
- :type 'string
- :group 'lily)
+(defun LilyPond-kill-job ()
+ "Kill the currently running LilyPond job."
+ (interactive)
+ ;; What bout TeX, Xdvi?
+ (quit-process (get-process "lilypond") t))
-(defun lily-compile-file (command parameters file)
- ;; Setting process-setup-function makes exit-message-function work
- ;; even when async processes aren't supported.
- (let ((command-args (concat command " " parameters " " file)))
- (compile-internal command-args "No more errors" "LilyPond")))
+;; URG, should only run LilyPond-compile for LilyPond
+;; not for tex,xdvi (ly2dvi?)
+(defun LilyPond-compile-file (command name)
+ ;; We maybe should know what we run here (Lily, ly2dvi, tex)
+ ;; and adjust our error-matching regex ?
+ (compile-internal command "No more errors" name ))
;; do we still need this, now that we're using compile-internal?
-(defun lily-save-buffer ()
+(defun LilyPond-save-buffer ()
(if (buffer-modified-p) (save-buffer)))
;;; return (dir base ext)
(list dir (substring file 0 (- i 1)) (substring file i (length file)))
(list dir file ""))))
-;;;###autoload
-(defun lily-eval-buffer ()
- "Run LilyPond on buffer."
- (interactive)
- (let ((buffer (buffer-name)))
- (if (buffer-file-name)
- (progn
- (lily-save-buffer)
- (lily-compile-file lily-command lily-parameters (buffer-file-name)))
- (progn
- (error "Buffer %s is not associated with a file" buffer)
- (lily-eval-region (min-point) (max-point))))))
-
-;;;###autoload
-(defun lily-eval-region (start end)
- "Run LilyPond on region."
- (interactive "r")
- (let ((basename "emacs-lily")
- (suffix (if (string-match "^[\\]score" (buffer-substring start end))
- ".ly"
- (if (< 50 (abs (- start end)))
- ".fly"
- ".sly"))))
- (write-region start end (concat basename suffix) nil 'nomsg)
- (lily-compile-file lily-command lily-parameters (concat basename suffix))))
-
-(defun lily-running ()
- (let ((process (get-process "lilypond")))
- (and process
- (eq (process-status process) 'run))))
-(defun lily-tex-file (basename)
- (call-process lily-tex-command nil t nil basename))
-
-(defun lily-xdvi-file (basename)
- (let ((outbuf (get-buffer-create "*lily-xdvi*"))
- (name "xdvi")
- (command (concat lily-xdvi-command " " basename)))
- (if (get-process "xdvi")
- ;; Don't open new xdvi window, but force redisplay
- ;; We could make this an option.
- (signal-process (process-id (get-process "xdvi")) 'SIGUSR1)
- (if (fboundp 'start-process)
- (let* ((process-environment (cons "EMACS=t" process-environment))
- (proc (start-process-shell-command name outbuf command)))
- ;;(set-process-sentinel proc 'compilation-sentinel)
- ;;(set-process-filter proc 'compilation-filter)
- (set-marker (process-mark proc) (point) outbuf))
- ;;(setq compilation-in-progress (cons proc compilation-in-progress)))
-
- ;; No asynchronous processes available.
- (message "Executing `%s'..." command)
- ;; Fake modeline display as if `start-process' were run.
- (setq mode-line-process ":run")
- (force-mode-line-update)
- (sit-for 0) ; Force redisplay
- (call-process shell-file-name nil outbuf nil "-c" command)
- (message "Executing `%s'...done" command)))))
-
-
-;;;###autoload
-(defun lily-xdvi-buffer ()
- "Run LilyPond, TeX and Xdvi on buffer."
- (interactive)
+;; Should check whether in command-alist?
+(defvar LilyPond-command-default "LilyPond")
+;;;(make-variable-buffer-local 'LilyPond-command-last)
- (let* ((split (split-file-name buffer-file-name))
- (dir (car split))
- (base (cadr split)))
+(defvar LilyPond-command-current 'LilyPond-command-master)
+;;;(make-variable-buffer-local 'LilyPond-command-master)
- ;; we don't really need this...
- (let ((tex (concat dir base ".tex"))
- (dvi (concat dir base ".dvi")))
- (if (file-exists-p tex) (delete-file tex))
- (if (file-exists-p dvi) (delete-file dvi)))
- (lily-eval-buffer)
- (set-buffer "*lilypond*")
-
- ;;(setq default-directory dir)
- (while (lily-running)
- (continue-process (get-process "lilypond")))
- (sit-for 0) ; Force redisplay
-
- (if (= 0 (process-exit-status (get-process "lilypond")))
- (progn
- (if (= 0 (lily-tex-file base))
- (lily-xdvi-file base))))))
-
-;;;###autoload
-(defun lily-xdvi-region (start end)
- "Run LilyPond, TeX and Xdvi on region."
- (interactive "r")
+;; If non-nil, LilyPond-command-query will return the value of this
+;; variable instead of quering the user.
+(defvar LilyPond-command-force nil)
- (let ((dir default-directory)
- (base "emacs-lily"))
- ;; we don't really need this...
- (let ((tex (concat dir base ".tex"))
- (dvi (concat dir base ".dvi")))
- (if (file-exists-p tex) (delete-file tex))
- (if (file-exists-p dvi) (delete-file dvi)))
+;; This is the major configuration variable.
+(defcustom LilyPond-command-alist
+ '(
+ ("LilyPond" . ("lilypond %s" . "TeX"))
+ ("TeX" . ("tex '\\nonstopmode\\input %t'" . "View"))
- (lily-eval-region start end)
- (set-buffer "*lilypond*")
+ ;; point-n-click (arg: exits upop USR1)
+ ("SmartView" . ("xdvi %d" . "LilyPond"))
- ;;(setq default-directory dir)
- (while (lily-running)
- (continue-process (get-process "lilypond")))
- (sit-for 0) ; Force redisplay
+ ;; refreshes when kicked USR1
+ ("View" . ("xdvik %d" . "LilyPond"))
+ )
+
+ "AList of commands to execute on the current document.
+
+The key is the name of the command as it will be presented to the
+user, the value is a cons of the command string handed to the shell
+after being expanded, and the next command to be executed upon
+success. The expansion is done using the information found in
+LilyPond-expand-list.
+"
+ :group 'LilyPond
+ :type '(repeat (group (string :tag "Name")
+ (string :tag "Command")
+ (choice :tag "How"
+ :value LilyPond-run-command
+ (function-item LilyPond-run-command)
+ (function-item LilyPond-run-LilyPond)
+ (function :tag "Other"))
+ (boolean :tag "Prompt")
+ (sexp :format "End\n"))))
+
+;; drop this?
+(defcustom LilyPond-file-extensions '(".ly" ".sly" ".fly")
+ "*File extensions used by manually generated TeX files."
+ :group 'LilyPond
+ :type '(repeat (string :format "%v")))
+
+
+(defcustom LilyPond-expand-alist
+ '(
+ ("%s" . ".ly")
+ ("%t" . ".tex")
+ ("%d" . ".dvi")
+ ("%p" . ".ps")
+ )
- (if (= 0 (process-exit-status (get-process "lilypond")))
- (progn
- (if (= 0 (lily-tex-file base))
- (lily-xdvi-file base))))))
+ "Alist of expansion strings for LilyPond command names."
+ :group 'LilyPond
+ :type '(repeat (group (string :tag "Key")
+ (sexp :tag "Expander")
+ (repeat :inline t
+ :tag "Arguments"
+ (sexp :format "%v")))))
+
+
+(defcustom LilyPond-command-Show "View"
+ "*The default command to show (view or print) a LilyPond file.
+Must be the car of an entry in LilyPond-command-alist."
+ :group 'LilyPond
+ :type 'string)
+ (make-variable-buffer-local 'LilyPond-command-Show)
+
+(defcustom LilyPond-command-Print "Print"
+ "The name of the Print entry in LilyPond-command-Print."
+ :group 'LilyPond
+ :type 'string)
+
+(defun xLilyPond-compile-sentinel (process msg)
+ (if (and process
+ (= 0 (process-exit-status process)))
+ (setq LilyPond-command-default
+ (cddr (assoc LilyPond-command-default LilyPond-command-alist)))))
+
+;; FIXME: shouldn't do this for stray View/xdvi
+(defun LilyPond-compile-sentinel (buffer msg)
+ (if (string-match "^finished" msg)
+ (setq LilyPond-command-default
+ (cddr (assoc LilyPond-command-default LilyPond-command-alist)))))
+
+;;(make-variable-buffer-local 'compilation-finish-function)
+(setq compilation-finish-function 'LilyPond-compile-sentinel)
+
+(defun LilyPond-command-query (name)
+ "Query the user for what LilyPond command to use."
+ (let* ((default (cond ((if (string-equal name "emacs-lily")
+ (LilyPond-check-files (concat name ".tex")
+ (list name)
+ LilyPond-file-extensions)
+ ;; FIXME
+ (LilyPond-save-buffer)
+ ;;"LilyPond"
+ LilyPond-command-default))
+ (t LilyPond-command-default)))
+
+ (answer (or LilyPond-command-force
+ (completing-read
+ (concat "Command: (default " default ") ")
+ LilyPond-command-alist nil t))))
+
+ ;; If the answer is "LilyPond" it will not be expanded to "LilyPond"
+ (let ((answer (car-safe (assoc answer LilyPond-command-alist))))
+ (if (and answer
+ (not (string-equal answer "")))
+ answer
+ default))))
+
+
+;; FIXME: find ``\score'' in buffers / make settable?
+(defun LilyPond-master-file ()
+ ;; duh
+ (buffer-file-name))
+
+(defun LilyPond-command-master ()
+ "Run command on the current document."
+ (interactive)
+ (LilyPond-command (LilyPond-command-query (LilyPond-master-file))
+ 'LilyPond-master-file))
+
+(defun LilyPond-region-file (begin end)
+ (let (
+ ;; (dir "/tmp/")
+ ;; urg
+ (dir "./")
+ (base "emacs-lily")
+ ;; Hmm
+ (ext (if (string-match "^[\\]score" (buffer-substring begin end))
+ ".ly"
+ (if (< 50 (abs (- begin end)))
+ ".fly"
+ ".sly"))))
+ (concat dir base ext)))
+
+(defun LilyPond-command-region (begin end)
+ "Run LilyPond on the current region."
+ (interactive "r")
+ (write-region begin end (LilyPond-region-file begin end) nil 'nomsg)
+ (LilyPond-command (LilyPond-command-query
+ (LilyPond-region-file begin end))
+ '(lambda () (LilyPond-region-file begin end))))
-;;;###autoload
-(defun lily-kill-job ()
- "Kill the currently running LilyPond job."
+(defun LilyPond-command-buffer ()
+ "Run LilyPond on buffer."
(interactive)
- (quit-process (get-process "lilypond") t))
+ (LilyPond-command-region (point-min) (point-max)))
+
+(defun LilyPond-command-expand (string file)
+ (let ((case-fold-search nil))
+ (if (string-match "%" string)
+ (let* ((b (match-beginning 0))
+ (e (+ b 2))
+ (l (split-file-name file))
+ (dir (car l))
+ (base (cadr l)))
+ (LilyPond-command-expand
+ (concat (substring string 0 b)
+ dir
+ base
+ (let ((entry (assoc (substring string b e)
+ LilyPond-expand-alist)))
+ (if entry (cdr entry) ""))
+ (substring string e))
+ file))
+ string)))
+
+(defun LilyPond-command (name file)
+ "Run command NAME on the file you get by calling FILE.
+
+FILE is a function return a file name. It has one optional argument,
+the extension to use on the file.
+
+Use the information in LilyPond-command-alist to determine how to run the
+command."
+
+ (let ((entry (assoc name LilyPond-command-alist)))
+ (if entry
+ (let ((command (LilyPond-command-expand (cadr entry)
+ (apply file nil))))
+ (let* (
+ (buffer-xdvi (get-buffer "*view*"))
+ (process-xdvi (if buffer-xdvi (get-buffer-process buffer-xdvi) nil)))
+ (if (and process-xdvi
+ (string-equal name "View"))
+ ;; Don't open new xdvi window, but force redisplay
+ ;; We could make this an option.
+ (signal-process (process-id process-xdvi) 'SIGUSR1)
+ (progn
+ (setq LilyPond-command-default name)
+ (LilyPond-compile-file command name))))))))
+
+;; XEmacs stuff
+;; Sadly we need this for a macro in Emacs 19.
+(eval-when-compile
+ ;; Imenu isn't used in XEmacs, so just ignore load errors.
+ (condition-case ()
+ (require 'imenu)
+ (error nil)))
+
-;; hmm
-;; (kill-process (get-process "xdvi") t)
+;;; Keymap
-(defvar lily-mode-map ()
- "Keymap used in `lilypond-mode' buffers.")
+(defvar LilyPond-mode-map ()
+ "Keymap used in `LilyPond-mode' buffers.")
;; Note: if you make changes to the map, you must do
-;; M-x set-variable lily-mode-map nil
+;; M-x set-variable LilyPond-mode-map nil
;; M-x eval-buffer
-;; M-x lilypond-mode
+;; M-x LilyPond-mode
;; to let the changest take effect
-(if lily-mode-map
+
+(if LilyPond-mode-map
()
- (setq lily-mode-map (make-sparse-keymap))
- (define-key lily-mode-map [f9] 'lily-eval-buffer)
- (define-key lily-mode-map [f10] 'lily-xdvi-buffer)
- (define-key lily-mode-map [S-f9] 'lily-eval-region)
- (define-key lily-mode-map [S-f10] 'lily-xdvi-region)
- )
-
-(defun lilypond-mode ()
- "Major mode for editing Mudela files."
+ (setq LilyPond-mode-map (make-sparse-keymap))
+ (define-key LilyPond-mode-map "\C-c\C-c" 'LilyPond-command-master)
+ (define-key LilyPond-mode-map "\C-c\C-r" 'LilyPond-command-region)
+ (define-key LilyPond-mode-map "\C-c\C-b" 'LilyPond-command-buffer)
+ (define-key LilyPond-mode-map "\C-c\C-k" 'LilyPond-kill-job)
+ )
+
+;;; Menu Support
+
+(defun LilyPond-command-menu-entry (entry)
+ ;; Return LilyPond-command-alist ENTRY as a menu item.
+ (let ((name (car entry)))
+ (cond ((and (string-equal name LilyPond-command-Print)
+ LilyPond-printer-list)
+ (let ((command LilyPond-print-command)
+ (lookup 1))
+ (append (list LilyPond-command-Print)
+ (mapcar 'LilyPond-command-menu-printer-entry
+ LilyPond-printer-list))))
+ (t
+ (vector name (list 'LilyPond-command-menu name) t)))))
+
+
+(easy-menu-define LilyPond-mode-menu
+ LilyPond-mode-map
+ "Menu used in LilyPond mode."
+ (append '("Command")
+ '(("Command on"
+ [ "Master File" LilyPond-command-select-master
+ :keys "C-c C-c" :style radio
+ :selected (eq LilyPond-command-current 'LilyPond-command-master) ]
+ [ "Buffer" LilyPond-command-select-buffer
+ :keys "C-c C-b" :style radio
+ :selected (eq LilyPond-command-current 'LilyPond-command-buffer) ]
+ [ "Region" LilyPond-command-select-region
+ :keys "C-c C-r" :style radio
+ :selected (eq LilyPond-command-current 'LilyPond-command-region) ]))
+ (let ((file 'LilyPond-command-on-current))
+ (mapcar 'LilyPond-command-menu-entry LilyPond-command-alist))))
+
+
+(defconst LilyPond-imenu-generic-re "^\\([a-zA-Z_][a-zA-Z0-9_]*\\) *="
+ "Regexp matching Identifier definitions.")
+
+(defvar LilyPond-imenu-generic-expression
+ (list (list nil LilyPond-imenu-generic-re 1))
+ "Expression for imenu")
+
+(defun LilyPond-command-select-master ()
+ (interactive)
+ (message "Next command will be on the master file")
+ (setq LilyPond-command-current 'LilyPond-command-master))
+
+(defun LilyPond-command-select-buffer ()
+ (interactive)
+ (message "Next command will be on the buffer")
+ (setq LilyPond-command-current 'LilyPond-command-buffer))
+
+(defun LilyPond-command-select-region ()
+ (interactive)
+ (message "Next command will be on the region")
+ (setq LilyPond-command-current 'LilPond-command-region))
+
+(defun LilyPond-command-menu (name)
+ ;; Execute LilyPond-command-alist NAME from a menu.
+ (let ((LilyPond-command-force name))
+ (funcall LilyPond-command-current)))
+
+(defun LilyPond-mode ()
+ "Major mode for editing LilyPond music files."
(interactive)
;; set up local variables
(kill-all-local-variables)
(make-local-variable 'font-lock-defaults)
- (setq font-lock-defaults '(lily-font-lock-keywords))
+ (setq font-lock-defaults '(LilyPond-font-lock-keywords))
(make-local-variable 'paragraph-separate)
(setq paragraph-separate "^[ \t]*$")
(make-local-variable 'block-comment-end)
(setq block-comment-end "%}")
- ;; (make-local-variable 'comment-column)
- ;; (setq comment-column 40)
-
- (make-local-variable 'imenu-generic-expression)
- (setq imenu-generic-expression lily-imenu-generic-expression)
-
(make-local-variable 'indent-line-function)
(setq indent-line-function 'indent-relative-maybe)
- ;;
- (set-syntax-table lily-mode-syntax-table)
- (setq major-mode 'lilypond-mode)
- (setq mode-name "Mudela")
- (setq local-abbrev-table lilypond-mode-abbrev-table)
- (use-local-map lily-mode-map)
-
- ;; run the mode hook. lily-mode-hook use is deprecated
- (run-hooks 'lilypond-mode-hook))
-
-
-(defun lily-keep-region-active ()
- ;; do whatever is necessary to keep the region active in XEmacs.
- ;; Ignore byte-compiler warnings you might see. Also note that
- ;; FSF's Emacs 19 does it differently and doesn't its policy doesn't
- ;; require us to take explicit action.
- (and (boundp 'zmacs-region-stays)
- (setq zmacs-region-stays t)))
-
-
-;;(defun lily-comment-region (beg end &optional arg)
-;; "Like `comment-region' but uses double hash (`#') comment starter."
-;; (interactive "r\nP")
-;; (let ((comment-start lily-block-comment-prefix))
-;; (comment-region beg end arg)))
-\f
-(defun lily-version ()
- "Echo the current version of `lilypond-mode' in the minibuffer."
+ (set-syntax-table LilyPond-mode-syntax-table)
+ (setq major-mode 'LilyPond-mode)
+ (setq mode-name "LilyPond")
+ (setq local-abbrev-table LilyPond-mode-abbrev-table)
+ (use-local-map LilyPond-mode-map)
+
+ (make-local-variable 'imenu-generic-expression)
+ (setq imenu-generic-expression LilyPond-imenu-generic-expression)
+ (imenu-add-to-menubar "Index")
+
+ ;; run the mode hook. LilyPond-mode-hook use is deprecated
+ (run-hooks 'LilyPond-mode-hook))
+
+(defun LilyPond-version ()
+ "Echo the current version of `LilyPond-mode' in the minibuffer."
(interactive)
- (message "Using `lilypond-mode' version %s" lily-version)
- (lily-keep-region-active))
+ (message "Using `LilyPond-mode' version %s" LilyPond-version))
+
+(provide 'LilyPond-mode)
+;;; LilyPond-mode.el ends here
-(provide 'lilypond-mode)
-;;; lilypond-mode.el ends here
-% auto-beam-settings.ly
-% setup for auto-beam engraver
-%
-% specify generic beam end times
-
-% format:
-%
-% [time-signature]'beamAutoEnd'[duration]
-%
-% where
-%
-% time-signature = 'time'[numerator]'_'denominator; eg: 3_4
-% duration = [numerator]'_'denominator; eg: 3_8, _16
-%
-
-% in 3/2 time:
-% end beams each 1/2 note
-% end beams with 16th notes each 1/4 note
-% end beams with 32th notes each 1/8 note
-
-
-%{
-
-UGH UGH.
-
-Fixme: should use an alist
-
-autoBeamSettings = (list
- (cons (list (make-moment MEASURE) TIME-SIGNATURE) (make-moment INTERVAL)
- ..
-
- )
-
-
-
-%}
-
-time3_2beamAutoEnd = #(make-moment 1 2)
-%time3_2beamAutoEnd_16 = #(make-moment 1 4)
-time3_2beamAutoEnd_16 = #(make-moment 1 4)
-time3_2beamAutoEnd_32 = #(make-moment 1 8)
-
-time3_4beamAutoBegin_8 = #(make-moment 1 4)
-time3_4beamAutoEnd = #(make-moment 3 4)
-time3_4beamAutoBegin_16 = #(make-moment 1 16)
-time3_4beamAutoEnd_16 = #(make-moment 1 4)
-%time3_4beamAutoBegin_32 = #(make-moment 1 8)
-time3_4beamAutoEnd_32 = #(make-moment 1 8)
-
-time3_8beamAutoBegin_16 = #(make-moment 1 8)
-time3_8beamAutoEnd = #(make-moment 3 8)
-
-% in common time:
-% end beams each 1/2 note
-% end beams with 32th notes each 1/8 note
-% end beams with 1/8 triplets each 1/4 note
-
-time4_4beamAutoEnd = #(make-moment 1 2)
-time4_4beamAutoEnd_12 = #(make-moment 1 4)
-time4_4beamAutoEnd_16 = #(make-moment 1 4)
-time4_4beamAutoEnd_32 = #(make-moment 1 8)
-
-time2_4beamAutoEnd = #(make-moment 1 4)
-time2_4beamAutoEnd_12 = #(make-moment 1 4)
-time2_4beamAutoEnd_16 = #(make-moment 1 4)
-time2_4beamAutoEnd_32 = #(make-moment 1 8)
-
-
-time4_8beamAutoEnd = #(make-moment 1 4)
-time4_8beamAutoEnd_16 = #(make-moment 1 4)
-time4_8beamAutoEnd_32 = #(make-moment 1 8)
-
-time4_16beamAutoEnd = #(make-moment 1 8)
-
-time6_8beamAutoEnd = #(make-moment 3 8)
-time6_8beamAutoEnd_16 = #(make-moment 3 8)
-time6_8beamAutoEnd_32 = #(make-moment 1 8)
-
-time9_8beamAutoEnd = #(make-moment 3 8)
-time9_8beamAutoEnd_16 = #(make-moment 3 8)
-time9_8beamAutoEnd_32 = #(make-moment 1 8)
-
-time12_8beamAutoEnd = #(make-moment 3 8)
-time12_8beamAutoEnd_16 = #(make-moment 3 8)
-time12_8beamAutoEnd_32 = #(make-moment 1 8)
-
-
-
-%{
-
-Users may override in most cases, simply by issuing
-
- % from here on consider ending beam every 1/4 note
- \property Voice.beamAutoEnd = #(make-moment 1 4)
-
- % no autobeaming
- \property Voice.beamAuto = ##f
-
-or, more globally, by doing:
-
- \paper{
- \translator{
- \VoiceContext
- % consider ending beam at every 1/2 note
- beamAutoEnd = #(make-moment 1 2)
- }
- }
-
-see also input/test/auto-beam-override.ly
-
-%}
-
% TODO: uniform naming.;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
- \include "auto-beam-settings.ly";
-
}
OrchestralScoreContext= \translator {
--- /dev/null
+;;;
+;;; auto-beam.scm -- Auto-beam settings
+;;;
+;;; source file of the GNU LilyPond music typesetter
+;;;
+;;; (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;
+
+;;; setup for auto-beam engraver
+;;;
+;;; specify generic beam end times
+
+;;; format:
+;;;
+;;; [time-signature]'beamAutoEnd'[duration]
+;;;
+;;; where
+;;;
+;;; time-signature = 'time'[numerator]'_'denominator; eg: 3_4
+;;; duration = [numerator]'_'denominator; eg: 3_8, _16
+;;;
+
+;;; in 3/2 time:
+;;; end beams each 1/2 note
+;;; end beams with 16th notes each 1/4 note
+;;; end beams with 32th notes each 1/8 note
+
+
+;;;
+;;;UGH UGH.
+;;;
+;;;Fixme: should use an alist
+;;;
+;;;autoBeamSettings = (list
+;;; (cons (list (make-moment MEASURE) TIME-SIGNATURE) (make-moment INTERVAL)
+;;; ..
+;;;
+;;; )
+;;;
+;;;
+
+(define auto-beam-settings
+ (list
+ `(
+ ((end * * 3 2) . ,(make-moment 1 2))
+ ((end 1 16 3 2) . ,(make-moment 1 4))
+ ((end 1 32 3 2) . ,(make-moment 1 8))
+
+ ((begin 1 8 3 4) . ,(make-moment 1 4))
+
+ ((end * * 3 4) . ,(make-moment 3 4))
+ ((begin 1 16 3 4) . ,(make-moment 1 16))
+ ((end 1 16 3 4) . ,(make-moment 1 4))
+ ;;((begin 1 32 3 4) . ,(make-moment 1 8))
+ ((end 1 32 3 4) . ,(make-moment 1 8))
+
+ ((begin 1 16 3 8) . ,(make-moment 1 8))
+ ((end * * 3 8) . ,(make-moment 3 8))
+
+ ;; in common time:
+ ;; end beams each 1/2 note
+ ;; end beams with 32th notes each 1/8 note
+ ;; end beams with 1/8 triplets each 1/4 note
+
+ ((end * * 4 4) . ,(make-moment 1 2))
+ ((end 1 12 4 4) . ,(make-moment 1 4))
+ ((end 1 16 4 4) . ,(make-moment 1 4))
+ ((end 1 32 4 4) . ,(make-moment 1 8))
+
+ ((end * * 2 4) . ,(make-moment 1 4))
+ ((end 1 12 2 4) . ,(make-moment 1 4))
+ ((end 1 16 2 4) . ,(make-moment 1 4))
+ ((end 1 32 2 4) . ,(make-moment 1 8))
+
+
+ ((end * * 4 8) . ,(make-moment 1 4))
+ ((end 1 16 4 8) . ,(make-moment 1 4))
+ ((end 1 32 4 8) . ,(make-moment 1 8))
+
+ ((end * * 4 16) . ,(make-moment 1 8))
+
+ ((end * * 6 8) . ,(make-moment 3 8))
+ ((end 1 16 6 8) . ,(make-moment 3 8))
+ ((end 1 32 6 8) . ,(make-moment 1 8))
+
+ ((end * * 9 8) . ,(make-moment 3 8))
+ ((end 1 16 9 8) . ,(make-moment 3 8))
+ ((end 1 32 9 8) . ,(make-moment 1 8))
+
+ ((end * * 12 8) . ,(make-moment 3 8))
+ ((end 1 16 12 8) . ,(make-moment 3 8))
+ ((end 1 32 12 8) . ,(make-moment 1 8))
+ )))
+
+;;; Users may override in most cases, simply by issuing
+;;;
+;;; ;;; from here on consider ending beam every 1/4 note
+;;; \property Voice.beamAutoend1_1 = (make-moment 1 4)
+;;;
+;;; ;;; no autobeaming
+;;; \property Voice.beamAuto = f
+;;;
+;;;or, more globally, by doing:
+;;;
+;;; \paper{
+;;; \translator{
+;;; \VoiceContext
+;;; ;;; consider ending beam at every 1/2 note
+;;; beamAutoend1_1 = (make-moment 1 2)
+;;; }
+;;; }
+;;;
+;;; see also input/test/auto-beam-override.ly
+
(((0 . 0) (2 . 0) (4 . 0) (6 . -1)) . ("7"))
(((0 . 0) (2 . -1) (4 . 0) (6 . 0)) . ("m(maj7)"))
;jazz: the delta, see jazz-chords.ly
- ;;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (super ((font-family . "math") "N"))
+ ;;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (super ((font-family . math) "N"))
;; slashed o
(((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (rows ((raise . 1) "o") ((raise . 0.5) ((kern . -0.5) ((font-relative-size . -3) "/"))) "7")) ; slashed o
(((0 . 0) (2 . 0) (4 . 1) (6 . -1)) . ("aug7"))
)
chord::names-alist-american))
-;; Jazz chords, by Atte André Jensen
-;; Note: This uses the american list as a base
+;; Jazz chords, by Atte André Jensen <atte@post.com>
+;; NBs: This uses the american list as a base.
+;; Some defs take up more than one line,
+;; be carefull when messing with ;'s!!
+
+;; FIXME
+;;
+;; This is getting out-of hand? Only exceptional chord names that
+;; cannot be generated should be here.
+;; Maybe we should have inner-jazz-name and inner-american-name functions;
+;;
+;;
+;;
(define chord::names-alist-jazz '())
(set! chord::names-alist-jazz
(append
'(
- ; half diminished seventh chord = slashed o
- (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (("o" (type . "super")) ("/" (size . -2) (offset . (-0.58 . 0.5))) ))
- ; diminished seventh chord = o
- (((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (("o" (type . "super"))))
- ; major seventh chord = triangle
- (((0 . 0) (2 . 0) (4 . 0) (6 . 0)) . ((super ((font-family . "math") "N")) (size . -3)))
- ; minor major seventh chord = m triangle
- (((0 . 0) (2 . -1) (4 . 0) (6 . 0)) . (("m") ((super ((font-family . math) "N")) (size . -3))))
- ; augmented dominant = +7
- (((0 . 0) (2 . 0) (4 . +1) (6 . -1)) . (super "+7"))
+ ;; major chords
+ ; major sixth chord = 6
+ (((0 . 0) (2 . 0) (4 . 0) (5 . 0)) . (((raise . 0.5) "6")))
+ ; major seventh chord = triangle
+ (((0 . 0) (2 . 0) (4 . 0) (6 . 0)) . (((raise . 0.5)((font-family . "math") "M"))))
+ ; major chord add nine = add9
+ (((0 . 0) (2 . 0) (4 . 0) (1 . 0)) . (((raise . 0.5) "add9")))
+ ; major sixth chord with nine = 6/9
+ (((0 . 0) (2 . 0) (4 . 0) (5 . 0) (1 . 0)) . (((raise . 0.5) "6/9")))
+
+ ;; minor chords
+ ; minor sixth chord = m6
+ (((0 . 0) (2 . -1) (4 . 0) (5 . 0)) . (rows("m")((raise . 0.5) "6")))
+ ; minor major seventh chord = m triangle
+ (((0 . 0) (2 . -1) (4 . 0) (6 . 0)) . (rows ("m") ((raise . 0.5)((font-family . "math") "M"))))
+ ; minor seventh chord = m7
+ (((0 . 0) (2 . -1) (4 . 0) (6 . -1)) . (rows("m")((raise . 0.5) "7")))
+ ; minor sixth nine chord = m6/9
+ (((0 . 0) (2 . -1) (4 . 0) (5 . 0) (1 . 0)) . (rows("m")((raise . 0.5) "6/9")))
+ ; minor with added nine chord = madd9
+ (((0 . 0) (2 . -1) (4 . 0) (1 . 0)) . (rows("m")((raise . 0.5) "add9")))
+ ; minor ninth chord = m9
+ (((0 . 0) (2 . -1) (4 . 0) (6 . -1) (1 . 0)) . (rows("m")((raise . 0.5) "9")))
+
+ ;; dominant chords
+ ; dominant seventh = 7
+ (((0 . 0) (2 . 0) (4 . 0) (6 . -1)) . (((raise . 0.5) "7")))
+ ; augmented dominant = +7
+ ;(((0 . 0) (2 . 0) (4 . +1) (6 . -1)) . (((raise . 0.5) "+7"))) ; +7 with both raised
+ (((0 . 0) (2 . 0) (4 . +1) (6 . -1)) . (rows("+")((raise . 0.5) "7"))) ; +7 with 7 raised
+ ;(((0 . 0) (2 . 0) (4 . +1) (6 . -1)) . (rows((raise . 0.5) "7(")
+ ; ((raise . 0.3)(music (named ("accidentals-1"))))
+ ; ((raise . 0.5) "5)"))); 7(#5)
+ ; dominant flat 5 = 7(b5)
+ (((0 . 0) (2 . 0) (4 . -1) (6 . -1)) . (rows((raise . 0.5) "7(")
+ ((raise . 0.3)(music (named ("accidentals--1"))))
+ ((raise . 0.5) "5)")))
+ ; dominant 9 = 7(9)
+ (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . 0)) . (((raise . 0.8)"7(9)")))
+ ; dominant flat 9 = 7(b9)
+ (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . -1)) . (
+ ((raise . 0.8)"7(")
+ ((raise . 0.3)(music (named ("accidentals--1"))))
+ ((raise . 0.8)"9)")))
+ ; dominant sharp 9 = 7(#9)
+ (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . +1)) . (
+ ((raise . 0.8)"7(")
+ ((raise . 0.3)(music (named ("accidentals-1"))))
+ ((raise . 0.8)"9)")))
+ ; dominant 13 = 7(13)
+ (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (5 . 0)) . (((raise . 0.8)"7(13)")))
+ ; dominant flat 13 = 7(b13)
+ (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (5 . -1)) . (
+ ((raise . 0.8)"7(")
+ ((raise . 0.3)(music (named ("accidentals--1"))))
+ ((raise . 0.8)"13)")))
+ ; dominant 9, 13 = 7(9,13)
+ (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . 0) (5 . 0)) . (((raise . 0.8)"7(9, 13)")))
+ ; dominant flat 9, 13 = 7(b9,13)
+ (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . -1) (5 . 0)) . (
+ ((raise . 0.8)"7(")
+ ((raise . 0.3)(music (named ("accidentals--1"))))
+ ((raise . 0.8)"9, 13)")))
+ ; dominant sharp 9, 13 = 7(#9,13)
+ (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . +1) (5 . 0)) . (
+ ((raise . 0.8)"7(")
+ ((raise . 0.3)(music (named ("accidentals-1"))))
+ ((raise . 0.8)"9, 13)")))
+ ; dominant 9, flat 13 = 7(9,b13)
+ (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . 0) (5 . -1)) . (
+ ((raise . 0.8)"7(9, ")
+ ((raise . 0.3)(music (named ("accidentals--1"))))
+ ((raise . 0.8)"13)")))
+ ; dominant flat 9, flat 13 = 7(b9,b13)
+ (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . -1) (5 . -1)) . (
+ ((raise . 0.8)"7(")
+ ((raise . 0.3)(music (named ("accidentals--1"))))
+ ((raise . 0.8)"9, ")
+ ((raise . 0.3)(music (named ("accidentals--1"))))
+ ((raise . 0.8)"13)")))
+ ; dominant sharp 9, flat 13 = 7(#9,b13)
+ (((0 . 0) (2 . 0) (4 . 0) (6 . -1) (1 . +1) (5 . -1)) . (
+ ((raise . 0.8)"7(")
+ ((raise . 0.3)(music (named ("accidentals-1"))))
+ ((raise . 0.8)"9, ")
+ ((raise . 0.3)(music (named ("accidentals--1"))))
+ ((raise . 0.8)"13)")))
+
+ ;; diminished chord(s)
+ ; diminished seventh chord = o
+ ;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (((raise . 0.8)"o"))); works, but "o" is a little big
+ (((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (("°")))
+
+ ;; half diminshed chords
+ ; half diminished seventh chord = slashed o
+ (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (((raise . 0.8)"ø"))); works, but "ø" is a little big
+ ; half diminished seventh chord with major 9 = slashed o cancelation 9
+ (((0 . 0) (2 . -1) (4 . -1) (6 . -1) (1 . 0)) . (
+ ((raise . 0.8)"ø(")
+ ((raise . 0.3)(music (named ("accidentals-0"))))
+ ((raise . 0.8)"9)"))); works, but "ø" is a little big
;; Missing jazz chord definitions go here (note new syntax: see american for hints)
(collapse-height . 1.0)
(thickness . 1.6)
(arch-height . 1.5)
- (arch-angle . 25.0)
+ (arch-angle . 50.0)
(arch-thick . 0.25)
(glyph . bar-line)
(arch-width . 1.5)
(bracket-thick . 0.25)
- (bracket-width . 0.4)
+ (bracket-width . 2.0)
(font-family . braces)
(font-point-size . 20)
(Y-extent-callback . #f)
((-2 medium upright number feta-nummer 6) . "feta-nummer6")
((-3 medium upright number feta-nummer 5) . "feta-nummer5")
((-4 medium upright number feta-nummer 4) . "feta-nummer4")
+
+ ((4 medium upright roman cmr 20) . "cmr20")
+ ((3 medium upright roman cmr 16) . "cmr16")
((2 medium upright roman cmr 14) . "cmr14")
((1 medium upright roman cmr 12) . "cmr12")
((0 medium upright roman cmr 10) . "cmr10")
((-3 medium upright roman cmr 6) . "cmr6" )
((-4 medium upright roman cmr 5) . "cmr5" )
((-5 medium upright roman cmr 4) . "cmr4" )
- ((-3 medium italic roman cmti 5) . "cmti6")
- ((-2 medium italic roman cmti 6) . "cmti7")
- ((-1 medium italic roman cmti 8) . "cmti8")
- ((0 medium italic roman cmti 10) . "cmti10")
+
+ ((3 medium italic roman cmti 16) . "cmti16")
+ ((2 medium italic roman cmti 14) . "cmti14")
((1 medium italic roman cmti 12) . "cmti12")
+ ((0 medium italic roman cmti 10) . "cmti10")
+ ((-1 medium italic roman cmti 8) . "cmti8")
+ ((-2 medium italic roman cmti 7) . "cmti7")
+ ((-3 medium italic roman cmti 6) . "cmti6")
+
((2 bold upright roman cmbx 14) . "cmbx14")
((1 bold upright roman cmbx 12) . "cmbx12")
((0 bold upright roman cmbx 10) . "cmbx10")
((-1 bold upright roman cmbx 8) . "cmbx8")
((-2 bold upright roman cmbx 7) . "cmbx7")
- ((-3 medium upright math msam 10) . "msam10")
- ((-2 medium upright math msam 10) . "msam10")
- ((-1 medium upright math msam 10) . "msam10")
- ((0 medium upright math msam 10) . "msam10")
;; should use the same brace font every where and fix C++ code.
- ((0 medium upright braces feta-braces 20) . "feta-braces20")
+
((2 medium upright braces feta-braces 26) . "feta-braces26")
((1 medium upright braces feta-braces 23) . "feta-braces23")
- ((3 bold italic dynamic feta 13) . "feta-din13")
- ((2 bold italic dynamic feta 13) . "feta-din13")
- ((1 bold italic dynamic feta 11) . "feta-din11")
- ((0 bold italic dynamic feta 10) . "feta-din10")
- ((-1 bold italic dynamic feta 8) . "feta-din8")
- ((-2 bold italic dynamic feta 7) . "feta-din7")
- ((-3 bold italic dynamic feta 6) . "feta-din6")
- ((-4 bold italic dynamic feta 5) . "feta-din5")
- ((-5 bold italic dynamic feta 4) . "feta-din4")
+ ((0 medium upright braces feta-braces 20) . "feta-braces20")
+
+ ((3 bold italic dynamic feta-din 13) . "feta-din13")
+ ((2 bold italic dynamic feta-din 13) . "feta-din13")
+ ((1 bold italic dynamic feta-din 11) . "feta-din11")
+ ((0 bold italic dynamic feta-din 10) . "feta-din10")
+ ((-1 bold italic dynamic feta-din 8) . "feta-din8")
+ ((-2 bold italic dynamic feta-din 7) . "feta-din7")
+ ((-3 bold italic dynamic feta-din 6) . "feta-din6")
+ ((-4 bold italic dynamic feta-din 5) . "feta-din5")
+ ((-5 bold italic dynamic feta-din 4) . "feta-din4")
+
((2 medium upright music feta 26) . "feta26")
((1 medium upright music feta 23) . "feta23")
((0 medium upright music feta 20) . "feta20")
((-0.5 medium upright music feta 20) . "feta19")
((-1 medium upright music feta 16) . "feta16")
((-2 medium upright music feta 13) . "feta13")
- ((-3 medium upright music feta 13) . "feta11")
- ((-4 medium upright music feta 13) . "feta11")
+ ((-3 medium upright music feta 11) . "feta11")
+ ((-4 medium upright music feta 11) . "feta11")
+
+ ((0 medium upright math msam 10) . "msam10")
((-1 medium upright math msam 10) . "msam10")
((-2 medium upright math msam 10) . "msam10")
((-3 medium upright math msam 10) . "msam10")
(if (< x 0) -1 1)))
(define (gulp-file name)
- (let* ((port (open-file name "r"))
- (content (let loop ((text ""))
- (let ((line (read-line port)))
- (if (or (eof-object? line)
- (not line))
- text
- (loop (string-append text line "\n")))))))
- (close port)
- content))
+ (let* ((file (open-input-file name))
+ (text (read-delimited "" file)))
+ (close file)
+ text))
;; urg: Use when standalone, do:
;; (define ly-gulp-file scm-gulp-file)
(begin
(eval-string (ly-gulp-file "interface.scm"))
(eval-string (ly-gulp-file "slur.scm"))
- (eval-string (ly-gulp-file "font.scm"))
+ (eval-string (ly-gulp-file "font.scm"))
+ (eval-string (ly-gulp-file "auto-beam.scm"))
(eval-string (ly-gulp-file "generic-property.scm"))
(eval-string (ly-gulp-file "basic-properties.scm"))
(eval-string (ly-gulp-file "chord-names.scm"))
+;;;
+;;; slur.scm -- Slur scheme stuff
+;;;
+;;; source file of the GNU LilyPond music typesetter
+;;;
+;;; (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;
(define (attached-to-stem slur dir)
(let* ((note-columns (ly-get-elt-property slur 'note-columns))
-v,--version show version
"))
+;;
+;; FIXME: use (separate-fields-discarding-char) and (read-delimited "")
+;;
(define (gulp-file name)
(let ((port (if (equal? name "-")
(current-input-port)