]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4234: lilypond-what-beat.el: heed stand-alone durations in music lengths
authorDavid Kastrup <dak@gnu.org>
Mon, 29 Dec 2014 14:20:57 +0000 (15:20 +0100)
committerDavid Kastrup <dak@gnu.org>
Mon, 5 Jan 2015 18:51:06 +0000 (19:51 +0100)
elisp/lilypond-what-beat.el

index dae02d53d23f6f5bb1c6cff35e643abe56fd0f8f..3f11b843c1c34154bfce6fd57757471b63d57d21 100644 (file)
 ))
 
 (defun walk-note-duration ()
-"Returns duration of next note, moving point past note.
+  "Returns duration of next note, moving point past note.
 If point is not before a note, returns nil
 If next note has no duration, returns t"
-  (if (not (looking-at pitch-regex))
-      nil
-    (progn
+  (let ((have-pitch (looking-at pitch-regex)))
+    (if have-pitch (goto-char (match-end 0)))
+    (if (not (looking-at duration-regex))
+       have-pitch
       (goto-char (match-end 0))
-      (if (not (looking-at duration-regex))
-         t
-       (progn
-         (goto-char (match-end 0))
-         (parse-duration (match-string 0)))))))
+      (parse-duration (match-string 0)))))
 
 ; returns nil if not at a comment
 (defun skip-comment ()
@@ -161,7 +158,7 @@ If next note has no duration, returns t"
             (skip-quotation)
             (skip-sexp)))
   ; Now skip anything that isn't alphanum or \. And skip comments or quotations
-  (while (or (< 0 (skip-chars-forward "^A-Za-z<%}#=\""))
+  (while (or (< 0 (skip-chars-forward "^A-Za-z1-9<%}#=\""))
             (skip-comment)
             (skip-quotation)
             (skip-sexp)))