emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100401: Merge several fixes from


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100401: Merge several fixes from upsteam ruby-mode.
Date: Sat, 22 Jan 2011 20:02:37 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100401
author: Nobuyoshi Nakada  <address@hidden>
committer: Chong Yidong <address@hidden>
branch nick: emacs-23
timestamp: Sat 2011-01-22 20:02:37 -0500
message:
  Merge several fixes from upsteam ruby-mode.
  
  * lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-match): Fix for
  here-doc which ends with an underscore.
  (ruby-mode-set-encoding): Skip shebang line always.
  (ruby-mode-map): Bind C-c C-c to comment-region.
  (ruby-expr-beg, ruby-font-lock-keywords): Highlight literal hash
  key labels as symbols.
  (ruby-forward-sexp): Stop after literal hash key labels.
  (ruby-font-lock-syntactic-keywords): Highlight regexp after open
  bracket.
modified:
  lisp/ChangeLog
  lisp/progmodes/ruby-mode.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-01-22 21:02:49 +0000
+++ b/lisp/ChangeLog    2011-01-23 01:02:37 +0000
@@ -1,3 +1,15 @@
+2011-01-23  Nobuyoshi Nakada  <address@hidden>
+
+       * progmodes/ruby-mode.el (ruby-here-doc-beg-match): Fix for
+       here-doc which ends with an underscore.
+       (ruby-mode-set-encoding): Skip shebang line always.
+       (ruby-mode-map): Bind C-c C-c to comment-region.
+       (ruby-expr-beg, ruby-font-lock-keywords): Highlight literal hash
+       key labels as symbols.
+       (ruby-forward-sexp): Stop after literal hash key labels.
+       (ruby-font-lock-syntactic-keywords): Highlight regexp after open
+       bracket.
+
 2011-01-22  Keitaro Miyazaki  <address@hidden>
 
        * emacs-lisp/re-builder.el (reb-mode-map): Set case-fold-search in

=== modified file 'lisp/progmodes/ruby-mode.el'
--- a/lisp/progmodes/ruby-mode.el       2011-01-02 23:50:46 +0000
+++ b/lisp/progmodes/ruby-mode.el       2011-01-23 01:02:37 +0000
@@ -122,13 +122,16 @@
   "Return a regexp to find the beginning of a heredoc.
 
 This should only be called after matching against `ruby-here-doc-end-re'."
-  (let ((contents (regexp-quote (concat (match-string 2) (match-string 3)))))
+  (let ((contents (concat
+                  (regexp-quote (concat (match-string 2) (match-string 3)))
+                  (if (string= (match-string 3) "_") "\\B" "\\b"))))
     (concat "<<"
             (let ((match (match-string 1)))
               (if (and match (> (length match) 0))
                   (concat "\\(?:-\\([\"']?\\)\\|\\([\"']\\)" (match-string 1) 
"\\)"
-                          contents "\\b\\(\\1\\|\\2\\)")
-                (concat "-?\\([\"']\\|\\)" contents "\\b\\1"))))))
+                         contents "\\(\\1\\|\\2\\)")
+               (concat "-?\\([\"']\\|\\)" contents "\\1"))))))
+
 
 (defconst ruby-delimiter
   (concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\<\\("
@@ -170,6 +173,7 @@
     (define-key map (kbd "C-M-h") 'backward-kill-word)
     (define-key map (kbd "C-j")   'reindent-then-newline-and-indent)
     (define-key map (kbd "C-m")   'newline)
+    (define-key map (kbd "C-c C-c") 'comment-region)
     map)
   "Keymap used in Ruby mode.")
 
@@ -336,7 +340,7 @@
                             (cdr (assq coding-system ruby-encoding-map)))
                        coding-system))
                 "ascii-8bit"))
-        (if (looking-at "^#![^\n]*ruby") (beginning-of-line 2))
+        (if (looking-at "^#!") (beginning-of-line 2))
         (cond ((looking-at "\\s *#.*-\*-\\s *\\(en\\)?coding\\s *:\\s 
*\\([-a-z0-9_]*\\)\\s *\\(;\\|-\*-\\)")
                (unless (string= (match-string 2) coding-system)
                  (goto-char (match-beginning 2))
@@ -946,6 +950,7 @@
       (condition-case nil
           (while (> i 0)
             (skip-syntax-forward " ")
+           (if (looking-at ",\\s *") (goto-char (match-end 0)))
             (cond ((looking-at "\\?\\(\\\\[CM]-\\)*\\\\?\\S ")
                    (goto-char (match-end 0)))
                   ((progn
@@ -1141,7 +1146,7 @@
     ;; ?' ?" ?` are ascii codes
     ("\\(^\\|[^\\\\]\\)\\(\\\\\\\\\\)*[?$]\\([#\"'`]\\)" 3 (1 . nil))
     ;; regexps
-    ("\\(^\\|[=(,~?:;<>]\\|\\(^\\|\\s 
\\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s
 *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)"
+    ("\\(^\\|[[=(,~?:;<>]\\|\\(^\\|\\s 
\\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s
 *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)"
      (4 (7 . ?/))
      (6 (7 . ?/)))
     ("^=en\\(d\\)\\_>" 1 "!")
@@ -1364,6 +1369,7 @@
    ;; symbols
    
'("\\(^\\|[^:]\\)\\(:\\(address@hidden|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
      2 font-lock-reference-face)
+   '("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 
font-lock-reference-face)
    ;; expression expansion
    
'("#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)"
      0 font-lock-variable-name-face t)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]