home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / octave-1.1.1p1-base.tgz / octave-1.1.1p1-base.tar / fsf / octave / octave-mode.el < prev    next >
Lisp/Scheme  |  1994-09-07  |  18KB  |  562 lines

  1. ;; octave-mode.el - major mode for Octave function files
  2. ;;
  3. ;; Copyright (C) 1994 John W. Eaton
  4. ;; 
  5. ;; This file is part of Octave.
  6. ;; 
  7. ;; Octave is free software; you can redistribute it and/or modify it
  8. ;; under the terms of the GNU General Public License as published by the
  9. ;; Free Software Foundation; either version 2, or (at your option) any
  10. ;; later version.
  11. ;; 
  12. ;; Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. ;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. ;; for more details.
  16. ;; 
  17. ;; You should have received a copy of the GNU General Public License
  18. ;; along with Octave; see the file COPYING.  If not, write to the Free
  19. ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20. ;; 
  21. ;; This major mode for GNU emacs provides support for editing Octave
  22. ;; function files.  It requires matlab-mode.el, which was written by
  23. ;; Matthew R. Wette <mwette@csi.jpl.nasa.gov>.
  24. ;;
  25. ;; It automatically indents block structures, line continuations
  26. ;; (e.g., ...), and comments.  The usual paren matching support is
  27. ;; included.  Filling and auto-fill works for comment lines.  For
  28. ;; convenient use, put this file and matlab.el in your Emacs
  29. ;; load-path and add something like the following to your .emacs
  30. ;; start-up file:
  31. ;;
  32. ;;   (autoload 'octave-mode "octave-mode" "Enter Octave mode." t)
  33. ;;   (setq auto-mode-alist (cons '("\\.m$" . octave-mode) auto-mode-alist))
  34. ;;   (defun my-octave-mode-hook ()
  35. ;;     (setq fill-column 76)
  36. ;;     (turn-on-auto-fill))
  37. ;;   (setq octave-mode-hook 'my-octave-mode-hook)
  38. ;;
  39. ;; For Lucid Emacs, add ``(font-lock-mode 1)'' to your octave-bmode-hook.
  40.  
  41. ;; Customize Matlab mode for Octave users.
  42.  
  43. (setq matlab-comment-column 0)
  44. (setq matlab-comment-line-s "# ")
  45. (setq matlab-comment-on-line-s "# ")
  46. (setq matlab-comment-region-s "#$$$ ")
  47.  
  48. (defconst matlab-show-vers t
  49.   "*If non-nil, shows the version number on load.")
  50.  
  51. ;; octave-mode
  52. (defun matlab-mode ()
  53.   "Major mode for editing Octave function files.  Version 1.0.
  54. Will run octave-mode-hook if it is non-nil.  Filling works (comments justify).
  55.  
  56. Special Key Bindings:
  57. \\{matlab-mode-map}
  58. Variables:
  59.   matlab-indent-level                   Level to indent blocks.
  60.   matlab-comment-column                 Goal column for on-line comments.
  61.   fill-column                           Column used in auto-fill.
  62.   matlab-comment-line-s                String to start comment line.
  63.   matlab-comment-region-s            String to put comment lines in region.
  64.   matlab-indent-before-return        If t, matlab-indent-line before RET.
  65.   matlab-indent-end-before-return    If t, indent-line before RET on end.
  66.   matlab-show-vers            If t, show version on start-up.
  67.  
  68. Commands:
  69.   matlab-mode                           Enter MATLAB major mode.
  70.   matlab-return                         RET with post indenting.
  71.   matlab-linefeed                       RET with pre and post indent.
  72.   matlab-comment-return            RET for next-line comment.
  73.   matlab-indent-line                    Indent line for structure.
  74.   matlab-comment                        Add comment to current line.
  75.   matlab-comment-indent                 Compute indent for comment.
  76.   matlab-comment-region            Comment (with arg, uncomment) region.
  77.   matlab-fill-region            Fill region (usually comments).
  78.   matlab-justify-line            Delete space on end and justify.
  79.  
  80. To add automatic support put something like the following in your .emacs file:
  81.   \(autoload 'matlab-mode \"matlab-mode\" \"Enter Matlab mode.\" t\)
  82.   \(setq auto-mode-alist \(cons '\(\"\\\\.m$\" . matlab-mode\) \
  83. auto-mode-alist\)\)
  84.   \(defun my-matlab-mode-hook \(\)
  85.     \(setq fill-column 76\)
  86.     \(turn-on-auto-fill\)\)
  87.   \(setq matlab-mode-hook 'my-matlab-mode-hook\)"
  88.   (interactive)
  89.   (kill-all-local-variables)
  90.   (use-local-map matlab-mode-map)
  91.   (setq major-mode 'matlab-mode)
  92.   (setq mode-name "Matlab")
  93.   (setq local-abbrev-table matlab-mode-abbrev-table)
  94.   (set-syntax-table matlab-mode-syntax-table)
  95.   (make-local-variable 'paragraph-start)
  96.   (setq paragraph-start (concat "^$\\|" page-delimiter))
  97.   (make-local-variable 'paragraph-separate)
  98.   (setq paragraph-separate paragraph-start)
  99.   (make-local-variable 'paragraph-ignore-fill-prefix)
  100.   (setq paragraph-ignore-fill-prefix t)
  101.   (make-local-variable 'indent-line-function)
  102.   (setq indent-line-function 'matlab-indent-line)
  103.   (make-local-variable 'comment-start-skip)
  104.   (setq comment-start-skip "%[ \t]*")
  105.   (make-local-variable 'comment-column)
  106.   (setq comment-column 'matlab-comment-column)
  107.   (make-local-variable 'auto-fill-hook)
  108.   (setq auto-fill-hook 'matlab-auto-fill)
  109.   (make-local-variable 'comment-indent-hook)
  110.   (setq comment-indent-hook 'matlab-comment-indent)
  111.   (make-local-variable 'fill-column)
  112.   (setq fill-column default-fill-column)
  113.   (make-local-variable 'fill-prefix)
  114.   (setq fill-prefix matlab-comment-line-s)
  115.   ;;(setq font-lock-keywords matlab-font-lock-keywords) ;; Lucid emacs
  116.   ;;(setq (make-local-variable 'font-lock-keywords) matlab-font-lock-keywords)
  117.   (run-hooks 'matlab-mode-hook)
  118.   (if matlab-show-vers
  119.       (message "matlab-mode, Version 1.06.0 Dated 23Nov93")))
  120.  
  121.  
  122. (defconst mtlb-cline-start-skip "[ \t]*%[ \t]*"
  123.   "*The regular expression for skipping comment start.")
  124.  
  125. ;;
  126. (defun matlab-auto-fill ()
  127.   "Do filling."
  128.   (interactive)
  129.   (cond
  130.    ((mtlb-ltype-comment) do-auto-fill)
  131.    ((mtlb-lattr-comment) do-auto-fill)
  132.    (t ())))
  133.    
  134.  
  135. (defun matlab-return ()
  136.   "Handle carriage return in matlab-mode."
  137.   (interactive)
  138.   (if matlab-indent-before-return
  139.       (matlab-indent-line)
  140.     (if matlab-indent-end-before-return
  141.     (if (mtlb-ltype-block-end) (matlab-indent-line))))
  142.   (newline)
  143.   (matlab-indent-line))
  144.  
  145. (defun matlab-linefeed ()
  146.   "Handle linefeed in matlab-mode.
  147. Has effect of matlab-return with (not matlab-indent-before-return)."
  148.   (interactive)
  149.   (if (not matlab-indent-before-return) (matlab-indent-line))
  150.   (newline)
  151.   (matlab-indent-line))
  152.  
  153. (defun matlab-comment-return ()
  154.   "Handle carriage return for matlab comment line."
  155.   (interactive)
  156.   (cond
  157.    ((mtlb-ltype-comment)
  158.     (mtlb-set-comment-fill-prefix) (newline) (insert fill-prefix)
  159.     (matlab-indent-line))
  160.    ((mtlb-lattr-comment)
  161.     (newline) (indent-to matlab-comment-column)
  162.     (insert matlab-comment-on-line-s))
  163.    (t
  164.     (newline) (matlab-comment) (matlab-indent-line))))
  165.  
  166. (defun matlab-indent-line ()
  167.   "Indent a line in matlab-mode."
  168.   (interactive)
  169.   (save-excursion
  170.     (beginning-of-line)
  171.     (delete-horizontal-space)
  172.     (indent-to (mtlb-calc-indent))
  173.     ;; -- If line contains a comment, format it. --
  174.     (if (or (mtlb-ltype-comment) (mtlb-lattr-comment))
  175.     (matlab-comment)))
  176.   (skip-chars-forward " \t%"))
  177.  
  178.  
  179. (defun matlab-comment ()
  180.   "Add a comment to the current line.  If one already exists, format it."
  181.   (interactive)
  182.   (cond
  183.    ((mtlb-ltype-empty)
  184.     (matlab-indent-line)
  185.     (insert matlab-comment-line-s))
  186.    ((mtlb-ltype-comment)
  187.     (save-excursion
  188.       (if (and (= 0 (forward-line -1)) (mtlb-ltype-comment))
  189.       (progn 
  190.         (mtlb-set-comment-fill-prefix)
  191.         (forward-line 1)
  192.         (beginning-of-line)
  193.         (delete-horizontal-space) (delete-char 1) (delete-horizontal-space)
  194.         (insert fill-prefix)))))
  195.    ((mtlb-lattr-comment)
  196.     (beginning-of-line)
  197.     (search-forward "%")
  198.     (forward-char -1)
  199.     (delete-horizontal-space)
  200.     (insert " ")
  201.     (if (< (current-column) matlab-comment-column)
  202.       (indent-to matlab-comment-column))
  203.     (skip-chars-forward "% "))
  204.    (t
  205.     (end-of-line)
  206.     (re-search-backward "[^ \t\n^]" 0 t)
  207.     (forward-char)
  208.     (delete-horizontal-space)
  209.     (if (< (current-column) matlab-comment-column)
  210.         (indent-to matlab-comment-column)
  211.       (insert " "))
  212.     (insert matlab-comment-on-line-s))))
  213.  
  214.  
  215. (defun matlab-comment-indent ()
  216.   "Indent a comment line in matlab-mode."
  217.   (mtlb-calc-indent))
  218.  
  219. (defun mtlb-calc-indent ()
  220.   "Return the appropriate indentation for this line as an int."
  221.   (let ((indent 0))
  222.     (save-excursion
  223.       (if (not (mtlb-prev-line))
  224.       0
  225.     (setq indent (current-indentation))
  226.     (setq indent
  227.           (+ indent
  228.          (cond
  229.           ((mtlb-ltype-comment) (mtlb-set-comment-fill-prefix) 0)
  230.           ((mtlb-ltype-block-beg) matlab-indent-level)
  231.           ((mtlb-ltype-block-end) 0)
  232.           (t (mtlb-calc-blok-indent)))))
  233.     (if (mtlb-lattr-unbal-mexp)
  234.         (setq indent (+ indent (mtlb-calc-mexp-indent))))
  235.     (if (mtlb-lattr-cont)
  236.         (setq indent (+ indent (* 2 matlab-indent-level)))))
  237.       (if (mtlb-prev-line)
  238.       (if (mtlb-lattr-cont)
  239.         (setq indent (- indent (* 2 matlab-indent-level))))))
  240.     (if (mtlb-ltype-block-end)
  241.     (setq indent (- indent matlab-indent-level)))
  242.     (if (< indent 0) (setq indent 0))
  243.     indent))
  244.  
  245. (defun mtlb-prev-line ()
  246.   "Find the previous line.  Return 0 if not found."
  247.   (interactive)
  248.   (if (/= 0 (forward-line -1))
  249.       ()
  250.     (if (mtlb-ltype-empty)
  251.     (mtlb-prev-line)
  252.       t)))
  253.  
  254. (defun matlab-comment-region (beg-region end-region arg)
  255.   "Comments every line in the region.
  256. Puts matlab-comment-region-s at the beginning of every line in the region. 
  257. BEG-REGION and END-REGION are args which specify the region boundaries. 
  258. With non-nil ARG, uncomments the region."
  259.   (interactive "*r\nP")
  260.   (let ((end-region-mark (make-marker)) (save-point (point-marker)))
  261.     (set-marker end-region-mark end-region)
  262.     (goto-char beg-region)
  263.     (beginning-of-line)
  264.     (if (not arg)            ;comment the region
  265.     (progn (insert matlab-comment-region-s)
  266.            (while (and  (= (forward-line 1) 0)
  267.                 (< (point) end-region-mark))
  268.          (insert matlab-comment-region-s)))
  269.       (let ((com (regexp-quote matlab-comment-region-s))) ;uncomment the region
  270.     (if (looking-at com)
  271.         (delete-region (point) (match-end 0)))
  272.     (while (and  (= (forward-line 1) 0)
  273.              (< (point) end-region-mark))
  274.       (if (looking-at com)
  275.           (delete-region (point) (match-end 0))))))
  276.     (goto-char save-point)
  277.     (set-marker end-region-mark nil)
  278.     (set-marker save-point nil)))
  279.  
  280.  
  281. (defun matlab-fill-region (beg-region end-region &optional justify-flag)
  282.   "Fill the region. Non-nil arg means justify commment lines as well."
  283.   (interactive "*r\nP")
  284.   (let ((end-reg-mk (make-marker)))
  285.     (set-marker end-reg-mk end-region)
  286.     (goto-char beg-region)
  287.     (beginning-of-line)
  288.     (while (< (save-excursion (forward-line 1) (point)) end-reg-mk)
  289.       (if (save-excursion (= (forward-line 1) 0))
  290.       (progn 
  291.         (cond
  292.          ((mtlb-ltype-comment)
  293.           (while (matlab-fill-comment-line))
  294.           (if justify-flag (justify-comment-line))))
  295.         (forward-line 1))))))
  296.  
  297. (defun matlab-fill-comment-line ()
  298.   "Fill the current comment line."
  299.   (interactive)
  300.   (let ((prev-indent-col 0))
  301.     (beginning-of-line)
  302.     (re-search-forward mtlb-cline-start-skip)
  303.     (setq prev-indent-col (current-column))
  304.     (mtlb-set-comment-fill-prefix)
  305.     (if (/= (forward-line 1) 0)
  306.     ()
  307.       (beginning-of-line)
  308.       (re-search-forward mtlb-cline-start-skip)
  309.       (if (/= prev-indent-col (current-column))
  310.       (progn (forward-line -1) ())
  311.     (mtlb-join-comment-lines)
  312.     (if (mtlb-wrap-line)
  313.         (save-excursion
  314.           (forward-line 1)
  315.           (beginning-of-line)
  316.           (insert fill-prefix)
  317.           t))))))
  318.  
  319. (defun mtlb-join-comment-lines ()
  320.   "Join current comment line to previous, deleting space and comment mark."
  321.   (interactive)
  322.   (beginning-of-line)
  323.   (forward-char -1) (delete-char 1)    ; delete newline
  324.   (delete-horizontal-space)
  325.   (delete-char 1)            ; delete "%"
  326.   (delete-horizontal-space)
  327.   (insert " "))
  328.  
  329. (defun mtlb-wrap-line ()
  330.   "Wrap line so last token on line does not exceed fill-column."
  331.   (interactive)
  332.   (save-excursion
  333.     (end-of-line)
  334.     (delete-horizontal-space)
  335.     (if (< (current-column) fill-column)
  336.     ()
  337.       (while (> (current-column) fill-column) (forward-char -1))
  338.       (while (not (looking-at "[ \t]")) (forward-char -1))
  339.       (delete-horizontal-space)
  340.       (insert "\n")
  341.       t)))
  342.  
  343. (defun mtlb-set-comment-fill-prefix ()
  344.   "Set the fill-prefix for the current comment line."
  345.   (setq fill-prefix
  346.     (save-excursion
  347.       (beginning-of-line) 
  348.       (buffer-substring
  349.        (point)
  350.        (progn (re-search-forward mtlb-cline-start-skip) (point)))))
  351.   (if (equal fill-prefix "")
  352.       (setq fill-prefix nil)))
  353.  
  354. (defun matlab-justify-line ()
  355.   "Delete space on end of line and justify."
  356.   (interactive)
  357.   (save-excursion
  358.     (end-of-line)
  359.     (delete-horizontal-space)
  360.     (justify-current-line)))
  361.  
  362.  
  363. ;;;
  364. ;;; line attributes ...
  365. (defun mtlb-lattr-comment ()
  366.   "Returns t if current line contains a comment."
  367.   (save-excursion
  368.     (beginning-of-line)
  369.     (looking-at ".*%")))
  370.  
  371. (defun mtlb-lattr-cont ()
  372.   "Returns t if current line ends in .. and optional comment."
  373.   (save-excursion
  374.     (beginning-of-line)
  375.     (re-search-forward
  376.      "[^; \t.][ \t]*\\.\\.\\.+[ \t]*\\(%.*\\)?$"
  377.      (save-excursion (end-of-line) (point))
  378.      t)))
  379.  
  380. (defun mtlb-lattr-unbal-mexp ()
  381.   (/= (mtlb-calc-mexp-indent) 0))
  382.  
  383.  
  384. ;;;
  385. ;;; line types ...
  386. (defun mtlb-ltype-empty ()
  387.   "Returns t if current line is empty."
  388.   (save-excursion
  389.     (beginning-of-line)
  390.     (looking-at "^[ \t]*$")))
  391.  
  392. (defun mtlb-ltype-comment ()
  393.   "Returns t if current line is a MATLAB comment line."
  394.   (save-excursion
  395.     (beginning-of-line)
  396.     (looking-at "[ \t]*%")))
  397.  
  398. (defun mtlb-ltype-block-beg ()
  399.   "Returns t if line contains beginning of MATLAB block."
  400.   (save-excursion
  401.     (beginning-of-line)
  402.     (and
  403.      (looking-at (concat "[^%\n]*" mtlb-block-beg-kw))
  404.      (not (mtlb-ltype-blk-beg-end)))))
  405.  
  406. (defun mtlb-ltype-block-end ()
  407.   "Returns t if line contains end of MATLAB block."
  408.   (save-excursion
  409.     (beginning-of-line)
  410.     (and
  411.      (looking-at (concat "\\([^%\n]*[ \t]\\)?" mtlb-block-end-kw))
  412.      (not (mtlb-ltype-blk-beg-end)))))
  413.  
  414. (defun mtlb-ltype-blk-beg-end ()
  415.   "Returns t if line contains matching block begin-end in matlab-mode."
  416.   (save-excursion
  417.     (beginning-of-line)
  418.     (looking-at (concat "[^%\n]*" mtlb-block-beg-kw
  419.             "[^%\n]+" mtlb-block-end-kw))))
  420.  
  421.  
  422. ;;;
  423. ;;; utility functions ...
  424. (defconst mtlb-block-beg-kw "\\b\\(for\\|while\\|if\\|else\\|elseif\\)\\b"
  425.   "Regular expression for keywords which begin blocks in matlab-mode.")
  426.  
  427. (defconst mtlb-block-end-kw "\\b\\(end\\|else\\|elseif\\)\\b"
  428.   "Regular expression for keywords which end blocks.")
  429.  
  430. (defun mtlb-calc-blok-indent ()
  431.   (let ((indent 0))
  432.     (save-excursion
  433.       (beginning-of-line)
  434.       (while (< (point) (save-excursion (end-of-line) (point)))
  435.     (cond
  436.      ((looking-at mtlb-block-beg-kw)
  437.       (setq indent (+ indent matlab-indent-level)))
  438.      ((looking-at mtlb-block-end-kw)
  439.       (setq indent (- indent matlab-indent-level))))
  440.     (forward-char)))
  441.     indent))
  442.  
  443. (defun mtlb-calc-mexp-indent ()
  444.   (let ((indent 0))
  445.     (save-excursion
  446.       (beginning-of-line)
  447.       (while (< (point) (save-excursion (end-of-line) (point)))
  448.     (cond
  449.      ((looking-at "\\[")
  450.       (setq indent (+ indent matlab-indent-level)))
  451.      ((looking-at "\\]")
  452.       (setq indent (- indent matlab-indent-level))))
  453.     (forward-char)))
  454.     (* 2 indent)))
  455.  
  456. ;;;
  457. ;;; -- debugging --
  458. (defun matlab-show-line-attr ()
  459.   "Display type and attributes of current line.  Used in debugging."
  460.   (interactive)
  461.   (let ((msg "matlab-show-line-attr:"))
  462.     (cond
  463.      ((mtlb-ltype-empty)
  464.       (setq msg (concat msg " empty")))
  465.      ((mtlb-ltype-comment)
  466.       (setq msg (concat msg " comment")))
  467.      ((mtlb-ltype-block-beg)
  468.       (setq msg (concat msg " block-begin")))
  469.      ((mtlb-ltype-block-end)
  470.       (setq msg (concat msg " block-end")))
  471.      (t
  472.       (setq msg (concat msg " other"))))
  473.     (if (mtlb-lattr-cont)
  474.     (setq msg (concat msg " w/cont")))
  475.     (if (mtlb-lattr-comment)
  476.     (setq msg (concat msg " w/comm")))
  477.     (if (mtlb-lattr-unbal-mexp)
  478.     (setq msg (concat msg " w/unbal-mexp")))
  479.     (message msg)))
  480.  
  481. (defun matlab-show-blok-indent ()
  482.   "Display indentation for matrix expression.  Used in debugging."
  483.   (interactive)
  484.   (let ((msg "matlab-show-blok-indent: "))
  485.     (setq msg (concat msg (mtlb-calc-blok-indent)))
  486.     (message msg)))
  487.  
  488. (defun matlab-show-mexp-indent ()
  489.   "Display indentation for matrix expression.  Used in debugging."
  490.   (interactive)
  491.   (let ((msg "matlab-show-mexp-indent: "))
  492.     (setq msg (concat msg (mtlb-calc-mexp-indent)))
  493.     (message msg)))
  494.  
  495.  
  496. ;;; --- version 19 stuff ...
  497. (defvar matlab-font-lock-keywords
  498.   (list
  499.    '("\\b\\(break\\|else\\|elseif\\|end\\|for\\|if\\|return\\|while\\)\\b"
  500.      . font-lock-keyword-face)
  501.    '("\\bfunction[^=]+=[^)]+)" . font-lock-function-name-face)
  502.    )
  503.   "Expressions to hightlight in Matlab mode.")
  504.  
  505. (if (featurep 'lhilit)
  506.     (hilit-set-mode-patterns
  507.      'matlab-mode
  508.      '(("%.*$" nil comment)
  509.        ;;("'.*'" nil string)
  510.        ("\\bfunction[^=]+=[^)]+)" nil defun)
  511.        ;; key words
  512.        ("\\<\\(load\\|save\\|clear\\)\\>" nil include)
  513.        ("\\<\\(break\\|else\\|elseif\\|end\\|for\\|if\\|return\\)\\>"
  514.     nil keyword)
  515.        )))
  516.  
  517.  
  518. ;;; -- stuff which belongs elsewhere --
  519. (defun justify-comment-line ()
  520.   "Add spaces to comment line point is in, so it ends at fill-column."
  521.   (interactive)
  522.   (save-excursion
  523.    (save-restriction
  524.     (let (ncols beg)
  525.       (beginning-of-line)
  526.       (forward-char (length fill-prefix))
  527.       (skip-chars-forward " \t")
  528.       (setq beg (point))
  529.       (end-of-line)
  530.       (narrow-to-region beg (point))
  531.       (goto-char beg)
  532.       (while (re-search-forward "   *" nil t)
  533.     (delete-region
  534.      (+ (match-beginning 0)
  535.         (if (save-excursion
  536.          (skip-chars-backward " ])\"'")
  537.          (memq (preceding-char) '(?. ?? ?!)))
  538.         2 1))
  539.      (match-end 0)))
  540.       (goto-char beg)
  541.       (while (re-search-forward "[.?!][])""']*\n" nil t)
  542.     (forward-char -1)
  543.     (insert " "))
  544.       (goto-char (point-max))
  545.       (setq ncols (- fill-column (current-column)))
  546.       (if (search-backward " " nil t)
  547.       (while (> ncols 0)
  548.         (let ((nmove (+ 3 (% (random) 3))))
  549.           (while (> nmove 0)
  550.         (or (search-backward " " nil t)
  551.             (progn
  552.              (goto-char (point-max))
  553.              (search-backward " ")))
  554.         (skip-chars-backward " ")
  555.         (setq nmove (1- nmove))))
  556.         (insert " ")
  557.         (skip-chars-backward " ")
  558.         (setq ncols (1- ncols))))))))
  559.  
  560. (provide 'matlab-mode)
  561. ;; --- last line of matlab-mode.el --- 
  562.