diff options
| author | Leo Liu | 2013-05-03 12:47:08 +0800 |
|---|---|---|
| committer | Leo Liu | 2013-05-03 12:47:08 +0800 |
| commit | b54f978b830973cd20565c1cb98a5e04be9c4535 (patch) | |
| tree | 1a05df28c37a026d39069d91205e2d0a9b508add | |
| parent | 271350180c103c2db7dbf15f11b9ddf07def8085 (diff) | |
| download | emacs-b54f978b830973cd20565c1cb98a5e04be9c4535.tar.gz emacs-b54f978b830973cd20565c1cb98a5e04be9c4535.zip | |
* progmodes/octave.el (octave-font-lock-keywords): Do not
dehighlight 'end' in comments or strings.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/progmodes/octave.el | 38 |
2 files changed, 26 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 86202e98a33..28501787b94 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-05-03 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | * progmodes/octave.el (octave-font-lock-keywords): Do not | ||
| 4 | dehighlight 'end' in comments or strings. | ||
| 5 | |||
| 1 | 2013-05-02 Leo Liu <sdl.web@gmail.com> | 6 | 2013-05-02 Leo Liu <sdl.web@gmail.com> |
| 2 | 7 | ||
| 3 | * progmodes/octave.el (octave-mode-syntax-table): Correct syntax | 8 | * progmodes/octave.el (octave-mode-syntax-table): Correct syntax |
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 695ad1c4ffd..1bd5a104c64 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el | |||
| @@ -100,30 +100,34 @@ parenthetical grouping.") | |||
| 100 | (list | 100 | (list |
| 101 | ;; Fontify all builtin keywords. | 101 | ;; Fontify all builtin keywords. |
| 102 | (cons (concat "\\_<\\(" | 102 | (cons (concat "\\_<\\(" |
| 103 | (regexp-opt (append octave-reserved-words | 103 | (regexp-opt (append octave-reserved-words |
| 104 | octave-text-functions)) | 104 | octave-text-functions)) |
| 105 | "\\)\\_>") | 105 | "\\)\\_>") |
| 106 | 'font-lock-keyword-face) | 106 | 'font-lock-keyword-face) |
| 107 | ;; Note: 'end' also serves as the last index in an indexing expression. | 107 | ;; Note: 'end' also serves as the last index in an indexing expression. |
| 108 | ;; Ref: http://www.mathworks.com/help/matlab/ref/end.html | 108 | ;; Ref: http://www.mathworks.com/help/matlab/ref/end.html |
| 109 | '("\\_<end\\_>" (0 (save-excursion | 109 | '((lambda (limit) |
| 110 | (condition-case nil | 110 | (while (re-search-forward "\\_<end\\_>" limit 'move) |
| 111 | (progn | 111 | (let ((beg (match-beginning 0)) |
| 112 | (goto-char (match-beginning 0)) | 112 | (end (match-end 0))) |
| 113 | (backward-up-list) | 113 | (unless (octave-in-string-or-comment-p) |
| 114 | (unless (memq (char-after) '(?\( ?\[ ?\{)) | 114 | (unwind-protect |
| 115 | font-lock-keyword-face)) | 115 | (progn |
| 116 | (error font-lock-keyword-face))) | 116 | (goto-char beg) |
| 117 | t)) | 117 | (backward-up-list) |
| 118 | (when (memq (char-after) '(?\( ?\[ ?\{)) | ||
| 119 | (put-text-property beg end 'face nil))) | ||
| 120 | (goto-char end))))) | ||
| 121 | nil)) | ||
| 118 | ;; Fontify all builtin operators. | 122 | ;; Fontify all builtin operators. |
| 119 | (cons "\\(&\\||\\|<=\\|>=\\|==\\|<\\|>\\|!=\\|!\\)" | 123 | (cons "\\(&\\||\\|<=\\|>=\\|==\\|<\\|>\\|!=\\|!\\)" |
| 120 | (if (boundp 'font-lock-builtin-face) | 124 | (if (boundp 'font-lock-builtin-face) |
| 121 | 'font-lock-builtin-face | 125 | 'font-lock-builtin-face |
| 122 | 'font-lock-preprocessor-face)) | 126 | 'font-lock-preprocessor-face)) |
| 123 | ;; Fontify all function declarations. | 127 | ;; Fontify all function declarations. |
| 124 | (list octave-function-header-regexp | 128 | (list octave-function-header-regexp |
| 125 | '(1 font-lock-keyword-face) | 129 | '(1 font-lock-keyword-face) |
| 126 | '(3 font-lock-function-name-face nil t))) | 130 | '(3 font-lock-function-name-face nil t))) |
| 127 | "Additional Octave expressions to highlight.") | 131 | "Additional Octave expressions to highlight.") |
| 128 | 132 | ||
| 129 | (defun octave-syntax-propertize-function (start end) | 133 | (defun octave-syntax-propertize-function (start end) |