Emacs colouring problem

Hi, Rubyists.

I have begun the big adventure called ‘emacs’ … :wink:

I have found that the following line causes the syntax
highlighter to have problems:

	t.sub!(/\$/, '\$')

Regards,

···


-mark.


Mark Probert probertm@NOSPAM_nortelnetworks.com
Nortel Networks ph. (613) 768-1082

All opinions expressed are my own and do not
reflect in any way those of Nortel Networks.

Hi,

···

At Thu, 23 Jan 2003 02:00:59 +0900, Mark Probert wrote:

I have found that the following line causes the syntax
highlighter to have problems:

	t.sub!(/\$/, '\$')

This patch works?

Index: ruby-mode.el

RCS file: /cvs/ruby/src/ruby/misc/ruby-mode.el,v
retrieving revision 1.62
diff -u -2 -p -r1.62 ruby-mode.el
— ruby-mode.el 9 Jan 2003 16:26:43 -0000 1.62
+++ ruby-mode.el 23 Jan 2003 12:00:40 -0000
@@ -791,20 +791,20 @@ An end of a defun is found by moving for
;; the last $’ in the string ,‘…$’ is not variable
;; the last ?’ in the string ,‘…?’ is not ascii code

  • ("\\(^\\|[[ \t\n<+(,=]\\)\\('\\)[^'\n\\\\]*\\(\\\\.[^'\n\\\\]*\\)*[?$]\\('\\)"
    
  • ("\\(^\\|[[ \t\n<+(,=]\\)\\('\\)\\(\\\\.\\|[^'\n\\\\]*\\)*\\\\?[?$]\\('\\)"
     (2 (7 . nil))
     (4 (7 . nil)))
    ;; the last $` in the string ,`...$` is not variable
    ;; the last ?` in the string ,`...?` is not ascii code
    
  • ("\\(^\\|[[ \t\n<+(,=]\\)\\(`\\)[^`\n\\\\]*\\(\\\\.[^`\n\\\\]*\\)*[?$]\\(`\\)"
    
  • ("\\(^\\|[[ \t\n<+(,=]\\)\\(`\\)\\(\\\\.\\|[^`\n\\\\]*\\)*\\\\?[?$]\\(`\\)"
     (2 (7 . nil))
     (4 (7 . nil)))
    ;; the last $" in the string ,"...$" is not variable
    ;; the last ?" in the string ,"...?" is not ascii code
    
  • ("\\(^\\|[[ \t\n<+(,=]\\)\\(\"\\)[^\"\n\\\\]*\\(\\\\.[^\"\n\\\\]*\\)*[?$]\\(\"\\)"
    
  • ("\\(^\\|[[ \t\n<+(,=]\\)\\(\"\\)\\(\\\\.\\|[^\"\n\\\\]*\\)*\\\\?[?$]\\(\"\\)"
     (2 (7 . nil))
     (4 (7 . nil)))
    ;; $' $" $` .... are variables
    ;; ?' ?" ?` are ascii codes
    
  • ("[?$][#\"'`]" 0 (1 . nil))
    
  • ("\\(^\\|[^\\\\]\\)\\(\\\\\\\\\\)*[?$]\\([#\"'`]\\)" 3 (1 . nil))
    ;; regexps
    ("\\(^\\|[=(,~?:;]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)"
    


Nobu Nakada

Nobu did say …

This patch works?

Unfortunately not. It caused emacs (GNU emacs 21.2.1
for WinNT) to go 100% CPU.

Regards,

···


-mark.


Mark Probert probertm@NOSPAM_nortelnetworks.com
Nortel Networks ph. (613) 768-1082

All opinions expressed are my own and do not
reflect in any way those of Nortel Networks.

Hi,

···

At Fri, 24 Jan 2003 00:44:21 +0900, Mark Probert wrote:

Unfortunately not. It caused emacs (GNU emacs 21.2.1
for WinNT) to go 100% CPU.

What’s its (emacs-version)? Now I tried the patch with “GNU Emacs
21.2.1 (i386-msvc-nt5.0.2195) of 2002-03-20 on buffy” on Win2K, and
seemed to work fine with your snippet.


Nobu Nakada

Hi, Nobu.

Nobu did say …

What’s its (emacs-version)?

The same as yours. “GNU Emacs 21.2.1 (i386-msvc-nt5.0.2195) of 2002-03-
19 on buffy” under Win2k.

Here is a more complete snippet that shows the same
problem:

def fmt_text(arr, f)
f.puts “\n”
arr.each { |ln|
t = ln.gsub(/\t/, " “).strip
t.sub!(/$/, ‘$’) # from here is comment colour (magenta)
f.puts " #{t}”
}
f.puts “\n”
end

Regards,

···


-mark.


Mark Probert probertm@NOSPAM_nortelnetworks.com
Nortel Networks ph. (613) 768-1082

All opinions expressed are my own and do not
reflect in any way those of Nortel Networks.

Hi,

···

At Fri, 24 Jan 2003 02:24:41 +0900, Mark Probert wrote:

What’s its (emacs-version)?

The same as yours. “GNU Emacs 21.2.1 (i386-msvc-nt5.0.2195) of 2002-03-
19 on buffy” under Win2k.

Here is a more complete snippet that shows the same
problem:

Okay, I could see the problem. Thank you.
What about this?

Index: misc/ruby-mode.el

RCS file: /cvs/ruby/src/ruby/misc/ruby-mode.el,v
retrieving revision 1.62
diff -u -2 -p -r1.62 ruby-mode.el
— misc/ruby-mode.el 9 Jan 2003 16:26:43 -0000 1.62
+++ misc/ruby-mode.el 23 Jan 2003 18:10:22 -0000
@@ -789,22 +789,12 @@ An end of a defun is found by moving for
;; #{ }, #$hoge, #@foo are not comments
(“\(#\)[{$@]” 1 (1 . nil))

  • ;; the last $' in the string ,'...$' is not variable
    
  • ;; the last ?' in the string ,'...?' is not ascii code
    
  • ("\\(^\\|[[ \t\n<+(,=]\\)\\('\\)[^'\n\\\\]*\\(\\\\.[^'\n\\\\]*\\)*[?$]\\('\\)"
    
  •  (2 (7 . nil))
    
  •  (4 (7 . nil)))
    
  • ;; the last $` in the string ,`...$` is not variable
    
  • ;; the last ?` in the string ,`...?` is not ascii code
    
  • ("\\(^\\|[[ \t\n<+(,=]\\)\\(`\\)[^`\n\\\\]*\\(\\\\.[^`\n\\\\]*\\)*[?$]\\(`\\)"
    
  •  (2 (7 . nil))
    
  •  (4 (7 . nil)))
    
  • ;; the last $" in the string ,"...$" is not variable
    
  • ;; the last ?" in the string ,"...?" is not ascii code
    
  • ("\\(^\\|[[ \t\n<+(,=]\\)\\(\"\\)[^\"\n\\\\]*\\(\\\\.[^\"\n\\\\]*\\)*[?$]\\(\"\\)"
    
  • ;; the last $', $", $` in the respective string is not variable
    
  • ;; the last ?', ?", ?` in the respective string is not ascii code
    
  • ("\\(^\\|[\[ \t\n<+\(,=]\\)\\(['\"`]\\)\\(\\\\.\\|\\2\\|[^'\"`\n\\\\]\\)*\\\\?[?$]\\(\\2\\)"
     (2 (7 . nil))
     (4 (7 . nil)))
    ;; $' $" $` .... are variables
    ;; ?' ?" ?` are ascii codes
    
  • ("[?$][#\"'`]" 0 (1 . nil))
    
  • ("\\(^\\|[^\\\\]\\)\\(\\\\\\\\\\)*[?$]\\([#\"'`]\\)" 3 (1 . nil))
    ;; regexps
    ("\\(^\\|[=(,~?:;]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)"
    


Nobu Nakada

nobu.nokada@softhome.net did say …

Okay, I could see the problem. Thank you.
What about this?

Perfect!

Thank you so much.

···


-mark.


Mark Probert probertm@NOSPAM_nortelnetworks.com
Nortel Networks ph. (613) 768-1082

All opinions expressed are my own and do not
reflect in any way those of Nortel Networks.