X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=elisp%2Flilypond-what-beat.el;h=59a4fe1d526dea64d84c14c05a067d95027d9f94;hb=d2762a4f1add2bb04d6fc34d3c7ae03eeb7d500f;hp=7612138fec174c9f7b79951d936314d2c4546f46;hpb=716a2e4e4d20e34a01178d147b4ef6d9adad7d79;p=lilypond.git diff --git a/elisp/lilypond-what-beat.el b/elisp/lilypond-what-beat.el index 7612138fec..59a4fe1d52 100644 --- a/elisp/lilypond-what-beat.el +++ b/elisp/lilypond-what-beat.el @@ -199,18 +199,20 @@ If next note has no duration, returns t" (result '(0 1))) ; 0 in fraction form (if (= measure-start -1) (message "No | before point") - (progn - (goto-char (1+ measure-start)) - (goto-note-begin) - (while (< (point) end) - (setq new-duration (walk-note-duration)) + (goto-char (1+ measure-start)) + (goto-note-begin) + (while (< (point) end) + (let ((new-duration (walk-note-duration))) (if (null new-duration) - (if (not (looking-at "\\\\times[ \t]*\\([1-9]*\\)/\\([1-9]*\\)[ \t\n]*{")) + (if (not (looking-at + (concat "\\\\t\\(?:\\(imes\\)\\|uplet\\)[ \t]*\\([0-9]+\\)/\\([0-9]+\\)\\(?:[ \t\n]" + duration-regex "\\)?[ \t\n]*{"))) (skip-good-keywords) - ; handle \times specially - (let ((numerator (string-to-int (match-string 1))) - (denominator (string-to-int (match-string 2)))) + ; handle \times/\tuplet specially + (let* ((times-p (match-beginning 1)) + (numerator (string-to-int (match-string (if times-p 2 3)))) + (denominator (string-to-int (match-string (if times-p 3 2))))) (goto-char (match-end 0)) (goto-note-begin) (while (and (not (looking-at "}")) @@ -232,10 +234,9 @@ If next note has no duration, returns t" (if (not (eq new-duration t)) (setq duration new-duration)) (setq result (add-fractions result duration))) - (goto-note-begin)) + (goto-note-begin))) - result -)))))) + result))))) (defun LilyPond-what-beat () "Returns how much of a measure lies between last measaure '|' and point.