]> git.donarmstrong.com Git - lilypond.git/commitdiff
fix for \bar and ".
authorHeikki Junes <heikki.junes@hut.fi>
Fri, 30 Jul 2004 11:13:12 +0000 (11:13 +0000)
committerHeikki Junes <heikki.junes@hut.fi>
Fri, 30 Jul 2004 11:13:12 +0000 (11:13 +0000)
elisp/lilypond-what-beat.el

index 93e6b8c226ae09d11d7bbbdc74e3733c6b892b85..b7d7d98787d7f6d67bd3dff5a3d3f6194a80fcd3 100644 (file)
@@ -36,6 +36,8 @@
 ;\r
 ; -> Does not handle repeats.\r
 ;\r
+; -> Ignores \bar commands (and does not get confused by a | inside a \bar)\r
+;\r
 \r
 ; Recognizes pitch & octave\r
 (setq pitch-regex "\\([a-z]+[,']*\\|<[^>]*>\\)\\(=[,']*\\)?")\r
@@ -175,17 +177,26 @@ If next note has no duration, returns t"
        (goto-char (match-end 0))\r
        (if (member (match-string 1) Parm-Keywords)\r
            (progn\r
-             (if (looking-at "[ \t\n]*\\([a-z0-9_]+\\|{[^}]*}\\)")\r
+             (if (looking-at "[ \t\n]*?\\([a-z0-9_]+\\|{[^}]*}\\|\"[^\"]*\"\\)")\r
                  (goto-char (match-end 0))\r
                (error "Improper regex match:")\r
                (error "Unknown text: %s")\r
 ))))))\r
 \r
+(defun find-measure-start ()\r
+  (let ((start (re-search-backward "\|" 0 t)))\r
+    (if (null start)\r
+       -1\r
+      (if (looking-at "[^ \n\t]*\"")\r
+         (find-measure-start)\r
+       (point)\r
+))))\r
+\r
 (defun get-beat ()\r
   (save-excursion\r
     (save-restriction\r
       (let* ((end (point))\r
-            (measure-start (or (re-search-backward "\|" 0 t) -1))\r
+            (measure-start (find-measure-start))\r
             (last-dur (or (re-search-backward duration-regex 0 t) -1))\r
             (duration (if (= -1 last-dur) 0 (parse-duration (match-string 0))))\r
             (result '(0 1)))           ; 0 in fraction form\r