unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Bozhidar Batsov <bozhidar@batsov.com>
To: Dmitry Gutov <dgutov@yandex.ru>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Small improvements to ruby-mode
Date: Sat, 13 Jul 2013 13:24:34 +0300	[thread overview]
Message-ID: <CAM9Zgm1raBLhVvjJ9jo8FrCnbRhhVjeZhP4n95uqsCbYPDrJzA@mail.gmail.com> (raw)
In-Reply-To: <CAM9Zgm2NbtNkm8p+SL=kYd-u90r5ELTvJrj4rxm8_Yk5QVN4WA@mail.gmail.com>

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

Accidentally sent my last reply only to Dmitry instead of the emacs-devel.
Sorry about that.


On 13 July 2013 13:23, Bozhidar Batsov <bozhidar@batsov.com> wrote:

> On 12 July 2013 23:31, Dmitry Gutov <dgutov@yandex.ru> wrote:
>
>> On 11.07.2013 15:23, Bozhidar Batsov wrote:
>>
>>> Still, we should consider functions with names like Float. Currently
>>> they are not highlighted correctly - Something(test) is highlighted as a
>>> constant, when obviously it's not.
>>>
>>
>> Fixed, among other things, see the patch at the bottom. We don't
>> highlight method calls, so I just disabled highlighting in this case.
>
>
> Great! Btw, shouldn't we highlight the conversion methods from Kernel
> (Float, Integer, etc) as built-ins?
>
>
>>
>>
>> > I guess classes, constants and
>>
>>> functions like this could be font-locked after the first character
>>> that's not part of the identifier name appears, to avoid the changing of
>>> the face after the initial character.
>>>
>>
>> Function calls can be identified by having a paren after the name (no
>> luck with parenless calls).
>>
>> But there's really nothing that would distinguish a Math::E reference
>> from Foo::C. Or from GC, IO, DL, IRB, URI, XML, HTML, etc.
>>
>
> Yep, I'm aware we can't distinguish all cases without the use of a proper
> parser, but I guess we should handle accordingly at least the scenarios
> which are deterministic.
>
>
>>
>> === modified file 'lisp/progmodes/ruby-mode.el'
>> --- lisp/progmodes/ruby-mode.el 2013-07-09 01:17:48 +0000
>> +++ lisp/progmodes/ruby-mode.el 2013-07-12 20:07:57 +0000
>> @@ -1351,7 +1351,7 @@
>>      (progn
>>        (eval-and-compile
>>          (defconst ruby-percent-literal-beg-re
>> -          "\\(%\\)[qQrswWx]?\\([[:punct:**]]\\)"
>> +          "\\(%\\)[qQrswWxIi]?\\([[:**punct:]]\\)"
>>            "Regexp to match the beginning of percent literal.")
>>
>>          (defconst ruby-syntax-methods-before-**regexp
>> @@ -1387,7 +1387,7 @@
>>            (funcall
>>             (syntax-propertize-rules
>>              ;; $' $" $` .... are variables.
>> -            ;; ?' ?" ?` are ascii codes.
>> +            ;; ?' ?" ?` are character literals (one-char strings in
>> 1.9+).
>>              ("\\([?$]\\)[#\"'`]"
>>               (1 (unless (save-excursion
>>                            ;; Not within a string.
>> @@ -1518,7 +1518,7 @@
>>              (save-match-data
>>                (save-excursion
>>                  (goto-char (nth 8 parse-state))
>> -                (looking-at "%\\(?:[QWrx]\\|\\W\\)")))))))
>> +                (looking-at "%\\(?:[QWrxI]\\|\\W\\)"))))))**)
>>
>>        (defun ruby-syntax-propertize-**expansions (start end)
>>          (save-excursion
>> @@ -1848,8 +1848,11 @@
>>     '("\\(\\$\\|@\\|@@\\)\\(\\w\\|**_\\)+"
>>       0 font-lock-variable-name-face)
>>     ;; constants
>> -   '("\\(?:\\_<\\|::\\)\\([A-Z]+\**\(\\w\\|_\\)*\\)"
>> -     1 font-lock-type-face)
>> + '("\\(?:\\_<\\|::\\)\\([A-Z]+\**\(\\w\\|_\\)*\\)\\(?:\\_>[^\(]**
>> \\|::\\|\\'\\)"
>> +     1 (progn
>> +         (when (eq ?: (char-before))
>> +           (forward-char -2))
>> +         font-lock-type-face))
>>     '("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]
>> **" 2 font-lock-constant-face)
>>     ;; expression expansion
>>     '(ruby-match-expression-**expansion
>> @@ -1857,6 +1860,9 @@
>>     ;; negation char
>>     '("[^[:alnum:]_]\\(!\\)[^=]"
>>       1 font-lock-negation-char-face)
>> +   ;; character literals
>> +   ;; FIXME: Support longer escape sequences.
>> +   '("\\?\\\\?\\S " 0 font-lock-string-face)
>>     )
>>    "Additional expressions to highlight in Ruby mode.")
>>
>>
>

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

  parent reply	other threads:[~2013-07-13 10:24 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21 16:00 Small improvements to ruby-mode Bozhidar Batsov
2013-06-21 19:10 ` Stefan Monnier
2013-06-21 23:31   ` Dmitry Gutov
2013-06-21 23:45     ` Glenn Morris
2013-06-22  0:12       ` Dmitry Gutov
2013-06-22  7:05     ` Bozhidar Batsov
2013-06-22 13:28       ` Dmitry Gutov
2013-06-22 15:30         ` Stefan Monnier
2013-06-23  6:20         ` Bozhidar Batsov
2013-06-23 12:30           ` Dmitry Gutov
2013-06-24 13:49             ` Bozhidar Batsov
2013-07-01 18:32               ` Dmitry Gutov
2013-07-01 21:41                 ` Bozhidar Batsov
2013-07-01 21:50                   ` Dmitry Gutov
     [not found]                     ` <CAM9Zgm3Uw-TfW9aT7zdA1r=etsb26xAcW7DHJ_7=NfArFE8e5A@mail.gmail.com>
2013-07-02 18:38                       ` Dmitry Gutov
2013-07-03 15:46                         ` Dmitry Gutov
     [not found]                           ` <CAM9Zgm1_Jmn7Z4ZwSkPURAFOdTCURQP-TEDeys0dR4Uqyr8mfw@mail.gmail.com>
2013-07-05 10:30                             ` Dmitry Gutov
2013-07-05 11:08                               ` Stefan Monnier
2013-07-05 11:55                                 ` Dmitry Gutov
2013-07-05 22:18                                   ` Stefan Monnier
2013-07-05 13:01                               ` Bozhidar Batsov
2013-07-05 14:15                                 ` Dmitry Gutov
2013-07-06  5:31                                   ` Bozhidar Batsov
2013-07-06  9:37                                     ` Dmitry Gutov
2013-07-06 12:23                                       ` Bozhidar Batsov
2013-07-06 15:47                                         ` Dmitry Gutov
2013-07-07 21:56                                     ` Stefan Monnier
2013-07-07 23:22                                       ` Dmitry Gutov
2013-07-08  9:22                                         ` Stefan Monnier
2013-07-09  0:40                                           ` Dmitry Gutov
2013-07-09  8:50                                             ` Stefan Monnier
2013-07-09 12:57                                             ` Bozhidar Batsov
2013-07-08  9:33                                       ` Bozhidar Batsov
2013-07-08  9:37                                         ` Bozhidar Batsov
2013-07-09  1:19                                           ` Dmitry Gutov
2013-07-09 12:55                                             ` Bozhidar Batsov
2013-07-09 14:36                                               ` Bozhidar Batsov
2013-07-09 16:07                                                 ` Bozhidar Batsov
2013-07-09 17:18                                                   ` Dmitry Gutov
2013-07-10  6:23                                                     ` Bozhidar Batsov
2013-07-09 17:09                                                 ` Dmitry Gutov
2013-07-10  6:09                                                   ` Bozhidar Batsov
2013-07-10 18:09                                                     ` Dmitry Gutov
2013-07-11 11:23                                                       ` Bozhidar Batsov
2013-07-12 20:31                                                         ` Dmitry Gutov
     [not found]                                                           ` <CAM9Zgm2NbtNkm8p+SL=kYd-u90r5ELTvJrj4rxm8_Yk5QVN4WA@mail.gmail.com>
2013-07-13 10:24                                                             ` Bozhidar Batsov [this message]
2013-07-13 19:10                                                             ` Dmitry Gutov
2013-07-15 13:53                                                               ` Bozhidar Batsov
2013-07-16 13:18                                                                 ` Bozhidar Batsov
2013-07-16 14:47                                                                   ` Dmitry Gutov
2013-08-08 15:56                                                                     ` Bozhidar Batsov
2013-08-08 21:21                                                                       ` Dmitry Gutov
2013-08-08 22:47                                                                         ` Stefan Monnier
2013-08-08 23:54                                                                           ` Dmitry Gutov
2013-08-09 14:52                                                                             ` Stefan Monnier
2013-08-10 11:45                                                                               ` Dmitry Gutov
2013-08-10 13:23                                                                                 ` Stefan Monnier
2013-08-11 11:54                                                                                 ` Bozhidar Batsov
2013-08-11 13:08                                                                                   ` Dmitry Gutov
2013-08-11 14:08                                                                                     ` Johan Andersson
2013-08-11 14:29                                                                                       ` Dmitry Gutov
2013-08-11 15:18                                                                                         ` Johan Andersson
2013-08-11 16:56                                                                                           ` Stefan Monnier
2013-08-11 20:55                                                                                             ` Johan Andersson
2013-08-12  1:52                                                                                               ` Stefan Monnier
2013-09-13  9:10                                                                                                 ` Bozhidar Batsov
2013-09-13  9:26                                                                                                   ` Johan Andersson
2013-09-13 13:24                                                                                                     ` Stefan Monnier
2013-09-13 13:27                                                                                                       ` Johan Andersson
2013-07-05 22:35                                 ` Stefan Monnier
2013-07-06  5:14                                   ` Bozhidar Batsov
2013-07-06  9:38                                     ` 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=CAM9Zgm1raBLhVvjJ9jo8FrCnbRhhVjeZhP4n95uqsCbYPDrJzA@mail.gmail.com \
    --to=bozhidar@batsov.com \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /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).