Sorry I've been out of touch...had other things to do. At any rate, I've made some requested fixes to what-beat.el. Here is a patch to my last what-beat.el. This patch fixes two problems:
-> what-beat barfed on \clef "treble_8". (specifically on the quotes) Fixed. -> What-beat got confused by a | inside a \bar command. It now ignores | inside \bar commands. (It also ignores \bar commands, BTW...you have to delimit measures with | for what-beat to work.) I finished building the music score I was working on...about 30 rock songs. Tonight I get $ for the effort :) Thanks, Lilypond! On Tuesday 13 July 2004 04:09 am, Heikki Johannes Junes wrote: > On Mon, 12 Jul 2004 22:24:46 +0200 Han-Wen Nienhuys <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] writes: > > > | and point), I get a useless 'end of buffer' message instead of a > > > > > > beat count. > > > > > > I'll fix \bar if you want, but offhand I'm inclined not to. It's easy > > > to add | before or after \bar "|", for when you want measures counted > > > before/after \bar. In other words, yes its a bug, but there's an easy > > > workaround, and fixing the bug would be for the sake of completeness, > > > rather than adding functionality. > > > > It's also a strange request, the \bar "|" does not affect measure > > timing, and | does not take it into account. > > When looking at a score, \bar "|" is typically from which I start to count > notes. If I understood the point properly, it is possible that the measure > timing and the places of bar lines need not to be syncronized. Maybe that > is the case in modern metric music, but isn't it more due to the laziness > of a composer (which often is the source of a true inspiration! ;) that not > all > time-signatures are being written out. > > IMHO, \bar "anystring", or simply, "anystring" should just be skipped > properly. In other words, one would attach which-bar to the | marks only: > > { | c4 d e f |\bar ":|:" g a b c' |\bar "|." } > > Then, if you put dotted \bar ":" in the middle of a cycle, or an empty \bar > "" in case of a forced line break, the counter would not be confused. -- David Svoboda [EMAIL PROTECTED] Senior Research Programmer http://www.cs.cmu.edu/~svoboda Language Technologies Institute Practice Kind Randomness and Carnegie Mellon University Beautiful Acts of Nonsense
--- elisp/lilypond-what-beat.el Fri Jul 9 10:54:24 2004 +++ ../elisp/lilypond-what-beat.el Wed Jul 28 14:20:45 2004 @@ -36,6 +36,8 @@ ; ; -> Does not handle repeats. ; +; -> Ignores \bar commands (and does not get confused by a | inside a \bar) +; ; Recognizes pitch & octave (setq pitch-regex "\\([a-z]+[,']*\\|<[^>]*>\\)\\(=[,']*\\)?") @@ -175,17 +177,26 @@ (goto-char (match-end 0)) (if (member (match-string 1) Parm-Keywords) (progn - (if (looking-at "[ \t\n]*\\([a-z0-9_]+\\|{[^}]*}\\)") + (if (looking-at "[ \t\n]*?\\([a-z0-9_]+\\|{[^}]*}\\|\"[^\"]*\"\\)") (goto-char (match-end 0)) (error "Improper regex match:") (error "Unknown text: %s") )))))) +(defun find-measure-start () + (let ((start (re-search-backward "\|" 0 t))) + (if (null start) + -1 + (if (looking-at "[^ \n\t]*\"") + (find-measure-start) + (point) +)))) + (defun get-beat () (save-excursion (save-restriction (let* ((end (point)) - (measure-start (or (re-search-backward "\|" 0 t) -1)) + (measure-start (find-measure-start)) (last-dur (or (re-search-backward duration-regex 0 t) -1)) (duration (if (= -1 last-dur) 0 (parse-duration (match-string 0)))) (result '(0 1))) ; 0 in fraction form
_______________________________________________ lilypond-devel mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/lilypond-devel