简体   繁体   中英

Emacs C-Mode Indentation in Windows Frequently Stops Working

I am using emacs on Windows 7 and am using c-mode. Indentation starts out fine, but frequently, it stops working fine (what happens is that when I press the tab key, instead of indenting to where it normally would if things worked correctly, it would get rid of all indentation on that line). I have found that re-activating c-mode made everything work nicely again.

This happens anywhere in the code. If I have existing code and tab (even in the first lines of a main function), it will remove all indentation. I am almost 100% sure it isn't because I failed with my syntax somewhere. For example, if I have the following code, pressing "tab" on the second line will remove all indentation.

int main() {
    printf("Foo\r\n");
    return 0;
}

I don't believe c-mode suddenly disables (all of the syntax highlighting still exists, and the "C/l Abbrev" is still there on the bottom of the window). Any insights would be appreciated.

Most likely, you're hitting a bug in CC-mode, which results in a messed-up parse-state cache. The best thing you can do: Mx report-emacs-bug and try to come up with a reproducible test case. You can also try to upgrade to the latest Emacs (I know that the upcoming 24.4 has bug-fixes in that area, as did previous releases).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM