Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacs function c-forward-sws: Wrong type argument: stringp, nil

I've been getting this error in emacs whenever I type anything in certain buffers:

c-forward-sws: Wrong type argument: stringp, nil

It seems to be a syntax highlighting thing; I'm getting it in a buffer that's in sh-mode whenever I type anything -- even return on an empty line. I have also occasionally gotten it in a C++-mode buffer but I don't remember the specific line, nor can I reproduce it in such a mode.

I have not changed my .emacs lately (that I can recall).

Any ideas what the problem is? The function is defined in cc-engine.el but I'm having a hard time figuring out the context.

like image 205
Anne Avatar asked Jan 14 '10 13:01

Anne


1 Answers

Chances are good that you have auto-fill-mode on and the auto-fill-function is c-do-auto-fill, which doesn't work so well for other languages. Either turn auto fil off (M-x auto-fill-mode) or change the value of the fill function.

You should be able to debug the entry to auto-fill-mode explicitly with M-x debug-on-entry RET auto-fill-mode and see what's invoking it. There's probably a hook that's turning it on, which will appear in the stack trace.

[Update]

I found that the global value of auto-fill-function was being set (it's supposed to always be buffer-local). The result is that all buffers default to using auto fill with that function. I haven't determined how the global value is being set, but it can be cleared up using (setq-default auto-fill-function nil).

like image 123
Kirk Kelsey Avatar answered Nov 15 '22 04:11

Kirk Kelsey