]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorJan Nieuwenhuizen <janneke@gnu.org>
Thu, 23 Feb 2006 09:08:48 +0000 (09:08 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Thu, 23 Feb 2006 09:08:48 +0000 (09:08 +0000)
ChangeLog
elisp/lilypond-mode.el

index de2fc4a1238fd4a59c4f949a46e30bd8df7ccca7..6f714be9320d66aa68b845bf147d735398221e61 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-02-23  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * elisp/lilypond-mode.el (count-matches-as-number): New funtion
+       for emacs < 22 compatibility.
+       (count-rexp): Use it.
+       (LilyPond-string-current-midi, LilyPond-string-all-midi): Remove
+       substring juggling (Milan Zamazal).
+
 2006-02-23  Graham Percival  <gpermus@gmail.com>
 
        * Documentation/user/ basic-notation, advanced-notation,
index 56db4cfc2c790a5001b3b077090abd284e0fe922..db3c8caf4ed77866eceb35ecb6181f8b362966cb 100644 (file)
@@ -367,6 +367,13 @@ in LilyPond-include-path."
   (interactive)
   (LilyPond-command (LilyPond-command-menu "MidiAll") 'LilyPond-get-master-file))
 
+(defun count-matches-as-number (re)
+  "Count-matches in emacs 22 backwards-incompatibly returns a number"
+  (let ((result (count-matches re)))
+    (if (stringp result)
+       (string-to-number result)
+      result)))
+    
 (defun count-rexp (start end rexp)
   "Print number of found regular expressions in the region."
   (interactive "r")
@@ -374,7 +381,7 @@ in LilyPond-include-path."
     (save-restriction
       (narrow-to-region start end)
       (goto-char (point-min))
-      (count-matches rexp))))
+      (count-matches-as-number rexp))))
 
 (defun count-midi-words ()
   "Check number of midi-scores before the curser."
@@ -393,8 +400,8 @@ in LilyPond-include-path."
   (let ((fnameprefix (if (eq LilyPond-command-current 'LilyPond-command-master)
                         (substring (LilyPond-get-master-file) 0 -3); suppose ".ly"
                       LilyPond-region-file-prefix))
-       (allcount (string-to-number (substring (count-midi-words) 0 -12)))
-       (count (string-to-number (substring (count-midi-words-backwards) 0 -12))))
+       (allcount (count-midi-words))
+       (count (count-midi-words-backwards)))
     (concat  fnameprefix
             (if (and (> allcount 1) (> count 0)) ; not first score
                 (if (eq count allcount)          ; last score
@@ -407,7 +414,7 @@ in LilyPond-include-path."
   (let ((fnameprefix (if (eq LilyPond-command-current 'LilyPond-command-master)
                         (substring (LilyPond-get-master-file) 0 -3); suppose ".ly"
                       LilyPond-region-file-prefix))
-       (allcount (string-to-number (substring (count-midi-words) 0 -12))))
+       (allcount (count-midi-words)))
     (concat (if (> allcount 0)  ; at least one midi-score
                (concat fnameprefix ".midi "))
            (if (> allcount 1)  ; more than one midi-score