On 31 okt 2005, at 7:23, Robert J. Cristel wrote:
I'm using tei-emacs, lilypond 2.6.4, on win98se.
Copied lilypond_init.el into .emacs
Copied lilypond emacs-mode files to site-lisp\lilypond directory.
This seemed to work as here is load-path:
<snip value="load-path" />
Robert,
This is something that has annoyed me tremendously since I first
started to use lilypond. However it didn't bother me enough to delve
into it yet.
My emacs version is from an early september cvs snapshot on Mac OS X
I always get this message, but my emacs seems to grok it anyway.
Let's dig into it. There is something wrong in the post-command-hook
when lilypond-mode is loaded. In lilypond-mode.el we find:
(add-hook 'post-command-hook 'LilyPond-mode-context-set-syntax-
table nil t)
So presumably the error is somewhere in the defun LilyPond-mode-
context-set-syntax-table. This is defined in lilypond-font-lock.el,
but when I try to instrument that function for debugging, it gets me
nowhere.
Luckily that function is (interactive), so I can call it with M-x
LilyPond-mode-context-set-syntax-table, and now I can find the culprit:
(cond ((nth 3 context)) ; inside string
((nth 4 context)) ; inside a comment
((eq (char-syntax (char-before (point))) ?\\)) ; found escape-char
<== Gives an error
((and (eq (char-syntax (char-before (- (point) 1))) ?\\)
(memq (char-before (point)) '( ?\) ?\] )))) ; found escape-char
((memq (char-before (point)) '( ?\) ))
The line that says
((eq (char-syntax (char-before (point))) ?\\)) ; found escape-char
fails the first time. At this moment (point) is at (point-min) so
(char-before (point)) will return nil and, at least in my version of
emacs, (char-syntax nil) will fail.
By changing it to something like
((eq (char-syntax (char-before (max (point) 2))) ?\\)) ; found
escape-char
it should work again. This should be done for all calls to (char-
before (point)) in this function. So it's better to replace the top
of the (cond) statement with something like:
(cond ((bobp)) ; we cannot grok the context at beginning of the
buffer
((eq (point-min) (point-max))) ; empty buffers don't have context
((eq (+ (point-min) 1) (point))) ; to prevent an obiwan error
((nth 3 context)) ; inside string
((nth 4 context)) ; inside a comment
((eq (char-syntax (char-before (point))) ?\\)) ; found escape-char
((and (eq (char-syntax (char-before (- (point) 1))) ?\\)
(memq (char-before (point)) '( ?\) ?\] )))) ; found escape-char
((memq (char-before (point)) '( ?\) ))
Strange thing is though, that when I tested it it broke something on
a midi function. I remembered doing some tinkering with these defuns
as well, so I downloaded the latest unstable (2.7.15-1) and tested
its lilypond mode by opening a few .ly files and the error did not
pop-up! The code of the above defun is still the same as above, so if
a lilypond developer would be so kind as to look into my suggestions,
I'd be most obliged.
Let me know how you're doing!
Kind regards,
Arjan Bos
---
A marriage is always made up of two people who are prepared to swear
that only the other one snores.
-- (Terry Pratchett, The Fifth Elephant)
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user