lilypond-devel
[Top][All Lists]
Advanced

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

lilypond-mode for emacs20 patch


From: Laurent Martelli
Subject: lilypond-mode for emacs20 patch
Date: Fri, 20 Feb 2004 21:12:43 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/20.7 (gnu/linux)

lilypond-mode does not work anymore in emacs20 because it uses
(buffer-size <buffer>) whereas in emacs20, buffer-size does not take
any argument. I made a quick hack to workaround the problem:

*** /home/laurent/src/debian/lilypond-2.0.3/elisp/lilypond-mode.el      
2003-09-23 22:20:17.000000000 +0200
--- tmp/lilypond-mode.el        2004-02-20 21:01:16.000000000 +0100
***************
*** 74,79 ****
--- 74,89 ----
    "Contains all words: \keywords \Identifiers and ReservedWords."
    (nconc '(("" . 1)) x))
  
+ (if (> emacs-major-version 20)
+     (defun get-buffer-size (b) (buffer-size b))
+   (defun get-buffer-size (b)
+     (let (size (current-buffer (current-buffer)))
+       (set-buffer b)
+       (setq size (buffer-size))
+       (set-buffer current-buffer)
+       size
+     )))
+ 
  ;; creates dictionary if empty
  (if (and (eq (length (LilyPond-add-dictionary-word ())) 1)
         (not (eq (LilyPond-words-filename) nil)))
***************
*** 81,87 ****
        (setq b (find-file-noselect (LilyPond-words-filename) t t))
        (setq m (set-marker (make-marker) 1 (get-buffer b)))
        (setq i 1)
!       (while (> (buffer-size b) (marker-position m))
        (setq i (+ i 1))
        (setq copy (copy-alist (list (eval (symbol-name (read m))))))
        (setcdr copy i)
--- 91,97 ----
        (setq b (find-file-noselect (LilyPond-words-filename) t t))
        (setq m (set-marker (make-marker) 1 (get-buffer b)))
        (setq i 1)
!       (while (> (get-buffer-size b) (marker-position m))
        (setq i (+ i 1))
        (setq copy (copy-alist (list (eval (symbol-name (read m))))))
        (setcdr copy i)
***************
*** 865,879 ****
     ;; find the place first
     (if (LilyPond-mark-active)
         (goto-char (min (mark-marker) (point-marker))))
!    (while (and (not found) (> (buffer-size b) (marker-position m)))
      (setq copy (car (copy-alist (list (eval (symbol-name (read m)))))))
      (if (string-equal word copy) (setq found t)))
     (if found (insert word))
!    (if (> (buffer-size b) (marker-position m))
         (setq copy (car (copy-alist (list (eval (symbol-name (read m))))))))
     (if (not (string-equal "-" copy)) 
         (setq found nil))
!    (while (and found (> (buffer-size b) (marker-position m)))
      ;; find next symbol
      (setq copy (car (copy-alist (list (eval (symbol-name (read m)))))))
      ;; check whether it is the word, or the word has been found
--- 875,889 ----
     ;; find the place first
     (if (LilyPond-mark-active)
         (goto-char (min (mark-marker) (point-marker))))
!    (while (and (not found) (> (get-buffer-size b) (marker-position m)))
      (setq copy (car (copy-alist (list (eval (symbol-name (read m)))))))
      (if (string-equal word copy) (setq found t)))
     (if found (insert word))
!    (if (> (get-buffer-size b) (marker-position m))
         (setq copy (car (copy-alist (list (eval (symbol-name (read m))))))))
     (if (not (string-equal "-" copy)) 
         (setq found nil))
!    (while (and found (> (get-buffer-size b) (marker-position m)))
      ;; find next symbol
      (setq copy (car (copy-alist (list (eval (symbol-name (read m)))))))
      ;; check whether it is the word, or the word has been found


-- 
Laurent Martelli
address@hidden                                Java Aspect Components
http://www.aopsys.com/                             http://jac.aopsys.com

reply via email to

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