Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3872314
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T21:54:44+00:00 2026-05-19T21:54:44+00:00

Being read about indent style , now I must change my current indent style

  • 0

Being read about indent style, now I must change my current indent style from Banner Style, to Allman Style. I’ve changed the indent style using c-set-style and choosing bsd. But, now how do I apply the new indent style?

That is, can emacs reformat my code, and apply this new coding stye?
How can I configure emacs to use this sytle to be my java default style.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T21:54:44+00:00Added an answer on May 19, 2026 at 9:54 pm

    You can use indent-region to apply your indentation settings. If you want to re-indent the whole buffer, mark-whole-buffer (C-x h) followed by indent-region (C-M-\) should do it.

    EDIT:

    If you want to automatically move the braces onto their own lines, as in the style you cite, you’ll have to do some regexp replacements as well. The following might be a start:

    (query-replace-regexp "^\\([^{}\n]+[^{} \t\n]+[^{}\n]*\\)\\([{}]\\)$" "\\1\n\\2")     
    

    This will take any { or } character that is the last character on a line and put it on its own line. It will ignore any {} characters that are the first character on their lines. You may need to follow this with:

    (query-replace-regexp "^\\(\\s *[{}]\\)\\(.+\\)$" "\\1\n\\2") 
    

    This will take any {} characters that are first on their line and are followed by other characters, and insert a newline between the brace and the other characters.

    Following this, my original suggestion of mark-whole-buffer and indent-region should correct the indentation.

    EDIT 2: fixed the first regexp to account for leading whitespace

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to write binary data into XML using LINQ which is being read from
I read about small talk being completely object oriented.. is C++ also completely object
I read that SHA-1 is being retired from the FIPS 180-2 standard. Apparently there
I constantly read about it being a good practise to convert a string to
I've read about null bytes \0 and read about file_exists not being secure... Can
Every time I read about using synchronized in Scala the author will usually mention
I am currently using Java, I've read a lot about Erlang on the net,
I've read about this operator on a book but being that I don't use
I'm looking to protect small parts of my source code from being read when
I read about implicit conversions being done between different value class types. The book

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.