LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to set tab in Emacs? (https://www.linuxquestions.org/questions/linux-software-2/how-to-set-tab-in-emacs-333450/)

Mathsniper 06-14-2005 09:09 AM

How to set tab in Emacs?
 
When i was writing C language, it just indented 2 spaces. When i was writing Java language, 4 spaces were indented. Why? How to set tab in Emacs? like VIM.

foo_bar_foo 06-14-2005 04:03 PM

you set the c style in emacs in the ~/.emacs file
Code:

(add-hook 'c-mode-hook
              '(lambda ()
                (c-set-style "Stroustrup")
                (c-toggle-auto-state)))
(add-hook 'c++-mode-hook
              '(lambda ()
              (c-set-style "Stroustrup")
                (c-toggle-auto-state)))

look at Esc x c-set-style RETURN TAB
to see the available options
in order to alter one of these styles to suit your taste i think you will have to hack at cc-mode.el and change some of the variables in c-style-alist or just write a new style

Mathsniper 06-14-2005 11:05 PM

Quote:

Originally posted by foo_bar_foo
you set the c style in emacs in the ~/.emacs file
Code:

(add-hook 'c-mode-hook
              '(lambda ()
                (c-set-style "Stroustrup")
                (c-toggle-auto-state)))
(add-hook 'c++-mode-hook
              '(lambda ()
              (c-set-style "Stroustrup")
                (c-toggle-auto-state)))

look at Esc x c-set-style RETURN TAB
to see the available options
in order to alter one of these styles to suit your taste i think you will have to hack at cc-mode.el and change some of the variables in c-style-alist or just write a new style

/.emacs file doesn't exist......


All times are GMT -5. The time now is 10:46 PM.