X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=elisp%2Flilypond-what-beat.el;h=e42f171e53b93d33dee4126f0f11898bf32111c9;hb=90e4d7057f3857da049dfda3d130017d4719bd6b;hp=7541a34e4a9ef14c15c9d9567badef55da6563d9;hpb=7639abf194db2ffb55a7caa2075d8b7820715ec5;p=lilypond.git diff --git a/elisp/lilypond-what-beat.el b/elisp/lilypond-what-beat.el index 7541a34e4a..e42f171e53 100644 --- a/elisp/lilypond-what-beat.el +++ b/elisp/lilypond-what-beat.el @@ -80,15 +80,15 @@ (defun parse-duration (duration) "Returns a duration string parsed as '(numerator denominator)" (string-match duration-regex duration) - (let ((result (list 1 (string-to-int (extract-match duration 2)))) + (let ((result (list 1 (string-to-number (extract-match duration 2)))) (dots (extract-match duration 4)) (numerator (or (extract-match duration 6) "1")) (denominator (or (extract-match duration 8) "1"))) (if (and (not (null dots)) (< 0 (string-width dots))) (dotimes (dummy (string-width dots)) (setq result (list (1+ (* 2 (car result))) (* 2 (cadr result)))))) - (list (* (string-to-int numerator) (car result)) - (* (string-to-int denominator) (cadr result))) + (list (* (string-to-number numerator) (car result)) + (* (string-to-number denominator) (cadr result))) )) (defun walk-note-duration () @@ -204,12 +204,15 @@ If next note has no duration, returns t" (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-number (match-string (if times-p 2 3)))) + (denominator (string-to-number (match-string (if times-p 3 2))))) (goto-char (match-end 0)) (goto-note-begin) (while (and (not (looking-at "}"))