unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Anders Lindgren <andlind@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel <emacs-devel@gnu.org>
Subject: Re: Regarding Emacs, js.el, template-strings and syntax-tables
Date: Tue, 5 Sep 2017 11:30:51 +0200	[thread overview]
Message-ID: <CABr8ebYX8Hq5nXOm-XRgaW+BXnbQ1dB5FYQBt=LfgtKTJMf9Eg@mail.gmail.com> (raw)
In-Reply-To: <6ca801de-9076-8a7f-6a7e-3b73ce207671@yandex.ru>

[-- Attachment #1: Type: text/plain, Size: 2621 bytes --]

>
> In my experience, I can read code easier if the delimiters aren't
>> highlighted the same way the content is. (In other words, the current Ruby
>> implementation isn't ideal for me.)
>>
>
> Yes, so in the case of ruby-mode, the delimiters will have some special
> face (keyword? IDK), and the content will have the default face.


Keyword-face or builtin-face on top of string-face would work well.


While we're on the subject. I've been thinking about highlighting
>> parameters in functions and blocks in Ruby.
>>
>
> Let's maybe make it an optional mode, so ruby-mode doesn't stand out too
> much (or discuss whether all modes should do that if possible, on
> emacs-devel). But I've been looking at this too, albeit from a different
> standpoint (completion of local variable names).


An optional mode would do nicely.


It wouldn't be too difficult, and it would make code easier to read.
>> Unfortunately, it doesn't include all variables as local variables can be
>> created on the fly using a plain assignment in Ruby.
>>
>
> Finding assignments is easy (just a regexp). Tracking variable scopes
> (defined by their belonging to methods, or blocks, or even class/module
> bodies) looks harder to me. We can do that by parsing expressions with
> SMIE, but that's not fast if we have to parse the whole class body (there
> are some big classes out there).
>
> Limiting ourselves to only methods might be fine, though.


Methods and do-blocks would be straight forward, and make Ruby code a lot
easier to read.


As a parallel, my lisp-extra-font-lock package (
>> https://github.com/Lindydancer/lisp-extra-font-lock) do this in Lisp
>> modes for function and lambda parameters and local variables introduces
>> using `let`, `dolist` et.c. Now that I've been using it for a couple of
>> years, I would not dream of going back to the near black-and-white world of
>> the default lisp modes.
>>
>
> I like the idea, but seeing the red on the screenshot is a bit
> off-putting. red is for errors.
>

The screenshot demonstrates all features at once, so it might look a bit
overwhelming -- in normal code it doesn't highlight that much.

I've opted to define new faces and make them inherit from the predefined.
This allows the faces to be customized (e.g. if you don't like red), and
they work when a custom theme is used. I settled on the warning face for
two constructs, as it was the least bad one available. So far, I've never
misinterpreted a highlighted variable name for an error, or vise versa.

Anyway, I understand your concern. I'll revisit this and see if there is
another way to do it.

    -- Anders

[-- Attachment #2: Type: text/html, Size: 4275 bytes --]

  reply	other threads:[~2017-09-05  9:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24  6:56 Regarding Emacs, js.el, template-strings and syntax-tables Jostein Kjønigsen
2017-08-24 10:53 ` Stefan Monnier
2017-08-24 12:13   ` Jostein Kjønigsen
2017-08-24 12:17     ` Jostein Kjønigsen
2017-08-24 13:47       ` Stefan Monnier
2017-08-24 14:04     ` Stefan Monnier
2017-08-24 12:31   ` Anders Lindgren
2017-08-24 14:20     ` Stefan Monnier
2017-08-27 16:37       ` Dmitry Gutov
2017-08-24 14:22     ` Stefan Monnier
2017-08-24 15:19       ` Anders Lindgren
2017-08-29 13:36         ` Stefan Monnier
2017-08-29 13:49           ` Anders Lindgren
2017-08-30  2:22             ` Richard Stallman
2017-09-01 12:14               ` Anders Lindgren
2017-09-04 23:40     ` Dmitry Gutov
2017-09-05  7:00       ` Anders Lindgren
2017-09-05  8:25         ` Dmitry Gutov
2017-09-05  9:30           ` Anders Lindgren [this message]
2017-09-05  9:53             ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABr8ebYX8Hq5nXOm-XRgaW+BXnbQ1dB5FYQBt=LfgtKTJMf9Eg@mail.gmail.com' \
    --to=andlind@gmail.com \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).