Closed maxecharel closed 2 months ago
Hi @lionel- , sorry for the delay before answer. I will add to the existing unit tests for font-locking end of this week. I will get back to you. Thanks for the great work with ESS !
Hi @lionel- , your feedback would be welcome concerning the two following issues I encountered when adding to the unit tests:
\()
passes the ess-test-r-fontification-keywords-fn-test
test, I had to go for a 'trial and error' approach that I describe below. To investigate the reasons why it failed in the first place, I would like to get access to the ERT test buffer (not just the results) to see how the string is printed. Any idea how to do so?ess-test-r-fontification-keywords-disabled-backquoted-defun
), i.e.:
Concerning (1), at first ess-test-r-fontification-keywords-fn-test
failed. It was rather surprising given that manually executing (face-at-point)
in my minimal Emacs testing config worked as expected:
Anyway, ERT indicated a failure whenever the relevant string was set (in the
:case
string) to \\\\()
, \\()
or even \()
(with the pilcrow character located at the relevant place depending on :case
or :result
).
My first guess was that the problem comes from the way ERT, based on the :case
of ess-test-r-fontification-keywords-fn-test
, prints the string representing \()
in a test buffer. After some trials and errors, I ended up using group delimiters --- i.e. I went for \\(\\\\\\)()
--- and it passed the test. Yet I am not satisfied with this, and I would like to get a deeper understanding of what happened exactly. Is there any way I can get access to the actual test buffer in which the expressions contained in :case
are printed and actually tested? Or am I missing the point and there is no creation of such buffer?
Thanks. Best, Max
@maxecharel I will try to find time to take a look this week.
@lionel- some updates (to keep you posted and as notes for myself):
\()
were not fontified; solved with commit 5c24a72 by modifying ess-r-font-lock-syntactic-face-function
ess-R-function-name-regexp
while I was investigating the previous issue and fixed it with commit 49bcd58:
One question remains, and one has been added (this one will certainly require your feedback at some point, sorry for that)
ess-r-mode
and ess-r-transcript-mode
(as well as inferior-ess-r-mode
) all reference ess-r-font-lock-syntactic-face-function
, but they (except the latter mode) also set a local add-log-current-defun-header-regexp
including a string in the spirit of "<- function". However, here it looks like we enter a world that goes beyond font-locking (and therefore the scope of this PR). When you have the opportunity, could you just confirm this? Anyway I will set that aside for now, and will try to find the time to dig into it later.
Cheers!Sorry I don't have any bandwidth for this :/
Let's just merge your work.
Adds font-locking support for R function shorthand notation
\()
and for names of functions defined using this shorthand notation. Also makes the shorthand notation a recognized function pattern.