TAB Emacs ESS mode stops indentation

I am using Emacs 24 for Windows to write R code. Until 30 minutes ago, whenever I wrote a new function, ESS automatically inserted the lines following the declaration of the function, and pressing the tab key on a new empty line would transfer me to the corresponding position indented in the declaration.

EG:

foo <- function() { first line started here second line here. .etc } 

Now this is a heavy packaging of everything to the left and does not automatically indent after a function declaration or when I press the tab key.

 foo <- function() { first line second line } 

I have googled, but my google-fu doesn't give me that. Does anyone know how to restore the default tab behavior for ESS in Emacs?

+4
source share
3 answers

Try adding a space after the "#". I do not think that the ESS mode treats # as a comment if you have no place after it.

+1
source

for recording only. Whenever this happens, select the entire buffer Cx h and press CM- \ to separate the entire region. This will clearly show a syntax error.

+5
source

I just ran into the same problem you are describing.

None of the above worked, but I narrowed it down to using a carriage return, and then an open parenthesis inside the line, for example:

 ### indent ( <tab> ) working fine up to here s1 <- "string (then this in brackets)" ### now indent does nothing! 

The fact that it is balanced later does not help. I think EMACS reads this as opening a new expression / block, even though it appears on the quoted line. This, apparently, also applies to expressions of the expressions { and [ . This seems to happen when the "open expression" character appears at the beginning of a line ...

In my case, the line was part of the graph label, so \n was used instead.

0
source

Source: https://habr.com/ru/post/1439905/


All Articles