You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running hs-hide-all (from hs-minor-mode) can lead to Scan error: "Unbalanced parentheses" when it shouldn't; once that happens, other things fail, like syntax highlighting.
It seems that hs-hide-all continues scanning beyond the boundaries of the code chunk.
The Rnw file does not have the line \newcommand{\blu}[1]{\textcolor{blue}{#1}} or that line is commented out. The culprit seems to be the # .
You load the file, but the hook does not include the hs-hide-all. In this second case, the file loads without error, but you can trigger the error by M-x hs-hide-all in the R chunk.
For now, a workaround I am using is to modify the hook, so that if the file ends on Rnw (and, since I am at it, in Rmd) hs-minor-mode is not enabled (or hs-hide-all is not called). (For anybody encountering this problem, this is what I do, and seems to work but, caveat emptor, this is from a complete elisp newby:
(defun prog-mode-hook-no-hide-all-in-polym ()
"hs-minor-mode and hs-hide-all, but in Rnw and Rmd
do not hs-hide-all, because it can break polymode.
I am not sure this only disables hs-hide-all : I think hs-minor-mode is
not enabled in ESS chunks. Well, no big deal for now."
(hs-minor-mode 1)
(unless (and (buffer-file-name)
(or (string-match-p "\\.Rnw\\'" (buffer-file-name))
(string-match-p "\\.Rmd\\'" (buffer-file-name))))
(hs-hide-all)))
(add-hook 'prog-mode-hook 'prog-mode-hook-no-hide-all-in-polym)
The text was updated successfully, but these errors were encountered:
rdiaz02
changed the title
hs-hide-all produces unbalanced parentheses when it shouldn't in at least Rnw buffers
hs-hide-all gives unbalanced parentheses error when it shouldn't in some Rnw buffers
Jan 29, 2024
Running
hs-hide-all
(from hs-minor-mode) can lead toScan error: "Unbalanced parentheses"
when it shouldn't; once that happens, other things fail, like syntax highlighting.It seems that
hs-hide-all
continues scanning beyond the boundaries of the code chunk.This is an exampe.
emacs -Q
and evaluateIf we find-file the file, we get
That error disappears if:
\newcommand{\blu}[1]{\textcolor{blue}{#1}}
or that line is commented out. The culprit seems to be the#
.hs-hide-all
. In this second case, the file loads without error, but you can trigger the error byM-x hs-hide-all
in the R chunk.For now, a workaround I am using is to modify the hook, so that if the file ends on Rnw (and, since I am at it, in Rmd) hs-minor-mode is not enabled (or hs-hide-all is not called). (For anybody encountering this problem, this is what I do, and seems to work but, caveat emptor, this is from a complete elisp newby:
The text was updated successfully, but these errors were encountered: