Berkeley CSUA MOTD:Entry 12982
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/07/08 [General] UID:1000 Activity:popular
7/8     

2004/4/2-4 [Computer/SW/Editors/Emacs] UID:12982 Activity:moderate
4/2     problem with emacs. After I use it for a while (2-3 hours), the
        indentation went from 4 (default that I set and prefer) to 2.
        I have no idea why this is happening. Can someone tell me how
        to fix it? I tried M-x load-file .emacs but indentation sticks at
        2. Thanks.
        \_ this question was answered already. search the archives.
        \_ (setq-default c-basic-offset 4)  At least, that's what's in
           the archives.
        \_ So the following works for c, but somehow doesn't work for
           java, anyone know why?
                (setq         indent-level 2)
                (setq         c-indent-level 2)
                (setq         c-basic-indent 2)
                (setq         c-basic-offset 2)   ; this works!
                (setq-default c-basic-offset 2)   ; this works!
                ; none of the followings work!
                (setq         java-indent-level 4)
                (setq         java-basic-indent 4)
                (setq         java-basic-offset 4)
                (setq-default java-basic-offset 4)
           \_ maybe because there isn't a java-basic-offset variable, duh.
              java-mode is just a part of cc-mode.
                \_ so, in another word, emacs only allows 1 indentation
                   for all the modes?
                   \_ of course not. it just uses that sort of naming
                      convention. do 'info ccmode' and look at the section
                      on hooks.
        \_ USE PENCIL!
           \_ HUG TREE!
              \_ LIGHT CANDLE!
                 \_ CURSE THE GLARE!
                    \_ that's "CURSE GLARE!"
                       \_ AVOID PRONOUNS!
                          \_ LOOKUP "ARTICLE"!
                 \_ can you guys FUCK OFF!
                    \_ USE LINUX!
                    \_ CONTROL ANGER!!!!!
                       \_ ESCHEW !!!! !
        \_ (setq-default c-basic-offset 4)
        \_ Use M-x view-lossage to check what keystrokes you recently pressed.
           Maybe you changed the setting by mistake yourself.