unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Bozhidar Batsov <bozhidar@batsov.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 17057-done@debbugs.gnu.org
Subject: bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing)
Date: Wed, 26 Mar 2014 14:42:51 +0200	[thread overview]
Message-ID: <0875C1E7651142E5A1CB22EDBF5ACB64@gmail.com> (raw)
In-Reply-To: <5332C981.9030805@yandex.ru>

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

I didn’t include them in RuboCop’s code since they actually constitute a different syntactic category according to the parser - a “nth-reference”. I don’t think we should care about this in ruby-mode, though. The patch looks great. Given the fact that Emacs releases are pretty far apart (usually more than 1 year) I think we should include this given that’s if virtually impossible to introduce a regression.

--  
Cheers,
Bozhidar


On Wednesday, March 26, 2014 at 2:35 PM, Dmitry Gutov wrote:

> On 24.03.2014 11:45, Bozhidar Batsov wrote:
>  
> > Yeah, seems that everything important is listed there. Here’s one a bit
> > more extensive list, though:
> >  
> > https://github.com/bbatsov/rubocop/blob/master/lib/rubocop/cop/style/global_vars.rb
> >  
> > It features the JRuby-specific global vars in addition to the standard
> > ones.
> >  
>  
>  
> I see that you don't include the $(digit) globals, which reference the  
> last regexp-matched groups. The patch below does.
>  
> Not sure if it's okay to install in 24.4, though: on the one hand it's  
> low-risk, on the other hand it's not a bugfix.
>  
>  
> === modified file 'lisp/progmodes/ruby-mode.el'
> --- lisp/progmodes/ruby-mode.el 2014-03-24 08:53:56 +0000
> +++ lisp/progmodes/ruby-mode.el 2014-03-26 11:33:42 +0000
> @@ -2108,13 +2108,28 @@
> 1 font-lock-variable-name-face)
> ;; Keywords that evaluate to certain values.
> ("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>"
> - (0 font-lock-variable-name-face))
> + (0 font-lock-builtin-face))
> ;; Symbols.
>  
> ("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|@?\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
> 2 font-lock-constant-face)
> - ;; Variables.
> - ("\\$[^a-zA-Z \n]"
> - 0 font-lock-variable-name-face)
> + ;; Special variables.
> + (,(concat "\\$\\(?:[:\"!@;,/\\._><\\$?~=*&`'+0-9]\\|-[0adFiIlpvw]\\|"
> + (regexp-opt '("LOAD_PATH" "LOADED_FEATURES" "PROGRAM_NAME"
> + "ERROR_INFO" "ERROR_POSITION"
> + "FS" "FIELD_SEPARATOR"
> + "OFS" "OUTPUT_FIELD_SEPARATOR"
> + "RS" "INPUT_RECORD_SEPARATOR"
> + "ORS" "OUTPUT_RECORD_SEPARATOR"
> + "NR" "INPUT_LINE_NUMBER"
> + "LAST_READ_LINE" "DEFAULT_OUTPUT"  
> "DEFAULT_INPUT"
> + "PID" "PROCESS_ID" "CHILD_STATUS"
> + "LAST_MATCH_INFO" "IGNORECASE"
> + "ARGV" "MATCH" "PREMATCH" "POSTMATCH"
> + "LAST_PAREN_MATCH" "stdin" "stdout" "stderr"
> + "DEBUG" "FILENAME" "VERBOSE" "SAFE" "CLASSPATH"
> + "JRUBY_VERSION" "JRUBY_REVISION" "ENV_JAVA"))
> + "\\_>\\)")
> + 0 font-lock-builtin-face)
> ("\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+"
> 0 font-lock-variable-name-face)
> ;; Constants.
>  
>  



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

  reply	other threads:[~2014-03-26 12:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-21 12:53 bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing) Bozhidar Batsov
2014-03-21 14:47 ` Dmitry Gutov
2014-03-21 14:53   ` Bozhidar Batsov
2014-03-22 10:02     ` Bozhidar Batsov
2014-03-22 10:05       ` Bozhidar Batsov
2014-03-24  7:33         ` Dmitry Gutov
2014-03-24  9:12     ` Dmitry Gutov
2014-03-24  9:45       ` Bozhidar Batsov
2014-03-26 12:35         ` Dmitry Gutov
2014-03-26 12:42           ` Bozhidar Batsov [this message]
2014-03-27  8:26             ` 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=0875C1E7651142E5A1CB22EDBF5ACB64@gmail.com \
    --to=bozhidar@batsov.com \
    --cc=17057-done@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /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).