LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-14-2005, 09:09 AM   #1
Mathsniper
Member
 
Registered: Aug 2004
Posts: 135

Rep: Reputation: 15
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.
 
Old 06-14-2005, 04:03 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
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
 
Old 06-14-2005, 11:05 PM   #3
Mathsniper
Member
 
Registered: Aug 2004
Posts: 135

Original Poster
Rep: Reputation: 15
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......
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tab width in Bash - how do I set it benr77 Linux - General 8 12-04-2012 10:53 AM
Tab stops in emacs regexps King of Men Linux - Software 0 11-07-2005 11:39 AM
Set mode within Emacs, still no syntax highlighting rose_bud4201 Linux - Software 4 07-19-2005 10:20 PM
emacs -> automaticly add Tab hylke Linux - Software 1 10-02-2004 11:44 AM
emacs-like tab in kdevelop s0ggyfish Programming 0 05-26-2003 03:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration