bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with emacs mode


From: Milan Zamazal
Subject: Re: Problem with emacs mode
Date: Mon, 27 Feb 2006 11:54:59 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>>>>> "CH" == Cameron Horsburgh <address@hidden> 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?

--- 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]