1

When using indent-region, emacs will indent code and leave bank spaces untouched. It seems to me that the majority prefer to delete whitespace. However I prefer white space indented with the code. An example is shown below.

void foo(){
    do_something();
--->
    do_something_else();
}

Let's say that the code is wrapped in an if block, then using indent-region the result is as follows.

void foo(){
    if(...){
        do_something();
--->
        do_something_else();
    }
}

How would I edit my .emacs file to include the whitespace with the indentation? The result should be the following.

void foo(){
    if(...){
        do_something();
------->
        do_something_else();
    }
}

Also note that I have replaced the electric-indent-post-self-insert-function with one that does not delete whitespace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.