[ESS] change font-lock-string-face for back ticks

Peter Meilstrup peter.meilstrup at gmail.com
Tue Feb 18 19:06:52 CET 2014


On Tue, Feb 18, 2014 at 8:56 AM, Vitalie Spinu <spinuvit at gmail.com> wrote:

> Could you please post a full setup that you have for % customization?

Here's what I have for ESS/R customization:
https://gist.github.com/crowding/9075782

pbm-find-grapes does the deemphasizing of % in a probably expensive manner.

> While foo$boo is not a symbol in R, it functions semantically as a
> symbol and when emacs/ESS operates on that symbol through commands like
> symbol-at-point, forward-symbol etc, it better recognize it as a whole
> entity. Unless there is a serious reason to change that, I would prefer
> not to.

I don't see how $ or @ can be said to form "semantic" symbols. The
left sides of these operators are evaluated normally, and can be any
expression such as data.frame(a=2, b=4)$a. They are accessors; if
foo$bar is a symbol so would have to be foo["bar"]. I rather
explicitly don't want forward-sexp to skip past a $ given my usual
editing habits.

For "::" and ":::" there is a case for saying these form effective
symbols, as they are non-evaluating and only take names on either
side.

>
> [...]
>
>  >>
>  >> Modifying font-lock-syntactic-face-function just for the sake of % seems
>  >> like an overkill, but could in principle be added if many more people
>  >> find it annoying how %foo% is highlighted right now.
>
>  > That would break on the example provided, `%weirdly-named-function` as
>  > well as `weirdly"named-function` and things that regularly end up as
>  > object component names like `a:b` and so on. I make heavy use of
>  > paredit and sexp-level movement commands; if I issue
>  > delete-forward-sexp it should not leave me with unbalanced backticks
>  > or %, any more than it should leave me with unbalanced paren or
>  > quotes.
>
> I got confused here. Are you suggesting against accommodating % as a
> quote, or against removing quoting behavior of ` ?

Against removing quoting behavior of `. I think I accidentally cut the
paragraph I was replying to.

> --
> As an asside, I am using smart-parents with non-lisp code, and quite
> frankly, a lot of times it is rather painfull, enough to offset the
> benefits. Never got down to configuring it properly to my needs. What is
> your trick with paredit? Are you using paredit-everywhere or cedit?

Plain paredit with some modifications
(https://github.com/crowding/paredit/commits/master). I should look
into the other alternatives when I have more time.

One thing you should fix is that ess-beginning-of-defun breaks Emacs
conventions. Whatever beginning-of-defun-function does, it should
always find _some_ location and not throw errors; the most frequent
use of beginning-of-defun is when minor modes like paredit and
font-lock need to find some point at which it is safe to start running
parse-partial-sexp.

Paredit is not ideal in comma-ful languages, but I still find it
useful. However there's a particular quirk with ESS I haven't tracked
down:

type "foo, bar", put point between the words, and hit M-T
(transpose-words). Then try again in C-mode or some such. In C-mode
you get "bar, foo" but ESS you get "barfoo, " which is not
particularly useful.

Peter



More information about the ESS-help mailing list