From: Heikki Junes Date: Fri, 30 Jul 2004 11:13:12 +0000 (+0000) Subject: fix for \bar and ". X-Git-Tag: release/2.3.10~29 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d8c36229d7a4c3a8b443bb8b47e2b1072164c072;p=lilypond.git fix for \bar and ". --- diff --git a/elisp/lilypond-what-beat.el b/elisp/lilypond-what-beat.el index 93e6b8c226..b7d7d98787 100644 --- a/elisp/lilypond-what-beat.el +++ b/elisp/lilypond-what-beat.el @@ -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 @@ If next note has no duration, returns t" (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