emacs: "error in post-command-hook: (wrong-type-argument integerp nil)"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

emacs: "error in post-command-hook: (wrong-type-argument integerp nil)"

Robert J. Cristel-2
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:

load-path's value is
("c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/emacs-21.3/leim"
"c:/PROGRAM FILES/TEI
EMACS/xslt-process/lisp" "c:/PROGRAM
FILES/TEI
EMACS/EMACS-21.3/site-lisp/nxml-mode/"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp" "c:/PROGRAM
FILES/TEI
EMACS/EMACS-21.3/site-lisp/cedet-common"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/eieio"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/elib"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/lilypond"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/nxml-mode"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/ocaml"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/psgml"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/semantic"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/speedbar"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/tdtd"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/tei-emacs"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/tuareg"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/ucs"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/xslide"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/cedet-common/icons"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/nxml-mode/char-name"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/semantic/bovine"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/semantic/wisent"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/ucs/Mule-UCS-current"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/ucs/big5conv"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/ucs/jisx0213"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/ucs/reldata"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/nxml-mode/char-name/unicode"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/ucs/Mule-UCS-current/doc"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/ucs/Mule-UCS-current/lisp"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/ucs/Mule-UCS-current/lisp/big5conv"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/ucs/Mule-UCS-current/lisp/jisx0213"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/site-lisp/ucs/Mule-UCS-current/lisp/reldata"
"C:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/../site-lisp" "C:/PROGRAM
FILES/TEI EMACS/EMACS-21.3/lisp"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/lisp/toolbar" "c:/PROGRAM
FILES/TEI EMACS/EMACS-21.3/lisp/textmodes"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/lisp/progmodes"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/lisp/play" "c:/PROGRAM
FILES/TEI EMACS/EMACS-21.3/lisp/obsolete"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/lisp/net" "c:/PROGRAM
FILES/TEI EMACS/EMACS-21.3/lisp/mh-e"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/lisp/mail" "c:/PROGRAM
FILES/TEI EMACS/EMACS-21.3/lisp/language"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/lisp/international"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/lisp/gnus" "c:/PROGRAM
FILES/TEI EMACS/EMACS-21.3/lisp/eshell"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/lisp/emulation"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/lisp/emacs-lisp"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/lisp/calendar"
"c:/PROGRAM FILES/TEI
EMACS/EMACS-21.3/lisp/calc" "C:/PROGRAM
FILES/TEI EMACS/EMACS-21.3/leim")




_______________________________________________
lilypond-user mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: emacs: "error in post-command-hook: (wrong-type-argument integerp nil)"

Arjan Bos

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
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-user