unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing)
@ 2014-03-21 12:53 Bozhidar Batsov
  2014-03-21 14:47 ` Dmitry Gutov
  0 siblings, 1 reply; 11+ messages in thread
From: Bozhidar Batsov @ 2014-03-21 12:53 UTC (permalink / raw)
  To: 17057


Here's a few examples:

"this is #$$"

var = $!

Things are different for:

"this is #$1"

var = $1

I think those should be highlighted at least like $1 and friends.

There's another thing to consider - do built-in global vars should be
font-locked like built-ins or like the other (user-defined) global
variables? Personally I'd font-lock them as built-in to underline their
significance.



In GNU Emacs 24.3.50.1 (x86_64-apple-darwin13.0.0, NS apple-appkit-1265.00)
 of 2014-03-01 on Bozhidars-MacBook-Pro.local
Windowing system distributor `Apple', version 10.3.1265
Configured using:
 `configure --prefix=/usr/local/Cellar/emacs/HEAD --without-dbus
 --enable-locallisppath=/usr/local/share/emacs/site-lisp
 --infodir=/usr/local/Cellar/emacs/HEAD/share/info/emacs
 --without-gnutls --with-ns --disable-ns-self-contained'

Important settings:
  locale-coding-system: utf-8-unix

Major mode: Ruby

Minor modes in effect:
  subword-mode: t
  ruby-tools-mode: t
  inf-ruby-minor-mode: t
  magit-auto-revert-mode: t
  diff-auto-refine-mode: t
  guru-mode: t
  erc-truncate-mode: t
  erc-spelling-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  which-function-mode: t
  flx-ido-mode: t
  ido-ubiquitous-mode: t
  winner-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  whitespace-mode: t
  global-anzu-mode: t
  anzu-mode: t
  projectile-global-mode: t
  projectile-mode: t
  flyspell-mode: t
  shell-dirtrack-mode: t
  volatile-highlights-mode: t
  global-hl-line-mode: t
  recentf-mode: t
  savehist-mode: t
  show-smartparens-global-mode: t
  show-smartparens-mode: t
  smartparens-mode: t
  global-auto-revert-mode: t
  delete-selection-mode: t
  prelude-global-mode: t
  prelude-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
t SPC i s SPC @ <backspace> # g o o t C-b C-b C-b C-b 
C-b C-d @ C-f C-f C-f C-f C-d C-x C-s C-e C-x b <return> 
C-p C-p C-e <return> p SPC n o d e . c h i l d r e 
n C-x C-s C-x b <return> C-a C-f C-f C-f C-f C-f C-f 
C-f C-f C-f C-f C-f C-f C-f C-b C-b C-b { C-d C-f C-f 
C-f C-f C-f } C-x C-s C-b C-b C-b C-b C-b C-b C-b C-d 
C-f C-f C-f C-f C-f C-d C-x C-s C-x b <return> C-a 
C-a C-k C-k C-x b <return> C-b C-b C-b C-b C-b C-d 
$ C-x C-s C-d C-d C-d C-d $ C-x C-s <backspace> ! C-x 
C-s <backspace> 1 C-x C-s C-x b <return> C-n C-e . 
l o c . e x p r e s s i o n . s o u r c e C-x C-s C-n 
C-a C-f C-f C-f C-f C-f C-f C-k C-p C-a C-f C-f C-k 
C-n C-e C-y C-p C-p C-n C-a C-a C-k C-k C-n C-n C-n 
C-p C-p C-p C-n C-n C-n C-p C-k C-k C-n C-k C-k C-p 
<tab> C-x C-s <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <down-mouse-1> 
<mouse-1> <down-mouse-1> <mouse-1> C-x b t e s t <return> 
<backspace> ! <backspace> $ <backspace> 1 <backspace> 
$ <help-echo> <down-mouse-1> <mouse-1> C-v a <backspace> 
<return> v a r r <backspace> SPC = = SPC $ 1 <backspace> 
$ <backspace> ! <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <return> <return> 
t o p SPC = SPC $ t e s t <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> M-x 
r e b o <backspace> <backspace> p o r t <return>

Recent messages:
Wrote /Users/bozhidar/projects/test.rb
Saving file /Users/bozhidar/projects/rubocop/lib/rubocop/cop/style/variable_interpolation.rb...
Wrote /Users/bozhidar/projects/rubocop/lib/rubocop/cop/style/variable_interpolation.rb
Mark set
Indenting region...done
Inconsistent indentation detected.
Saving file /Users/bozhidar/projects/rubocop/lib/rubocop/cop/style/variable_interpolation.rb...
Wrote /Users/bozhidar/projects/rubocop/lib/rubocop/cop/style/variable_interpolation.rb
Saving file /Users/bozhidar/projects/test.rb...
Wrote /Users/bozhidar/projects/test.rb
scroll-up-command: End of buffer

Load-path shadows:
/Users/bozhidar/.emacs.d/elpa/tabulated-list-20120406.2251/tabulated-list hides /usr/local/Cellar/emacs/HEAD/share/emacs/24.3.50/lisp/emacs-lisp/tabulated-list

Features:
(rect shadow sort emacsbug make-mode ielm lisp-mnt clojure-test-mode
cider-scratch network-stream starttls tls slime-fancy
slime-fontifying-fu slime-package-fu slime-references slime-scratch
slime-presentations slime-fuzzy slime-fancy-inspector slime-c-p-c
slime-editing-commands slime-autodoc slime-parse slime-repl elp slime
hyperspec ace-jump-mode hippie-exp browse-url cus-edit cus-start
cus-load slim-mode mail-extr eieio-opt speedbar sb-image ezimage dframe
rst yaml-mode superword subword ruby-tools inf-ruby ruby-mode-expansions
smartparens-ruby ruby-mode smie cider coffee-mode js-mode-expansions js
json cc-mode-expansions cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs web-mode-expansions
web-mode disp-table nxml-uchnm rng-xsd xsd-regexp rng-cmpct cider-mode
cider-repl cider-eldoc cider-interaction arc-mode archive-mode
cider-client nrepl-client cider-util ewoc clojure-mode-expansions
clojure-mode inf-lisp find-dired vc-annotate vc vc-dispatcher misearch
multi-isearch gitignore-mode conf-mode ibuf-ext ibuffer ffap url-parse
url-vars mule-util executable magit-key-mode magit view epa derived epg
epg-config diff-mode git-rebase-mode git-commit-mode server log-edit
message sendmail rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils
gmm-utils mailheader pcvs-util add-log vc-git markdown-mode noutline
outline rainbow-mode color rainbow-delimiters elisp-slime-nav guru-mode
prelude-key-chord key-chord prelude-xml nxml-mode-expansions
html-mode-expansions sgml-mode smartparens-html rng-nxml rng-valid
rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn
nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc
xmltok prelude-web prelude-scss prelude-scheme prelude-ruby prelude-perl
prelude-org prelude-js prelude-erc erc-truncate erc-autoaway
erc-spelling erc-notify erc-log erc-list erc-menu erc-join erc-ring
erc-networks erc-pcomplete erc-track erc-match erc-button erc-fill
erc-stamp erc-netsplit erc-goodies erc erc-backend erc-compat
prelude-emacs-lisp prelude-css prelude-common-lisp slime-autoloads
prelude-clojure prelude-lisp prelude-c prelude-programming flycheck
help-mode rx f which-func imenu prelude-ido smex flx-ido flx
ido-ubiquitous warnings ido prelude-osx exec-path-from-shell
prelude-global-keybindings prelude-editor winner undo-tree diff esh-var
esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg eldoc esh-groups eshell
esh-module esh-mode esh-util re-builder whitespace browse-kill-ring
midnight ediff-merg ediff-wind ediff-diff ediff-mult ediff-help
ediff-init ediff-util ediff dired-x dired anzu projectile pkg-info
find-func grep compile s bookmark pp expand-region text-mode-expansions
er-basic-expansions expand-region-core expand-region-custom flyspell
ispell tramp tramp-compat auth-source gnus-util mm-util mail-prsvr
password-cache tramp-loaddefs trampver shell pcomplete comint ansi-color
format-spec etags ring volatile-highlights hl-line windmove recentf
tree-widget wid-edit savehist saveplace diminish smartparens-config
smartparens autorevert filenotify delsel prelude-mode easy-mmode edmacro
kmacro prelude-core epl advice help-fns dash thingatpt prelude-ui
zenburn-theme prelude-packages finder-inf ack-and-a-half-autoloads
diminish-autoloads erlang-autoloads flx-ido-autoloads eieio byte-opt
bytecomp byte-compile cconv eieio-core grizzl-autoloads
key-chord-autoloads logito-autoloads info easymenu cl-macs gv
pkg-info-autoloads rainbow-delimiters-autoloads rubocop-autoloads
volatile-highlights-autoloads yaml-mode-autoloads package cl cl-loaddefs
cl-lib time-date tooltip electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel ns-win tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process cocoa ns
multi-tty emacs)





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing)
  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
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Gutov @ 2014-03-21 14:47 UTC (permalink / raw)
  To: Bozhidar Batsov; +Cc: 17057

Bozhidar Batsov <bozhidar@batsov.com> writes:

> Here's a few examples:
>
> "this is #$$"
>
> var = $!
>
> Things are different for:
>
> "this is #$1"
>
> var = $1

Have you tried it in the latest Emacs? For me, only one example

"this is #$$"

is not highlighted (I'll fix that).

> There's another thing to consider - do built-in global vars should be
> font-locked like built-ins or like the other (user-defined) global
> variables? Personally I'd font-lock them as built-in to underline their
> significance.

Hmmm, maybe. But we also highlight nil, self, true, false, __LINE__,
__ENCODING__ and __FILE__ with font-lock-variable-name-face. Should we
change these, too?





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing)
  2014-03-21 14:47 ` Dmitry Gutov
@ 2014-03-21 14:53   ` Bozhidar Batsov
  2014-03-22 10:02     ` Bozhidar Batsov
  2014-03-24  9:12     ` Dmitry Gutov
  0 siblings, 2 replies; 11+ messages in thread
From: Bozhidar Batsov @ 2014-03-21 14:53 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 17057

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

On Friday, March 21, 2014 at 4:47 PM, Dmitry Gutov wrote:
> Bozhidar Batsov <bozhidar@batsov.com (mailto:bozhidar@batsov.com)> writes:
>  
> > Here's a few examples:
> >  
> > "this is #$$"
> >  
> > var = $!
> >  
> > Things are different for:
> >  
> > "this is #$1"
> >  
> > var = $1
>  
> Have you tried it in the latest Emacs? For me, only one example
>  
> "this is #$$"
>  
> is not highlighted (I'll fix that).
>  
> > There's another thing to consider - do built-in global vars should be
> > font-locked like built-ins or like the other (user-defined) global
> > variables? Personally I'd font-lock them as built-in to underline their
> > significance.
> >  
>  
>  
> Hmmm, maybe. But we also highlight nil, self, true, false, __LINE__,
> __ENCODING__ and __FILE__ with font-lock-variable-name-face. Should we
> change these, too?
>  
>  

Technically speaking all of those are keywords, not variables. Somewhat odd __LINE__ and friends are  
treated at string literals by the Ruby parser. As all of those evaluate to some value unlike most other keywords I guess it makes some sense to font-lock them as variables, but I’d prefer if we used font-locking that makes their special status more apparent.  

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing)
  2014-03-21 14:53   ` Bozhidar Batsov
@ 2014-03-22 10:02     ` Bozhidar Batsov
  2014-03-22 10:05       ` Bozhidar Batsov
  2014-03-24  9:12     ` Dmitry Gutov
  1 sibling, 1 reply; 11+ messages in thread
From: Bozhidar Batsov @ 2014-03-22 10:02 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 17057

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

On Friday, March 21, 2014 at 4:53 PM, Bozhidar Batsov wrote:
> On Friday, March 21, 2014 at 4:47 PM, Dmitry Gutov wrote:
> > Bozhidar Batsov <bozhidar@batsov.com (mailto:bozhidar@batsov.com)> writes:
> >  
> > > Here's a few examples:
> > >  
> > > "this is #$$"
> > >  
> > > var = $!
> > >  
> > > Things are different for:
> > >  
> > > "this is #$1"
> > >  
> > > var = $1
> >  
> > Have you tried it in the latest Emacs? For me, only one example
> >  
> > "this is #$$"
> >  
> > is not highlighted (I'll fix that).
> >  
> > > There's another thing to consider - do built-in global vars should be
> > > font-locked like built-ins or like the other (user-defined) global
> > > variables? Personally I'd font-lock them as built-in to underline their
> > > significance.
> > >  
> >  
> >  
> > Hmmm, maybe. But we also highlight nil, self, true, false, __LINE__,
> > __ENCODING__ and __FILE__ with font-lock-variable-name-face. Should we
> > change these, too?
> >  
> >  
> >  
>  
> Technically speaking all of those are keywords, not variables. Somewhat odd __LINE__ and friends are  
> treated at string literals by the Ruby parser. As all of those evaluate to some value unlike most other keywords I guess it makes some sense to font-lock them as variables, but I’d prefer if we used font-locking that makes their special status more apparent.  
>  
>  

There’s one more thing to consider - the special variables aliases defined in `English`. Those are considered de facto built-in (and are actually built-in in some implementations like JRuby; will probably be available out-of-the-box in MRI 3 as well), so I’d suggest treating them the same way as vars like $$, etc.  

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing)
  2014-03-22 10:02     ` Bozhidar Batsov
@ 2014-03-22 10:05       ` Bozhidar Batsov
  2014-03-24  7:33         ` Dmitry Gutov
  0 siblings, 1 reply; 11+ messages in thread
From: Bozhidar Batsov @ 2014-03-22 10:05 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 17057

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

On Saturday, March 22, 2014 at 12:02 PM, Bozhidar Batsov wrote:
> On Friday, March 21, 2014 at 4:53 PM, Bozhidar Batsov wrote:
> > On Friday, March 21, 2014 at 4:47 PM, Dmitry Gutov wrote:
> > > Bozhidar Batsov <bozhidar@batsov.com (mailto:bozhidar@batsov.com)> writes:
> > >  
> > > > Here's a few examples:
> > > >  
> > > > "this is #$$"
> > > >  
> > > > var = $!
> > > >  
> > > > Things are different for:
> > > >  
> > > > "this is #$1"
> > > >  
> > > > var = $1
> > >  
> > > Have you tried it in the latest Emacs? For me, only one example
> > >  
> > > "this is #$$"
> > >  
> > > is not highlighted (I'll fix that).
> > >  
$1 gets font-locked immediately, but $$ currently gets font-locked only after some “word-boundary” character gets inserted (like space, newline, etc).  
> > >  
> > > > There's another thing to consider - do built-in global vars should be
> > > > font-locked like built-ins or like the other (user-defined) global
> > > > variables? Personally I'd font-lock them as built-in to underline their
> > > > significance.
> > > >  
> > >  
> > >  
> > > Hmmm, maybe. But we also highlight nil, self, true, false, __LINE__,
> > > __ENCODING__ and __FILE__ with font-lock-variable-name-face. Should we
> > > change these, too?
> > >  
> > >  
> > >  
> >  
> > Technically speaking all of those are keywords, not variables. Somewhat odd __LINE__ and friends are  
> > treated at string literals by the Ruby parser. As all of those evaluate to some value unlike most other keywords I guess it makes some sense to font-lock them as variables, but I’d prefer if we used font-locking that makes their special status more apparent.  
> >  
> >  
> >  
>  
> There’s one more thing to consider - the special variables aliases defined in `English`. Those are considered de facto built-in (and are actually built-in in some implementations like JRuby; will probably be available out-of-the-box in MRI 3 as well), so I’d suggest treating them the same way as vars like $$, etc.  
>  
>  



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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing)
  2014-03-22 10:05       ` Bozhidar Batsov
@ 2014-03-24  7:33         ` Dmitry Gutov
  0 siblings, 0 replies; 11+ messages in thread
From: Dmitry Gutov @ 2014-03-24  7:33 UTC (permalink / raw)
  To: Bozhidar Batsov; +Cc: 17057

On 22.03.2014 12:05, Bozhidar Batsov wrote:

> $1 gets font-locked immediately, but $$ currently gets font-locked only
> after some “word-boundary” character gets inserted (like space, newline,
> etc).

Here's the relevant matcher, it's pretty old:

"\\(\\$\\([^a-zA-Z0-9 \n]\\|[0-9]\\)\\)\\W"

Apparently, it was meant as a light-weight syntax hint: no highlighting 
means syntax error.

Very ad-hoc, so I'm up for removing it.

($1 also hits another matcher because 1 has the word syntax).





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing)
  2014-03-21 14:53   ` Bozhidar Batsov
  2014-03-22 10:02     ` Bozhidar Batsov
@ 2014-03-24  9:12     ` Dmitry Gutov
  2014-03-24  9:45       ` Bozhidar Batsov
  1 sibling, 1 reply; 11+ messages in thread
From: Dmitry Gutov @ 2014-03-24  9:12 UTC (permalink / raw)
  To: Bozhidar Batsov; +Cc: 17057-done

Version: 24.4

On 21.03.2014 16:53, Bozhidar Batsov wrote:

> Technically speaking all of those are keywords, not variables. Somewhat
> odd __LINE__ and friends are
> treated at string literals by the Ruby parser. As all of those evaluate
> to some value unlike most other keywords I guess it makes some sense to
> font-lock them as variables, but I’d prefer if we used font-locking that
> makes their special status more apparent.

Sounds good to me. Does this list look exhaustive to you?

http://www.zenspider.com/Languages/Ruby/QuickRef.html#pre-defined-variables

Aside from changing faces, the problems mentioned in this bug should be 
fixed now, emacs-24 r116850.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing)
  2014-03-24  9:12     ` Dmitry Gutov
@ 2014-03-24  9:45       ` Bozhidar Batsov
  2014-03-26 12:35         ` Dmitry Gutov
  0 siblings, 1 reply; 11+ messages in thread
From: Bozhidar Batsov @ 2014-03-24  9:45 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 17057-done

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

On Monday, March 24, 2014 at 11:12 AM, Dmitry Gutov wrote:
> Version: 24.4
>  
> On 21.03.2014 16:53, Bozhidar Batsov wrote:
>  
> > Technically speaking all of those are keywords, not variables. Somewhat
> > odd __LINE__ and friends are
> > treated at string literals by the Ruby parser. As all of those evaluate
> > to some value unlike most other keywords I guess it makes some sense to
> > font-lock them as variables, but I’d prefer if we used font-locking that
> > makes their special status more apparent.
> >  
>  
>  
> Sounds good to me. Does this list look exhaustive to you?
>  
> http://www.zenspider.com/Languages/Ruby/QuickRef.html#pre-defined-variables
>  
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.   
>  
> Aside from changing faces, the problems mentioned in this bug should be  
> fixed now, emacs-24 r116850.
>  
>  


Thanks!   


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing)
  2014-03-24  9:45       ` Bozhidar Batsov
@ 2014-03-26 12:35         ` Dmitry Gutov
  2014-03-26 12:42           ` Bozhidar Batsov
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Gutov @ 2014-03-26 12:35 UTC (permalink / raw)
  To: Bozhidar Batsov; +Cc: 17057-done

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.







^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing)
  2014-03-26 12:35         ` Dmitry Gutov
@ 2014-03-26 12:42           ` Bozhidar Batsov
  2014-03-27  8:26             ` Dmitry Gutov
  0 siblings, 1 reply; 11+ messages in thread
From: Bozhidar Batsov @ 2014-03-26 12:42 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 17057-done

[-- 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 --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing)
  2014-03-26 12:42           ` Bozhidar Batsov
@ 2014-03-27  8:26             ` Dmitry Gutov
  0 siblings, 0 replies; 11+ messages in thread
From: Dmitry Gutov @ 2014-03-27  8:26 UTC (permalink / raw)
  To: Bozhidar Batsov; +Cc: 17057-done

On 26.03.2014 14:42, Bozhidar Batsov wrote:
> 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.

Okay, this was probably enough time for someone else to weigh in.

Guess I'll keep installing small tweaks in ruby-mode until an explicit 
slap on the wrist. :)

emacs-24, r116870.





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-03-27  8:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-03-27  8:26             ` Dmitry Gutov

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).