[ESS] Broken parsing from compilation output in inferior-ess-r-mode

Stephen Berman @tephen@berm@n @end|ng |rom gmx@net
Tue Jun 1 17:39:55 CEST 2021

I have (define-key inferior-ess-r-mode-map "_" #'ess-insert-assign) in
my init file.  After installing R on a new system and starting ESS
(built from the Github repo at commit
e21ce9b260ff2ae0f162624ae3888c60bca3ae55) I called install.packages()
and after that, typing `_' only inserted that character instead of `<-'.
I tracked the problem down to certain lines of the compilation output
from the install.packages() invocation.  In particular, this line from
the compilation output of nlopt:

sed 's/\"/\\"/g' ./nlopt_optimize.m | sed 's,^% ,\",;s,^%,\",;s,$,\\n\" \\,' >> nlopt_optimize_usage.h

With point at the third to last `"' in this line, (nth 3 (syntax-ppss
(point))) returns nil, but with point at any later position in the
buffer (nth 3 (syntax-ppss (point))) returns 34.  If I insert `"' at the
end of the above line, that corrects the subsequent buffer parsing,
until the following line later in the output of nlopt:

   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

With point at ``' (nth 3 (syntax-ppss (point))) returns nil, but with
point at any later position (until the end of the buffer) (nth 3
(syntax-ppss (point))) returns 96.  If I insert ``' at the end of the
above line (after `''), this again corrects the buffer parsing, now for
the rest of the buffer.

I can reproduce these observations in inferior-ess-r-mode in a fresh R
session without actual compilation output from install.packages() simply
by inserting the above lines into the buffer.  However, in a buffer in
ess-r-mode inserting the above sed line does not corrupt the parsing but
inserting the second line does.  Can anyone here replicate this?

I'm not sure if this is a bug in ESS or in Emacs (perhaps in
comint-mode, the grandparent of inferior-ess-r-mode, or in prog-mode,
the grandparent of ess-r-mode).  Any ideas?

Steve Berman

More information about the ESS-help mailing list