diff options
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/progmodes/octave.el | 122 |
2 files changed, 56 insertions, 75 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d78f156503f..e7c374e1e96 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2013-04-26 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | * progmodes/octave.el (octave-submit-bug-report): Obsolete. | ||
| 4 | (octave-mode, inferior-octave-mode): Use setq-local. | ||
| 5 | (octave-not-in-string-or-comment-p): Renamed to | ||
| 6 | octave-in-string-or-comment-p. | ||
| 7 | (octave-in-comment-p, octave-in-string-p) | ||
| 8 | (octave-in-string-or-comment-p): Replace defsubst with defun. | ||
| 9 | |||
| 1 | 2013-04-25 Paul Eggert <eggert@cs.ucla.edu> | 10 | 2013-04-25 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 11 | ||
| 3 | * Makefile.in (distclean): Remove $(lisp)/loaddefs.el~. | 12 | * Makefile.in (distclean): Remove $(lisp)/loaddefs.el~. |
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 0e540ea348a..640775bfe8b 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; octave.el --- editing octave source files under emacs | 1 | ;;; octave.el --- editing octave source files under emacs -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1997, 2001-2013 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1997, 2001-2013 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -39,9 +39,8 @@ | |||
| 39 | :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) | 39 | :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) |
| 40 | :group 'languages) | 40 | :group 'languages) |
| 41 | 41 | ||
| 42 | (defconst octave-maintainer-address | 42 | (define-obsolete-function-alias 'octave-submit-bug-report |
| 43 | "Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>, bug-gnu-emacs@gnu.org" | 43 | 'report-emacs-bug "24.4") |
| 44 | "Current maintainer of the Emacs Octave package.") | ||
| 45 | 44 | ||
| 46 | (define-abbrev-table 'octave-abbrev-table | 45 | (define-abbrev-table 'octave-abbrev-table |
| 47 | (mapcar (lambda (e) (append e '(nil 0 t))) | 46 | (mapcar (lambda (e) (append e '(nil 0 t))) |
| @@ -585,53 +584,48 @@ including a reproducible test case and send the message." | |||
| 585 | (smie-setup octave-smie-grammar #'octave-smie-rules | 584 | (smie-setup octave-smie-grammar #'octave-smie-rules |
| 586 | :forward-token #'octave-smie-forward-token | 585 | :forward-token #'octave-smie-forward-token |
| 587 | :backward-token #'octave-smie-backward-token) | 586 | :backward-token #'octave-smie-backward-token) |
| 588 | (set (make-local-variable 'smie-indent-basic) 'octave-block-offset) | 587 | (setq-local smie-indent-basic 'octave-block-offset) |
| 589 | 588 | ||
| 590 | (set (make-local-variable 'smie-blink-matching-triggers) | 589 | (setq-local smie-blink-matching-triggers |
| 591 | (cons ?\; smie-blink-matching-triggers)) | 590 | (cons ?\; smie-blink-matching-triggers)) |
| 592 | (unless octave-blink-matching-block | 591 | (unless octave-blink-matching-block |
| 593 | (remove-hook 'post-self-insert-hook #'smie-blink-matching-open 'local)) | 592 | (remove-hook 'post-self-insert-hook #'smie-blink-matching-open 'local)) |
| 594 | 593 | ||
| 595 | (set (make-local-variable 'electric-indent-chars) | 594 | (setq-local electric-indent-chars |
| 596 | (cons ?\; electric-indent-chars)) | 595 | (cons ?\; electric-indent-chars)) |
| 597 | ;; IIUC matlab-mode takes the opposite approach: it makes RET insert | 596 | ;; IIUC matlab-mode takes the opposite approach: it makes RET insert |
| 598 | ;; a ";" at those places where it's correct (i.e. outside of parens). | 597 | ;; a ";" at those places where it's correct (i.e. outside of parens). |
| 599 | (set (make-local-variable 'electric-layout-rules) '((?\; . after))) | 598 | (setq-local electric-layout-rules '((?\; . after))) |
| 600 | 599 | ||
| 601 | (set (make-local-variable 'comment-start) octave-comment-start) | 600 | (setq-local comment-start octave-comment-start) |
| 602 | (set (make-local-variable 'comment-end) "") | 601 | (setq-local comment-end "") |
| 603 | ;; Don't set it here: it's not really a property of the language, | 602 | ;; Don't set it here: it's not really a property of the language, |
| 604 | ;; just a personal preference of the author. | 603 | ;; just a personal preference of the author. |
| 605 | ;; (set (make-local-variable 'comment-column) 32) | 604 | ;; (setq-local comment-column 32) |
| 606 | (set (make-local-variable 'comment-start-skip) "\\s<+\\s-*") | 605 | (setq-local comment-start-skip "\\s<+\\s-*") |
| 607 | (set (make-local-variable 'comment-add) 1) | 606 | (setq-local comment-add 1) |
| 608 | 607 | ||
| 609 | (set (make-local-variable 'parse-sexp-ignore-comments) t) | 608 | (setq-local parse-sexp-ignore-comments t) |
| 610 | (set (make-local-variable 'paragraph-start) | 609 | (setq-local paragraph-start (concat "\\s-*$\\|" page-delimiter)) |
| 611 | (concat "\\s-*$\\|" page-delimiter)) | 610 | (setq-local paragraph-separate paragraph-start) |
| 612 | (set (make-local-variable 'paragraph-separate) paragraph-start) | 611 | (setq-local paragraph-ignore-fill-prefix t) |
| 613 | (set (make-local-variable 'paragraph-ignore-fill-prefix) t) | 612 | (setq-local fill-paragraph-function 'octave-fill-paragraph) |
| 614 | (set (make-local-variable 'fill-paragraph-function) 'octave-fill-paragraph) | ||
| 615 | ;; FIXME: Why disable it? | 613 | ;; FIXME: Why disable it? |
| 616 | ;; (set (make-local-variable 'adaptive-fill-regexp) nil) | 614 | ;; (setq-local adaptive-fill-regexp nil) |
| 617 | ;; Again, this is not a property of the language, don't set it here. | 615 | ;; Again, this is not a property of the language, don't set it here. |
| 618 | ;; (set (make-local-variable 'fill-column) 72) | 616 | ;; (setq fill-column 72) |
| 619 | (set (make-local-variable 'normal-auto-fill-function) 'octave-auto-fill) | 617 | (setq-local normal-auto-fill-function 'octave-auto-fill) |
| 620 | 618 | ||
| 621 | (set (make-local-variable 'font-lock-defaults) | 619 | (setq font-lock-defaults '(octave-font-lock-keywords)) |
| 622 | '(octave-font-lock-keywords)) | ||
| 623 | 620 | ||
| 624 | (set (make-local-variable 'syntax-propertize-function) | 621 | (setq-local syntax-propertize-function #'octave-syntax-propertize-function) |
| 625 | #'octave-syntax-propertize-function) | ||
| 626 | 622 | ||
| 627 | (set (make-local-variable 'imenu-generic-expression) | 623 | (setq imenu-generic-expression octave-mode-imenu-generic-expression) |
| 628 | octave-mode-imenu-generic-expression) | 624 | (setq imenu-case-fold-search nil) |
| 629 | (set (make-local-variable 'imenu-case-fold-search) nil) | ||
| 630 | 625 | ||
| 631 | (add-hook 'completion-at-point-functions | 626 | (add-hook 'completion-at-point-functions |
| 632 | 'octave-completion-at-point-function nil t) | 627 | 'octave-completion-at-point-function nil t) |
| 633 | (set (make-local-variable 'beginning-of-defun-function) | 628 | (setq-local beginning-of-defun-function 'octave-beginning-of-defun) |
| 634 | 'octave-beginning-of-defun) | ||
| 635 | 629 | ||
| 636 | (easy-menu-add octave-mode-menu)) | 630 | (easy-menu-add octave-mode-menu)) |
| 637 | 631 | ||
| @@ -738,21 +732,20 @@ Entry to this mode successively runs the hooks `comint-mode-hook' and | |||
| 738 | mode-line-process '(":%s") | 732 | mode-line-process '(":%s") |
| 739 | local-abbrev-table octave-abbrev-table) | 733 | local-abbrev-table octave-abbrev-table) |
| 740 | 734 | ||
| 741 | (set (make-local-variable 'comment-start) octave-comment-start) | 735 | (setq-local comment-start octave-comment-start) |
| 742 | (set (make-local-variable 'comment-end) "") | 736 | (setq-local comment-end "") |
| 743 | (set (make-local-variable 'comment-column) 32) | 737 | (setq comment-column 32) |
| 744 | (set (make-local-variable 'comment-start-skip) octave-comment-start-skip) | 738 | (setq-local comment-start-skip octave-comment-start-skip) |
| 745 | 739 | ||
| 746 | (set (make-local-variable 'font-lock-defaults) | 740 | (setq font-lock-defaults '(inferior-octave-font-lock-keywords nil nil)) |
| 747 | '(inferior-octave-font-lock-keywords nil nil)) | ||
| 748 | 741 | ||
| 749 | (set (make-local-variable 'info-lookup-mode) 'octave-mode) | 742 | (setq info-lookup-mode 'octave-mode) |
| 750 | 743 | ||
| 751 | (setq comint-input-ring-file-name | 744 | (setq comint-input-ring-file-name |
| 752 | (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist") | 745 | (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist") |
| 753 | comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024)) | 746 | comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024)) |
| 754 | (set (make-local-variable 'comint-dynamic-complete-functions) | 747 | (setq-local comint-dynamic-complete-functions |
| 755 | inferior-octave-dynamic-complete-functions) | 748 | inferior-octave-dynamic-complete-functions) |
| 756 | (add-hook 'comint-input-filter-functions | 749 | (add-hook 'comint-input-filter-functions |
| 757 | 'inferior-octave-directory-tracker nil t) | 750 | 'inferior-octave-directory-tracker nil t) |
| 758 | (comint-read-input-ring t)) | 751 | (comint-read-input-ring t)) |
| @@ -989,19 +982,17 @@ directory and makes this the current buffer's default directory." | |||
| 989 | 982 | ||
| 990 | ;;; Miscellaneous useful functions | 983 | ;;; Miscellaneous useful functions |
| 991 | 984 | ||
| 992 | (defsubst octave-in-comment-p () | 985 | (defun octave-in-comment-p () |
| 993 | "Return t if point is inside an Octave comment." | 986 | "Return non-nil if point is inside an Octave comment." |
| 994 | (nth 4 (syntax-ppss))) | 987 | (nth 4 (syntax-ppss))) |
| 995 | 988 | ||
| 996 | (defsubst octave-in-string-p () | 989 | (defun octave-in-string-p () |
| 997 | "Return t if point is inside an Octave string." | 990 | "Return non-nil if point is inside an Octave string." |
| 998 | (nth 3 (syntax-ppss))) | 991 | (nth 3 (syntax-ppss))) |
| 999 | 992 | ||
| 1000 | (defsubst octave-not-in-string-or-comment-p () | 993 | (defun octave-in-string-or-comment-p () |
| 1001 | "Return t if point is not inside an Octave string or comment." | 994 | "Return non-nil if point is inside an Octave string or comment." |
| 1002 | (let ((pps (syntax-ppss))) | 995 | (nth 8 (syntax-ppss))) |
| 1003 | (not (or (nth 3 pps) (nth 4 pps))))) | ||
| 1004 | |||
| 1005 | 996 | ||
| 1006 | (defun octave-looking-at-kw (regexp) | 997 | (defun octave-looking-at-kw (regexp) |
| 1007 | "Like `looking-at', but sets `case-fold-search' nil." | 998 | "Like `looking-at', but sets `case-fold-search' nil." |
| @@ -1149,8 +1140,8 @@ Returns t unless search stops at the beginning or end of the buffer." | |||
| 1149 | (while (and (/= arg 0) | 1140 | (while (and (/= arg 0) |
| 1150 | (setq found | 1141 | (setq found |
| 1151 | (re-search-backward "\\_<function\\_>" inc))) | 1142 | (re-search-backward "\\_<function\\_>" inc))) |
| 1152 | (if (octave-not-in-string-or-comment-p) | 1143 | (unless (octave-in-string-or-comment-p) |
| 1153 | (setq arg (- arg inc)))) | 1144 | (setq arg (- arg inc)))) |
| 1154 | (if found | 1145 | (if found |
| 1155 | (progn | 1146 | (progn |
| 1156 | (and (< inc 0) (goto-char (match-beginning 0))) | 1147 | (and (< inc 0) (goto-char (match-beginning 0))) |
| @@ -1330,7 +1321,7 @@ Note that all Octave mode abbrevs start with a grave accent." | |||
| 1330 | "Insert an Octave function skeleton. | 1321 | "Insert an Octave function skeleton. |
| 1331 | Prompt for the function's name, arguments and return values (to be | 1322 | Prompt for the function's name, arguments and return values (to be |
| 1332 | entered without parens)." | 1323 | entered without parens)." |
| 1333 | (let* ((defname (substring (buffer-name) 0 -2)) | 1324 | (let* ((defname (file-name-sans-extension (buffer-name))) |
| 1334 | (name (read-string (format "Function name (default %s): " defname) | 1325 | (name (read-string (format "Function name (default %s): " defname) |
| 1335 | nil nil defname)) | 1326 | nil nil defname)) |
| 1336 | (args (read-string "Arguments: ")) | 1327 | (args (read-string "Arguments: ")) |
| @@ -1450,26 +1441,7 @@ code line." | |||
| 1450 | "\n"))) | 1441 | "\n"))) |
| 1451 | (mapconcat 'identity inferior-octave-output-list "\n"))) | 1442 | (mapconcat 'identity inferior-octave-output-list "\n"))) |
| 1452 | (terpri))) | 1443 | (terpri))) |
| 1453 | 1444 | ||
| 1454 | ;;; Bug reporting | ||
| 1455 | (defun octave-submit-bug-report () | ||
| 1456 | "Submit a bug report on the Emacs Octave package via mail." | ||
| 1457 | (interactive) | ||
| 1458 | (require 'reporter) | ||
| 1459 | (and | ||
| 1460 | (y-or-n-p "Do you want to submit a bug report? ") | ||
| 1461 | (reporter-submit-bug-report | ||
| 1462 | octave-maintainer-address | ||
| 1463 | (concat "Emacs version " emacs-version) | ||
| 1464 | (list | ||
| 1465 | 'octave-blink-matching-block | ||
| 1466 | 'octave-block-offset | ||
| 1467 | 'octave-comment-char | ||
| 1468 | 'octave-continuation-offset | ||
| 1469 | 'octave-continuation-string | ||
| 1470 | 'octave-send-echo-input | ||
| 1471 | 'octave-send-line-auto-forward | ||
| 1472 | 'octave-send-show-buffer)))) | ||
| 1473 | 1445 | ||
| 1474 | (provide 'octave) | 1446 | (provide 'octave) |
| 1475 | ;;; octave.el ends here | 1447 | ;;; octave.el ends here |