⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 matlab.el

📁 Servlet,处理客户端输入,调查问卷,发送非HTML文档,获取Servlet配置参数,Cookie会话跟踪
💻 EL
📖 第 1 页 / 共 5 页
字号:
;;; matlab.el --- major mode for MATLAB dot-m files;;;; Author: Matt Wette <mwette@alumni.caltech.edu>,;;         Eric M. Ludlam <eludlam@mathworks.com>;; Maintainer: Eric M. Ludlam <eludlam@mathworks.com>;; Created: 04 Jan 91;; Version: 2.3.2;; Keywords: MATLAB;;;; Copyright (C) 1997-2003 Eric M. Ludlam;; Copyright (C) 1991-1997 Matthew R. Wette;;;; This program is free software; you can redistribute it and/or modify;; it under the terms of the GNU General Public License as published by;; the Free Software Foundation; either version 2, or (at your option);; any later version.;;;; This program is distributed in the hope that it will be useful,;; but WITHOUT ANY WARRANTY; without even the implied warranty of;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the;; GNU General Public License for more details.;;;; You should have received a copy of the GNU General Public License;; along with GNU Emacs; see the file COPYING.  If not, write to;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.;;;;; Commentary:;;;; This major mode for GNU Emacs provides support for editing MATLAB dot-m;; files.  It automatically indents for block structures, line continuations;; (e.g., ...), and comments.;;;; Additional features include auto-fill including auto-additions of;; ellipsis for commands, and even strings.  Block/end construct;; highlighting as you edit.  Primitive code-verification and;; identification.  Templates and other code editing functions.;; Advanced symbol completion.  Code highlighting via font-lock.;; There are many navigation commands that let you move across blocks;; of code at different levels.;;;; Lastly, there is support for running MATLAB in an Emacs buffer,;; with full shell history and debugger support (when used with the db;; commands.)  The shell can be used as an online help while editing;; code, providing help on functions, variables, or running arbitrary;; blocks of code from the buffer you are editing.;;; Finding Updates:;;;; The latest stable version of matlab.el can be found on MATLAB Central:;;;; Category:;; http://www.mathworks.com/matlabcentral/fileexchange/loadCategory.do?objectId=19&objectType=Category;; This File;; http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=104&objectType=file;;;; Older versions of matlab.el can be found in as matlab.el.1.10.1;; for emacsen that do not have the latest additional utilities such;; as tempo and derived.;;; Installation:;;;; Put the this file as "matlab.el" somewhere on your load path, then;; add this to your .emacs or site-init.el file:;;;;   (autoload 'matlab-mode "matlab" "Enter MATLAB mode." t);;   (setq auto-mode-alist (cons '("\\.m\\'" . matlab-mode) auto-mode-alist));;   (autoload 'matlab-shell "matlab" "Interactive MATLAB mode." t);;;; User Level customizations (You need not use them all):;;   (setq matlab-indent-function t)	; if you want function bodies indented;;   (setq matlab-verify-on-save-flag nil) ; turn off auto-verify on save;;   (defun my-matlab-mode-hook ();;     (setq fill-column 76))		; where auto-fill should wrap;;   (add-hook 'matlab-mode-hook 'my-matlab-mode-hook);;   (defun my-matlab-shell-mode-hook ();;	'());;   (add-hook 'matlab-shell-mode-hook 'my-matlab-shell-mode-hook);;;; If you are using a version of MATLAB with the Desktop enabled,;; you may need to add this:;;;;   (setq matlab-shell-command-switches '("-nojvm"));;;; Please read the mode help for matlab-mode for additional;; configuration options.;;;; Syntax highlighting:;;   To get font-lock try adding this for older emacsen:;;     (font-lock-mode 1);;   Or for newer versions of Emacs:;;     (global-font-lock-mode t);;   To get hilit19 support try adding:;;     (matlab-mode-hilit);;;; This package requires easymenu, tempo, and derived.;; This package will optionally use custom, shell, and gud.;; This package supports language specific extensions in imenu, func-menu,;;      speedbar, font-lock, and hilit19.;;; Mailing List:;;;; A mailing list has been set up where beta versions of matlab.el are;; posted, and where comments, questions, bug reports, and answers to;; questions can be sent.;;;; To subscribe send email to "lists@mathworks.com" with a body of:;;    "subscribe matlab-emacs";; to unsubscribe, send email with the body of: "unsubscribe matlab-emacs";;; Code:(require 'easymenu)(require 'tempo)(require 'derived)(defconst matlab-mode-version "2.3"  "Current version of MATLAB mode.");; From custom web page for compatibility between versions of custom:(eval-and-compile  (condition-case ()      (require 'custom)    (error nil))  (if (and (featurep 'custom) (fboundp 'custom-declare-variable))      nil ;; We've got what we needed    ;; We have the old custom-library, hack around it!    (defmacro defgroup (&rest args)      nil)    (defmacro custom-add-option (&rest args)      nil)    (defmacro defface (&rest args) nil)    (defmacro defcustom (var value doc &rest args)      (` (defvar (, var) (, value) (, doc))))));; compatibility(if (string-match "X[Ee]macs" emacs-version)    (progn      (defalias 'matlab-make-overlay 'make-extent)      (defalias 'matlab-overlay-put 'set-extent-property)      (defalias 'matlab-delete-overlay 'delete-extent)      (defalias 'matlab-overlay-start 'extent-start)      (defalias 'matlab-overlay-end 'extent-end)      (defalias 'matlab-cancel-timer 'delete-itimer)      (defun matlab-run-with-idle-timer (secs repeat function &rest args)	(condition-case nil	    (apply 'start-itimer		   "matlab" function secs		   (if repeat secs nil) t		   t args)	  (error	   ;; If the above doesn't work, then try this old version of	   ;; start itimer.	   (start-itimer "matlab" function secs (if repeat secs nil)))))      )  (defalias 'matlab-make-overlay 'make-overlay)  (defalias 'matlab-overlay-put 'overlay-put)  (defalias 'matlab-overlay-get 'overlay-get)  (defalias 'matlab-delete-overlay 'delete-overlay)  (defalias 'matlab-overlay-start 'overlay-start)  (defalias 'matlab-overlay-end 'overlay-end)  (defalias 'matlab-previous-overlay-change 'previous-overlay-change)  (defalias 'matlab-overlays-at 'overlays-at)  (defalias 'matlab-cancel-timer 'cancel-timer)  (defalias 'matlab-run-with-idle-timer 'run-with-idle-timer)  )(cond ((fboundp 'point-at-bol)       (defalias 'matlab-point-at-bol 'point-at-bol)       (defalias 'matlab-point-at-eol 'point-at-eol))      ;; Emacs 20.4      ((fboundp 'line-beginning-position)       (defalias 'matlab-point-at-bol 'line-beginning-position)       (defalias 'matlab-point-at-eol 'line-end-position))      (t       (defmacro matlab-point-at-bol ()	 (save-excursion (beginning-of-line) (point)))       (defmacro matlab-point-at-eol ()	 (save-excursion (end-of-line) (point)))))(defmacro matlab-run-in-matlab-mode-only (&rest body)  "Execute BODY only if the active buffer is a MATLABM-file buffer."  `(if (eq major-mode 'matlab-mode)       (progn	,@body)     (error "This command works only in a MATLAB M-file buffer.")))(defun matlab-with-emacs-link ()  "Return non-nil if Emacs Link is running."  (and (featurep 'matlab-eei)       matlab-eei-process));;; User-changeable variables =================================================;; Variables which the user can change(defgroup matlab nil  "MATLAB mode."  :prefix "matlab-"  :group 'languages)(defcustom matlab-indent-level 2  "*The basic indentation amount in `matlab-mode'."  :group 'matlab  :type 'integer)(defcustom matlab-cont-level 4  "*Basic indentation after continuation if no other methods are found."  :group 'matlab  :type 'integer)(defcustom matlab-cont-requires-ellipsis t  "*Specify if ellipses are required at the end of a line for continuation.Future versions of Matlab may not require ellipses ... , so a heuristic determining ifthere is to be continuation is used instead."  :group 'matlab  :type 'integer)(defcustom matlab-case-level '(1 . 1)  "*How far to indent case/otherwise statements in a switch.This can be an integer, which is the distance to indent the CASE andOTHERWISE commands, and how far to indent commands appearing in CASEand OTHERWISE blocks.  It can also be a cons cell which is of form  (CASEINDENT . COMMANDINDENT)where CASEINDENT is the indentation of the CASE and OTHERWISEstatements, and COMMANDINDENT is the indentation of commands appearingafter the CASE or OTHERWISE command."  :group 'matlab  :type 'sexp)(defcustom matlab-indent-function nil  "*If non-nil, indent body of function."  :group 'matlab  :type 'boolean)(defcustom matlab-indent-past-arg1-functions  "[sg]et\\(_param\\)?\\|waitfor"  "*Regex describing functions whose first arg is special.This specialness means that all following parameters which appear oncontinued lines should appear indented to line up with the secondargument, not the first argument."  :group 'matlab  :type 'string)(defcustom matlab-arg1-max-indent-length 15  "*The maximum length to indent when indenting past arg1.If arg1 is exceptionally long, then only this number of characterswill be indented beyond the open paren starting the parameter list.")(defcustom matlab-maximum-indents '(;; = is a convenience. Don't go too far				    (?= . (10 . 4))				    ;; Fns should provide hard limits				    (?\( . 50)				    ;; Matrix/Cell arrays				    (?\[ . 20)				    (?\{ . 20))  "Alist of maximum indentations when lining up code.Each element is of the form (CHAR . INDENT) where char is a characterthe indent engine is using, and INDENT is the maximum indentationallowed.  Indent could be of the form (MAXIMUM . INDENT), whereMAXIMUM is the maximum allowed calculated indent, and INDENT is theamount to use if MAXIMUM is reached."  :group 'matlab  :type '(repeat (cons (character :tag "Open List Character")		       (sexp :tag "Number (max) or cons (max indent)"))))(defcustom matlab-handle-simulink t  "*If true, add in a few simulink customizations.This variable's state is mostly useful when set at load time whensimulink font lock keywords can be removed.  This will handleadditional cases as the need arrises."  :group 'matlab  :type 'boolean)(defcustom matlab-auto-fill t  "*If true, set variable `auto-fill-function' to our function at startup."  :group 'matlab  :type 'boolean)(defcustom matlab-fill-fudge 10  "Number of characters around `fill-column' we can fudge filling.Basically, there are places that are very convenient to fill at, butmight not be the closest fill spot, or occur after `fill-column'.If they occur within this fudge factor, we will use them.Also, if none of the above occur, and we find a symbol to break at,but an open paren (group) starts or ends within this fudge factor,move there to boost the amount of fill leverage we can get."  :group 'matlab  :type 'integer)(defcustom matlab-fill-fudge-hard-maximum 79  "The longest line allowed when auto-filling code.This overcomes situations where the `fill-column' plus the`matlab-fill-fudge' is greater than some hard desired limit."  :group 'matlab  :type 'integer)(defcustom matlab-elipsis-string "..."  "Text used to perform continuation on code lines.This is used to generate and identify continuation lines.")(defcustom matlab-fill-code t  "*If true, `auto-fill-mode' causes code lines to be automatically continued."  :group 'matlab  :type 'boolean)(defcustom matlab-fill-count-ellipsis-flag t  "*Non-nil means to count the ellipsis when auto filling.This effectively shortens the `fill-column' by the length of`matlab-elipsis-string'.")(defcustom matlab-fill-strings-flag t  "*Non-nil means that when auto-fill is on, strings are broken across lines.If `matlab-fill-count-ellipsis-flag' is non nil, this shortens the`fill-column' by the length of `matlab-elipsis-string'.")(defcustom matlab-comment-column 40  "*The goal comment column in `matlab-mode' buffers."  :group 'matlab  :type 'integer)(defcustom matlab-comment-anti-indent 0  "*Amount of anti-indentation to use for comments in relation to code."  :group 'matlab  :type 'integer)(defcustom matlab-comment-line-s "% "  "*String to start comment on line by itself."  :group 'matlab  :type 'string)(defcustom matlab-comment-on-line-s "% "  "*String to start comment on line with code."  :group 'matlab  :type 'string)(defcustom matlab-comment-region-s "% $$$ "  "*String inserted by \\[matlab-comment-region] at start of each line in \region."  :group 'matlab  :type 'string)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -