emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112444: * progmodes/octave.el (octav


From: Leo Liu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112444: * progmodes/octave.el (octave-font-lock-keywords): Do not
Date: Fri, 03 May 2013 12:47:08 +0800
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112444
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Fri 2013-05-03 12:47:08 +0800
message:
  * progmodes/octave.el (octave-font-lock-keywords): Do not
  dehighlight 'end' in comments or strings.
modified:
  lisp/ChangeLog
  lisp/progmodes/octave.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-05-02 23:03:00 +0000
+++ b/lisp/ChangeLog    2013-05-03 04:47:08 +0000
@@ -1,3 +1,8 @@
+2013-05-03  Leo Liu  <address@hidden>
+
+       * progmodes/octave.el (octave-font-lock-keywords): Do not
+       dehighlight 'end' in comments or strings.
+
 2013-05-02  Leo Liu  <address@hidden>
 
        * progmodes/octave.el (octave-mode-syntax-table): Correct syntax

=== modified file 'lisp/progmodes/octave.el'
--- a/lisp/progmodes/octave.el  2013-05-02 23:03:00 +0000
+++ b/lisp/progmodes/octave.el  2013-05-03 04:47:08 +0000
@@ -100,30 +100,34 @@
   (list
    ;; Fontify all builtin keywords.
    (cons (concat "\\_<\\("
-                (regexp-opt (append octave-reserved-words
+                 (regexp-opt (append octave-reserved-words
                                      octave-text-functions))
-                "\\)\\_>")
-        'font-lock-keyword-face)
+                 "\\)\\_>")
+         'font-lock-keyword-face)
    ;; Note: 'end' also serves as the last index in an indexing expression.
    ;; Ref: http://www.mathworks.com/help/matlab/ref/end.html
-   '("\\_<end\\_>" (0 (save-excursion
-                        (condition-case nil
-                            (progn
-                              (goto-char (match-beginning 0))
-                              (backward-up-list)
-                              (unless (memq (char-after) '(?\( ?\[ ?\{))
-                                font-lock-keyword-face))
-                          (error font-lock-keyword-face)))
-                      t))
+   '((lambda (limit)
+       (while (re-search-forward "\\_<end\\_>" limit 'move)
+         (let ((beg (match-beginning 0))
+               (end (match-end 0)))
+           (unless (octave-in-string-or-comment-p)
+             (unwind-protect
+                 (progn
+                   (goto-char beg)
+                   (backward-up-list)
+                   (when (memq (char-after) '(?\( ?\[ ?\{))
+                     (put-text-property beg end 'face nil)))
+               (goto-char end)))))
+       nil))
    ;; Fontify all builtin operators.
    (cons "\\(&\\||\\|<=\\|>=\\|==\\|<\\|>\\|!=\\|!\\)"
-        (if (boundp 'font-lock-builtin-face)
-            'font-lock-builtin-face
-          'font-lock-preprocessor-face))
+         (if (boundp 'font-lock-builtin-face)
+             'font-lock-builtin-face
+           'font-lock-preprocessor-face))
    ;; Fontify all function declarations.
    (list octave-function-header-regexp
-        '(1 font-lock-keyword-face)
-        '(3 font-lock-function-name-face nil t)))
+         '(1 font-lock-keyword-face)
+         '(3 font-lock-function-name-face nil t)))
   "Additional Octave expressions to highlight.")
 
 (defun octave-syntax-propertize-function (start end)


reply via email to

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