To close out the thread I report that my issue was related to lsp-mode rather than ESS.
On a Windows 10 machine with emacs 27.1, I was able to get the intended formatting with: (setq lsp-enable-on-type-formatting nil) Apologies for posting to the wrong list, and thanks again. On Wed, Jun 2, 2021, at 19:01, Vincent Arel-Bundock via ESS-help wrote: > Jeremie, > > This is quite embarrassing, but the behavior does NOT replicate under > vanilla emacs. I should have done my research! > > I will track down the source of the issue in my config, and report back > if it is interesting. > > Thank you for taking the time to answer and sorry for wasting inbox space! > > Vincent > > > On Wed, Jun 2, 2021, at 17:37, Jeremie Juste wrote: > > > > Hello Vincent, > > > > On Wednesday, 2 Jun 2021 at 09:14, Vincent Arel-Bundock via ESS-help wrote: > > > Hi all, > > > > > > Thanks for your awesome work on ESS! > > > > > > I use the data.table package with chains of square brackets, and would > > > like to indent my code as follows: > > > > > > library(data.table) > > > dat = data.table(mtcars) > > > dat[ > > > cyl == 4][ > > > , gear := gear * 3] > > > > > > However, when I type this code, new lines get inserted automatically and > > > I get this: > > > > > > dat[ > > > cyl == 4 > > > ][ > > > , gear := gear * 3 > > > ] > > I cannot reproduce this behavior. Could you try with a vanilla emacs? > > > > In the terminal > > > > $ emacs -Q > > > > then execute > > > > (add-to-list 'load-path "path to ess") > > (require 'ess-site) > > > > Can you still reproduce the behavior? > > If yes, could you specify which OS, emacs version and ESS version are > > you currently using? > > > > HTH, > > Jeremie > > > > ______________________________________________ > ESS-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/ess-help > ______________________________________________ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help