diff options
| author | Leo Liu | 2013-05-05 23:29:51 +0800 |
|---|---|---|
| committer | Leo Liu | 2013-05-05 23:29:51 +0800 |
| commit | 02502a5fd290c6424ef1159867146f1e94aa08c1 (patch) | |
| tree | c11171d190245a45c64693567c8fe3ba052a0d67 | |
| parent | e6076b1bce12dfc10f05c39ef5264247b8ebbee7 (diff) | |
| download | emacs-02502a5fd290c6424ef1159867146f1e94aa08c1.tar.gz emacs-02502a5fd290c6424ef1159867146f1e94aa08c1.zip | |
* progmodes/octave.el (octave-font-lock-keywords)
(octave-font-lock-texinfo-comment): Adjust for the byte-compiler.
(inferior-octave-send-list-and-digest): Improve error message.
(octave-mode, inferior-octave-mode): Use setq-local.
(octave-help): Set info-lookup-mode.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/progmodes/octave.el | 73 |
2 files changed, 47 insertions, 34 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ee90a05473a..5395bf46e2a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-05-05 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | * progmodes/octave.el (octave-font-lock-keywords) | ||
| 4 | (octave-font-lock-texinfo-comment): Adjust for the byte-compiler. | ||
| 5 | (inferior-octave-send-list-and-digest): Improve error message. | ||
| 6 | (octave-mode, inferior-octave-mode): Use setq-local. | ||
| 7 | (octave-help): Set info-lookup-mode. | ||
| 8 | |||
| 1 | 2013-05-05 Richard Stallman <rms@gnu.org> | 9 | 2013-05-05 Richard Stallman <rms@gnu.org> |
| 2 | 10 | ||
| 3 | * vc/compare-w.el (compare-windows-whitespace): | 11 | * vc/compare-w.el (compare-windows-whitespace): |
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 6d06f1a2275..ddc1916c3b5 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el | |||
| @@ -24,9 +24,9 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;; This package provides emacs support for octave. It defines a major | 27 | ;; This package provides emacs support for Octave. It defines a major |
| 28 | ;; mode for editing octave code and contains code for interacting with | 28 | ;; mode for editing Octave code and contains code for interacting with |
| 29 | ;; an inferior octave process using comint. | 29 | ;; an inferior Octave process using comint. |
| 30 | 30 | ||
| 31 | ;; See the documentation of `octave-mode' and `run-octave' for further | 31 | ;; See the documentation of `octave-mode' and `run-octave' for further |
| 32 | ;; information on usage and customization. | 32 | ;; information on usage and customization. |
| @@ -109,19 +109,19 @@ parenthetical grouping.") | |||
| 109 | 'font-lock-keyword-face) | 109 | 'font-lock-keyword-face) |
| 110 | ;; Note: 'end' also serves as the last index in an indexing expression. | 110 | ;; Note: 'end' also serves as the last index in an indexing expression. |
| 111 | ;; Ref: http://www.mathworks.com/help/matlab/ref/end.html | 111 | ;; Ref: http://www.mathworks.com/help/matlab/ref/end.html |
| 112 | '((lambda (limit) | 112 | (list (lambda (limit) |
| 113 | (while (re-search-forward "\\_<end\\_>" limit 'move) | 113 | (while (re-search-forward "\\_<end\\_>" limit 'move) |
| 114 | (let ((beg (match-beginning 0)) | 114 | (let ((beg (match-beginning 0)) |
| 115 | (end (match-end 0))) | 115 | (end (match-end 0))) |
| 116 | (unless (octave-in-string-or-comment-p) | 116 | (unless (octave-in-string-or-comment-p) |
| 117 | (unwind-protect | 117 | (unwind-protect |
| 118 | (progn | 118 | (progn |
| 119 | (goto-char beg) | 119 | (goto-char beg) |
| 120 | (backward-up-list) | 120 | (backward-up-list) |
| 121 | (when (memq (char-after) '(?\( ?\[ ?\{)) | 121 | (when (memq (char-after) '(?\( ?\[ ?\{)) |
| 122 | (put-text-property beg end 'face nil))) | 122 | (put-text-property beg end 'face nil))) |
| 123 | (goto-char end))))) | 123 | (goto-char end))))) |
| 124 | nil)) | 124 | nil)) |
| 125 | ;; Fontify all builtin operators. | 125 | ;; Fontify all builtin operators. |
| 126 | (cons "\\(&\\||\\|<=\\|>=\\|==\\|<\\|>\\|!=\\|!\\)" | 126 | (cons "\\(&\\||\\|<=\\|>=\\|==\\|<\\|>\\|!=\\|!\\)" |
| 127 | (if (boundp 'font-lock-builtin-face) | 127 | (if (boundp 'font-lock-builtin-face) |
| @@ -527,8 +527,8 @@ definitions can also be stored in files and used in batch mode." | |||
| 527 | 527 | ||
| 528 | (setq-local syntax-propertize-function #'octave-syntax-propertize-function) | 528 | (setq-local syntax-propertize-function #'octave-syntax-propertize-function) |
| 529 | 529 | ||
| 530 | (setq imenu-generic-expression octave-mode-imenu-generic-expression) | 530 | (setq-local imenu-generic-expression octave-mode-imenu-generic-expression) |
| 531 | (setq imenu-case-fold-search nil) | 531 | (setq-local imenu-case-fold-search nil) |
| 532 | 532 | ||
| 533 | (add-hook 'completion-at-point-functions | 533 | (add-hook 'completion-at-point-functions |
| 534 | 'octave-completion-at-point-function nil t) | 534 | 'octave-completion-at-point-function nil t) |
| @@ -638,7 +638,7 @@ in the Inferior Octave buffer.") | |||
| 638 | 638 | ||
| 639 | (setq font-lock-defaults '(inferior-octave-font-lock-keywords nil nil)) | 639 | (setq font-lock-defaults '(inferior-octave-font-lock-keywords nil nil)) |
| 640 | 640 | ||
| 641 | (setq info-lookup-mode 'octave-mode) | 641 | (setq-local info-lookup-mode 'octave-mode) |
| 642 | 642 | ||
| 643 | (setq comint-input-ring-file-name | 643 | (setq comint-input-ring-file-name |
| 644 | (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist") | 644 | (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist") |
| @@ -802,6 +802,10 @@ the rest to `inferior-octave-output-string'." | |||
| 802 | "Send LIST to the inferior Octave process and digest the output. | 802 | "Send LIST to the inferior Octave process and digest the output. |
| 803 | The elements of LIST have to be strings and are sent one by one. All | 803 | The elements of LIST have to be strings and are sent one by one. All |
| 804 | output is passed to the filter `inferior-octave-output-digest'." | 804 | output is passed to the filter `inferior-octave-output-digest'." |
| 805 | (or (and inferior-octave-process | ||
| 806 | (process-live-p inferior-octave-process)) | ||
| 807 | (error (substitute-command-keys | ||
| 808 | "No inferior octave process running. Type \\[run-octave]"))) | ||
| 805 | (let* ((proc inferior-octave-process) | 809 | (let* ((proc inferior-octave-process) |
| 806 | (filter (process-filter proc)) | 810 | (filter (process-filter proc)) |
| 807 | string) | 811 | string) |
| @@ -1021,21 +1025,21 @@ q: Don't fix\n" func file)) | |||
| 1021 | (defun octave-font-lock-texinfo-comment () | 1025 | (defun octave-font-lock-texinfo-comment () |
| 1022 | (font-lock-add-keywords | 1026 | (font-lock-add-keywords |
| 1023 | nil | 1027 | nil |
| 1024 | '(((lambda (limit) | 1028 | `((,(lambda (limit) |
| 1025 | (while (and (search-forward "-*- texinfo -*-" limit t) | 1029 | (while (and (search-forward "-*- texinfo -*-" limit t) |
| 1026 | (octave-in-comment-p)) | 1030 | (octave-in-comment-p)) |
| 1027 | (let ((beg (nth 8 (syntax-ppss))) | 1031 | (let ((beg (nth 8 (syntax-ppss))) |
| 1028 | (end (progn | 1032 | (end (progn |
| 1029 | (octave-skip-comment-forward (point-max)) | 1033 | (octave-skip-comment-forward (point-max)) |
| 1030 | (point)))) | 1034 | (point)))) |
| 1031 | (put-text-property beg end 'font-lock-multiline t) | 1035 | (put-text-property beg end 'font-lock-multiline t) |
| 1032 | (font-lock-prepend-text-property | 1036 | (font-lock-prepend-text-property |
| 1033 | beg end 'face 'octave-function-comment-block) | 1037 | beg end 'face 'octave-function-comment-block) |
| 1034 | (dolist (kw octave-texinfo-font-lock-keywords) | 1038 | (dolist (kw octave-texinfo-font-lock-keywords) |
| 1035 | (goto-char beg) | 1039 | (goto-char beg) |
| 1036 | (while (re-search-forward (car kw) end 'move) | 1040 | (while (re-search-forward (car kw) end 'move) |
| 1037 | (font-lock-apply-highlight (cdr kw)))))) | 1041 | (font-lock-apply-highlight (cdr kw)))))) |
| 1038 | nil))) | 1042 | nil))) |
| 1039 | 'append)) | 1043 | 'append)) |
| 1040 | 1044 | ||
| 1041 | 1045 | ||
| @@ -1493,6 +1497,7 @@ code line." | |||
| 1493 | (let ((help-xref-following t)) | 1497 | (let ((help-xref-following t)) |
| 1494 | (help-setup-xref (list 'octave-help fn) | 1498 | (help-setup-xref (list 'octave-help fn) |
| 1495 | (called-interactively-p 'interactive))) | 1499 | (called-interactively-p 'interactive))) |
| 1500 | (setq-local info-lookup-mode 'octave-mode) | ||
| 1496 | ;; Note: can be turned off by suppress_verbose_help_message. | 1501 | ;; Note: can be turned off by suppress_verbose_help_message. |
| 1497 | ;; | 1502 | ;; |
| 1498 | ;; Remove boring trailing text: Additional help for built-in functions | 1503 | ;; Remove boring trailing text: Additional help for built-in functions |