# HG changeset patch # User Stefan Monnier # Date 1190213271 0 # Node ID 4c09574b352790499ed34db77b422dad6cdf0604 # Parent 9b686572bf3fa6aca29bafc81abe0c05c659151e Remove spurious * in docstrings. (octave-mode-map): Move init into declaration and remove \t binding. (octave-mode-startup-message): Remove unused var. (octave-scan-blocks): Remove unused arg `from'. (octave-forward-block, octave-down-block, octave-up-block): Update callers. diff -r 9b686572bf3f -r 4c09574b3527 lisp/ChangeLog --- a/lisp/ChangeLog Wed Sep 19 14:32:53 2007 +0000 +++ b/lisp/ChangeLog Wed Sep 19 14:47:51 2007 +0000 @@ -1,5 +1,12 @@ 2007-09-19 Stefan Monnier + * progmodes/octave-mod.el: Remove spurious * in docstrings. + (octave-mode-map): Move init into declaration and remove \t binding. + (octave-mode-startup-message): Remove unused var. + (octave-scan-blocks): Remove unused arg `from'. + (octave-forward-block, octave-down-block, octave-up-block): + Update callers. + * progmodes/meta-mode.el (meta-mode-syntax-table): Move init into decl. (meta-mode-map): Likewise and remove \t binding. diff -r 9b686572bf3f -r 4c09574b3527 lisp/progmodes/octave-mod.el --- a/lisp/progmodes/octave-mod.el Wed Sep 19 14:32:53 2007 +0000 +++ b/lisp/progmodes/octave-mod.el Wed Sep 19 14:47:51 2007 +0000 @@ -63,7 +63,7 @@ (unless octave-abbrev-table (define-abbrev-table 'octave-abbrev-table ())) -(let ((ac abbrevs-changed)) +(let ((abbrevs-changed abbrevs-changed)) (define-abbrev octave-abbrev-table "`a" "all_va_args" nil 0 t) (define-abbrev octave-abbrev-table "`b" "break" nil 0 t) (define-abbrev octave-abbrev-table "`cs" "case" nil 0 t) @@ -91,8 +91,7 @@ (define-abbrev octave-abbrev-table "`t" "try" nil 0 t) (define-abbrev octave-abbrev-table "`up" "unwind_protect" nil 0 t) (define-abbrev octave-abbrev-table "`upc" "unwind_protect_cleanup" nil 0 t) - (define-abbrev octave-abbrev-table "`w" "while ()" nil 0 t) - (setq abbrevs-changed ac)) + (define-abbrev octave-abbrev-table "`w" "while ()" nil 0 t)) (defvar octave-comment-char ?# "Character to start an Octave comment.") @@ -193,22 +192,18 @@ "Additional Octave expressions to highlight.") (defcustom inferior-octave-buffer "*Inferior Octave*" - "*Name of buffer for running an inferior Octave process." + "Name of buffer for running an inferior Octave process." :type 'string :group 'octave-inferior) (defvar inferior-octave-process nil) -(defvar octave-mode-map nil - "Keymap used in Octave mode.") -(if octave-mode-map - () +(defvar octave-mode-map (let ((map (make-sparse-keymap))) (define-key map "`" 'octave-abbrev-start) (define-key map ";" 'octave-electric-semi) (define-key map " " 'octave-electric-space) (define-key map "\n" 'octave-reindent-then-newline-and-indent) - (define-key map "\t" 'indent-according-to-mode) (define-key map "\e;" 'octave-indent-for-comment) (define-key map "\e\n" 'octave-indent-new-comment-line) (define-key map "\e\t" 'octave-complete-symbol) @@ -245,49 +240,51 @@ (define-key map "\C-c\C-i\C-s" 'octave-show-process-buffer) (define-key map "\C-c\C-i\C-h" 'octave-hide-process-buffer) (define-key map "\C-c\C-i\C-k" 'octave-kill-process) - (setq octave-mode-map map))) + map) + "Keymap used in Octave mode.") + (defvar octave-mode-menu - (list "Octave" - (list "Lines" - ["Previous Code Line" octave-previous-code-line t] - ["Next Code Line" octave-next-code-line t] - ["Begin of Continuation" octave-beginning-of-line t] - ["End of Continuation" octave-end-of-line t] - ["Split Line at Point" octave-indent-new-comment-line t]) - (list "Blocks" - ["Next Block" octave-forward-block t] - ["Previous Block" octave-backward-block t] - ["Down Block" octave-down-block t] - ["Up Block" octave-backward-up-block t] - ["Mark Block" octave-mark-block t] - ["Close Block" octave-close-block t]) - (list "Functions" - ["Begin of Function" octave-beginning-of-defun t] - ["End of Function" octave-end-of-defun t] - ["Mark Function" octave-mark-defun t] - ["Indent Function" octave-indent-defun t] - ["Insert Function" octave-insert-defun t]) - "-" - (list "Debug" - ["Send Current Line" octave-send-line t] - ["Send Current Block" octave-send-block t] - ["Send Current Function" octave-send-defun t] - ["Send Region" octave-send-region t] - ["Show Process Buffer" octave-show-process-buffer t] - ["Hide Process Buffer" octave-hide-process-buffer t] - ["Kill Process" octave-kill-process t]) - "-" - ["Indent Line" indent-according-to-mode t] - ["Complete Symbol" octave-complete-symbol t] - "-" - ["Toggle Abbrev Mode" abbrev-mode t] - ["Toggle Auto-Fill Mode" auto-fill-mode t] - "-" - ["Submit Bug Report" octave-submit-bug-report t] - "-" - ["Describe Octave Mode" octave-describe-major-mode t] - ["Lookup Octave Index" octave-help t]) + '("Octave" + '("Lines" + ["Previous Code Line" octave-previous-code-line t] + ["Next Code Line" octave-next-code-line t] + ["Begin of Continuation" octave-beginning-of-line t] + ["End of Continuation" octave-end-of-line t] + ["Split Line at Point" octave-indent-new-comment-line t]) + '("Blocks" + ["Next Block" octave-forward-block t] + ["Previous Block" octave-backward-block t] + ["Down Block" octave-down-block t] + ["Up Block" octave-backward-up-block t] + ["Mark Block" octave-mark-block t] + ["Close Block" octave-close-block t]) + '("Functions" + ["Begin of Function" octave-beginning-of-defun t] + ["End of Function" octave-end-of-defun t] + ["Mark Function" octave-mark-defun t] + ["Indent Function" octave-indent-defun t] + ["Insert Function" octave-insert-defun t]) + "-" + '("Debug" + ["Send Current Line" octave-send-line t] + ["Send Current Block" octave-send-block t] + ["Send Current Function" octave-send-defun t] + ["Send Region" octave-send-region t] + ["Show Process Buffer" octave-show-process-buffer t] + ["Hide Process Buffer" octave-hide-process-buffer t] + ["Kill Process" octave-kill-process t]) + "-" + ["Indent Line" indent-according-to-mode t] + ["Complete Symbol" octave-complete-symbol t] + "-" + ["Toggle Abbrev Mode" abbrev-mode t] + ["Toggle Auto-Fill Mode" auto-fill-mode t] + "-" + ["Submit Bug Report" octave-submit-bug-report t] + "-" + ["Describe Octave Mode" octave-describe-major-mode t] + ["Lookup Octave Index" octave-help t]) "Menu for Octave mode.") (defvar octave-mode-syntax-table @@ -316,23 +313,23 @@ "Syntax table in use in `octave-mode' buffers.") (defcustom octave-auto-indent nil - "*Non-nil means indent line after a semicolon or space in Octave mode." + "Non-nil means indent line after a semicolon or space in Octave mode." :type 'boolean :group 'octave) (defcustom octave-auto-newline nil - "*Non-nil means automatically newline after a semicolon in Octave mode." + "Non-nil means automatically newline after a semicolon in Octave mode." :type 'boolean :group 'octave) (defcustom octave-blink-matching-block t - "*Control the blinking of matching Octave block keywords. + "Control the blinking of matching Octave block keywords. Non-nil means show matching begin of block when inserting a space, newline or semicolon after an else or end keyword." :type 'boolean :group 'octave) (defcustom octave-block-offset 2 - "*Extra indentation applied to statements in Octave block structures." + "Extra indentation applied to statements in Octave block structures." :type 'integer :group 'octave) @@ -370,13 +367,13 @@ "String to insert to start a new Octave comment on an empty line.") (defcustom octave-continuation-offset 4 - "*Extra indentation applied to Octave continuation lines." + "Extra indentation applied to Octave continuation lines." :type 'integer :group 'octave) (defvar octave-continuation-regexp "[^#%\n]*\\(\\\\\\|\\.\\.\\.\\)\\s-*\\(\\s<.*\\)?$") (defcustom octave-continuation-string "\\" - "*Character string used for Octave continuation lines. Normally \\." + "Character string used for Octave continuation lines. Normally \\." :type 'string :group 'octave) @@ -392,27 +389,22 @@ (list nil octave-function-header-regexp 3)) "Imenu expression for Octave mode. See `imenu-generic-expression'.") -(defcustom octave-mode-startup-message t - "*nil means do not display the Octave mode startup message." - :type 'boolean - :group 'octave) - (defcustom octave-mode-hook nil - "*Hook to be run when Octave mode is started." + "Hook to be run when Octave mode is started." :type 'hook :group 'octave) (defcustom octave-send-show-buffer t - "*Non-nil means display `inferior-octave-buffer' after sending to it." + "Non-nil means display `inferior-octave-buffer' after sending to it." :type 'boolean :group 'octave) (defcustom octave-send-line-auto-forward t - "*Control auto-forward after sending to the inferior Octave process. + "Control auto-forward after sending to the inferior Octave process. Non-nil means always go to the next Octave code line after sending." :type 'boolean :group 'octave) (defcustom octave-send-echo-input t - "*Non-nil means echo input sent to the inferior Octave process." + "Non-nil means echo input sent to the inferior Octave process." :type 'boolean :group 'octave) @@ -423,7 +415,7 @@ This mode makes it easier to write Octave code by helping with indentation, doing some of the typing for you (with Abbrev mode) and by -showing keywords, comments, strings, etc. in different faces (with +showing keywords, comments, strings, etc.. in different faces (with Font Lock mode on terminals that support it). Octave itself is a high-level language, primarily intended for numerical @@ -446,43 +438,39 @@ Variables you can use to customize Octave mode ============================================== -octave-auto-indent +`octave-auto-indent' Non-nil means indent current line after a semicolon or space. Default is nil. -octave-auto-newline +`octave-auto-newline' Non-nil means auto-insert a newline and indent after a semicolon. Default is nil. -octave-blink-matching-block +`octave-blink-matching-block' Non-nil means show matching begin of block when inserting a space, newline or semicolon after an else or end keyword. Default is t. -octave-block-offset +`octave-block-offset' Extra indentation applied to statements in block structures. Default is 2. -octave-continuation-offset +`octave-continuation-offset' Extra indentation applied to Octave continuation lines. Default is 4. -octave-continuation-string +`octave-continuation-string' String used for Octave continuation lines. Default is a backslash. -octave-mode-startup-message - nil means do not display the Octave mode startup message. - Default is t. - -octave-send-echo-input +`octave-send-echo-input' Non-nil means always display `inferior-octave-buffer' after sending a command to the inferior Octave process. -octave-send-line-auto-forward +`octave-send-line-auto-forward' Non-nil means always go to the next unsent line of Octave code after sending a line to the inferior Octave process. -octave-send-echo-input +`octave-send-echo-input' Non-nil means echo input sent to the inferior Octave process. Turning on Octave mode runs the hook `octave-mode-hook'. @@ -490,19 +478,15 @@ To begin using this mode for all `.m' files that you edit, add the following lines to your `.emacs' file: - (autoload 'octave-mode \"octave-mod\" nil t) - (setq auto-mode-alist - (cons '(\"\\\\.m$\" . octave-mode) auto-mode-alist)) + (add-to-list 'auto-mode-alist '(\"\\\\.m\\\\'\" . octave-mode)) -To automatically turn on the abbrev, auto-fill and font-lock features, +To automatically turn on the abbrev and auto-fill, add the following lines to your `.emacs' file as well: (add-hook 'octave-mode-hook (lambda () (abbrev-mode 1) - (auto-fill-mode 1) - (if (eq window-system 'x) - (font-lock-mode 1)))) + (auto-fill-mode 1))) To submit a problem report, enter \\[octave-submit-bug-report] from \ an Octave mode buffer. @@ -773,7 +757,7 @@ (octave-reindent-then-newline-and-indent)))) (defun octave-indent-defun () - "Properly indents the Octave function which contains point." + "Properly indent the Octave function which contains point." (interactive) (save-excursion (octave-mark-defun) @@ -856,8 +840,8 @@ (zerop (forward-line 1))))) (end-of-line))) -(defun octave-scan-blocks (from count depth) - "Scan from character number FROM by COUNT Octave begin-end blocks. +(defun octave-scan-blocks (count depth) + "Scan from point by COUNT Octave begin-end blocks. Returns the character number of the position thus found. If DEPTH is nonzero, block depth begins counting from that value. @@ -895,7 +879,7 @@ Negative arg -N means move backward across N blocks." (interactive "p") (or arg (setq arg 1)) - (goto-char (or (octave-scan-blocks (point) arg 0) (buffer-end arg)))) + (goto-char (or (octave-scan-blocks arg 0) (buffer-end arg)))) (defun octave-backward-block (&optional arg) "Move backward across one balanced Octave begin-end block. @@ -913,7 +897,7 @@ (interactive "p") (let ((inc (if (> arg 0) 1 -1))) (while (/= arg 0) - (goto-char (or (octave-scan-blocks (point) inc -1) + (goto-char (or (octave-scan-blocks inc -1) (buffer-end arg))) (setq arg (- arg inc))))) @@ -933,7 +917,7 @@ (interactive "p") (let ((inc (if (> arg 0) 1 -1))) (while (/= arg 0) - (goto-char (or (octave-scan-blocks (point) inc 1) + (goto-char (or (octave-scan-blocks inc 1) (buffer-end arg))) (setq arg (- arg inc))))) @@ -1149,6 +1133,8 @@ (defun octave-fill-paragraph (&optional arg) "Fill paragraph of Octave code, handling Octave comments." + ;; FIXME: now that the default fill-paragraph takes care of similar issues, + ;; this seems obsolete. --Stef (interactive "P") (save-excursion (let ((end (progn (forward-paragraph) (point))) @@ -1389,7 +1375,7 @@ ;;; Menu (defun octave-add-octave-menu () - "Adds the `Octave' menu to the menu bar in Octave mode." + "Add the `Octave' menu to the menu bar in Octave mode." (require 'easymenu) (easy-menu-define octave-mode-menu-map octave-mode-map "Menu keymap for Octave mode." octave-mode-menu) @@ -1519,7 +1505,6 @@ 'octave-continuation-offset 'octave-continuation-string 'octave-help-files - 'octave-mode-startup-message 'octave-send-echo-input 'octave-send-line-auto-forward 'octave-send-show-buffer)))) @@ -1528,5 +1513,5 @@ (provide 'octave-mod) -;;; arch-tag: 05f1ce09-be87-4c00-803e-4919ffa26c23 +;; arch-tag: 05f1ce09-be87-4c00-803e-4919ffa26c23 ;;; octave-mod.el ends here