[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-bug
Subject:    Re: Problem with emacs mode
From:       Milan Zamazal <pdm () brailcom ! org>
Date:       2006-02-27 10:54:59
Message-ID: 87ek1p6ph8.fsf () blackbird ! zamazal ! org
[Download RAW message or body]

>>>>> "CH" == Cameron Horsburgh <cammo@netcall.com.au> writes:

    CH> Well, I applied that patch. LilyPond-mode loads okay in 21.4
    CH> (although I haven't tested it) but still no joy in 22.0. 

Oops, I've tested it with Emacs 21.4 by mistake.  Here is a patch
against LilyPond 2.7.36 that should work with both Emacs 21.4 and CVS
Emacs.  Could you please test it?


[Attachment #3 (text/x-patch)]

--- lilypond-mode.el.orig	2006-02-27 11:49:51.000000000 +0100
+++ lilypond-mode.el	2006-02-27 11:48:10.000000000 +0100
@@ -370,11 +370,14 @@
 (defun count-rexp (start end rexp)
   "Print number of found regular expressions in the region."
   (interactive "r")
-  (save-excursion
-    (save-restriction
-      (narrow-to-region start end)
-      (goto-char (point-min))
-      (count-matches rexp))))
+  (let ((count (save-excursion
+		 (save-restriction
+		   (narrow-to-region start end)
+		   (goto-char (point-min))
+		   (count-matches rexp)))))
+    (if (stringp count)
+	(setq count (string-to-number (substring count 0 -12))))
+    count))
 
 (defun count-midi-words ()
   "Check number of midi-scores before the curser."
@@ -393,8 +396,8 @@
   (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 +410,7 @@
   (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

Regards,

Milan Zamazal


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic