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

📄 matlab.el

📁 Servlet,处理客户端输入,调查问卷,发送非HTML文档,获取Servlet配置参数,Cookie会话跟踪
💻 EL
📖 第 1 页 / 共 5 页
字号:
  (setq normal-auto-fill-function 'matlab-auto-fill)  (make-local-variable 'fill-prefix)  (make-local-variable 'imenu-generic-expression)  (setq imenu-generic-expression matlab-imenu-generic-expression)  ;; Save hook for verifying src.  This lets us change the name of  ;; the function in `write-file' and have the change be saved.  ;; It also lets us fix mistakes before a `save-and-go'.  (make-local-variable 'write-contents-hooks)  (add-hook 'write-contents-hooks 'matlab-mode-verify-fix-file-fn)  ;; Tempo tags  (make-local-variable 'tempo-local-tags)  (setq tempo-local-tags (append matlab-tempo-tags tempo-local-tags))  ;; give each file it's own parameter history  (make-local-variable 'matlab-shell-save-and-go-history)  (make-local-variable 'font-lock-defaults)  (setq font-lock-defaults '((matlab-font-lock-keywords			      matlab-gaudy-font-lock-keywords			      matlab-really-gaudy-font-lock-keywords			      )			     t ; do not do string/comment highlighting			     nil ; keywords are case sensitive.			     ;; This puts _ as a word constituent,			     ;; simplifying our keywords significantly			     ((?_ . "w"))))  (matlab-enable-block-highlighting 1)  (if window-system (matlab-frame-init))  (run-hooks 'matlab-mode-hook)  (if matlab-vers-on-startup (matlab-show-version)));;; Utilities =================================================================(defun matlab-show-version ()  "Show the version number in the minibuffer."  (interactive)  (message "matlab-mode, version %s" matlab-mode-version))(defun matlab-find-prev-line ()  "Recurse backwards until a code line is found."  (if (= -1 (forward-line -1)) nil    (if (or (matlab-ltype-empty)	    (matlab-ltype-comm-ignore))	(matlab-find-prev-line) t)))(defun matlab-prev-line ()  "Go to the previous line of code.  Return nil if not found."  (interactive)  (let ((old-point (point)))    (if (matlab-find-prev-line) t (goto-char old-point) nil)))(defun matlab-uniquafy-list (lst)  "Return a list that is a subset of LST where all elements are unique."  (let ((nlst nil))    (while lst      (if (and (car lst) (not (member (car lst) nlst)))	  (setq nlst (cons (car lst) nlst)))      (setq lst (cdr lst)))    (nreverse nlst))); Aki Vehtari <Aki.Vehtari@hut.fi> recommends this: (19.29 required);(require 'backquote);(defmacro matlab-navigation-syntax (&rest body);  "Evaluate BODY with the matlab-mode-special-syntax-table";  '(let	((oldsyntax (syntax-table)));    (unwind-protect;	(progn;	  (set-syntax-table matlab-mode-special-syntax-table);	   ,@body);      (set-syntax-table oldsyntax))))(defmacro matlab-navigation-syntax (&rest forms)  "Set the current environment for syntax-navigation and execute FORMS."  (list 'let '((oldsyntax (syntax-table))	       (case-fold-search nil))	 (list 'unwind-protect		(list 'progn		       '(set-syntax-table matlab-mode-special-syntax-table)			(cons 'progn forms))		'(set-syntax-table oldsyntax))))(put 'matlab-navigation-syntax 'lisp-indent-function 0)(add-hook 'edebug-setup-hook	  (lambda ()	    (def-edebug-spec matlab-navigation-syntax def-body)))(defun matlab-up-list (count &optional restrict)  "Move forwards or backwards up a list by COUNT.Optional argument RESTRICT is where to restrict the search."  ;; MATLAB syntax table has no disabling strings or comments.  (let ((dir (if (> 0 count) -1 +1))	(origin (point))	(ms nil))    ;; Make count positive    (setq count (* count dir))    (if (= dir -1)	(while (/= count 0)	  ;; Search till we find an unstrung paren object.	  (setq ms (re-search-backward "\\s(\\|\\s)" restrict t))	  (while (and (save-match-data (matlab-cursor-in-string-or-comment))		      (setq ms (re-search-backward "\\s(\\|\\s)" restrict t))))	  (if (not ms)	      (progn		(goto-char origin)		(error "Scan Error: List missmatch")))	  ;; View it's match.	  (let ((s (match-string 0)))	    (if (string-match "\\s(" s)		(setq count (1- count))	      (setq count (1+ count)))))      (error "Not implemented"))    ms))(defun matlab-valid-end-construct-p ()  "Return non-nil if the end after point terminates a block.Return nil if it is being used to dereference an array."  (let ((p (point))	(err1 t))    (condition-case nil	(save-restriction	  ;; Restrict navigation only to the current command line	  (save-excursion	    (matlab-beginning-of-command)	    (narrow-to-region (point)			      (progn ;;(matlab-end-of-command (point))				(end-of-line)				     (if (> p (point))					 (progn					   (setq err1 nil)					   (error)))				     (point))))	  (save-excursion	    ;; beginning of param list	    (matlab-up-list -1)	    ;; backup over the parens.  If that fails	    (condition-case nil		(progn		  (forward-sexp 1)		  ;; If we get here, the END is inside parens, which is not a		  ;; valid location for the END keyword.  As such it is being		  ;; used to dereference array parameters		  nil)	      ;; This error means that we have an unterminated paren	      ;; block, so this end is currently invalid.	      (error nil))))      ;; an error means the list navigation failed, which also means we are      ;; at the top-level      (error err1))));;; Regexps for MATLAB language ===============================================;; "-pre" means "partial regular expression";; "-if" and "-no-if" means "[no] Indent Function"(defconst matlab-defun-regex "^\\s-*function[ \t.[]"  "Regular expression defining the beginning of a MATLAB function.")(defconst matlab-block-beg-pre-if "function\\|for\\|while\\|if\\|switch\\|try\\|tic"  "Keywords which mark the beginning of an indented block.Includes function.")(defconst matlab-block-beg-pre-no-if "for\\|while\\|if\\|switch\\|try\\|tic"  "Keywords which mark the beginning of an indented block.Excludes function.")(defun matlab-block-beg-pre ()  "Partial regular expression to recognize MATLAB block-begin keywords."  (if matlab-indent-function      matlab-block-beg-pre-if    matlab-block-beg-pre-no-if))(defconst matlab-block-mid-pre  "elseif\\|else\\|catch"  "Partial regular expression to recognize MATLAB mid-block keywords.")(defconst matlab-block-end-pre-if  "end\\(function\\)?\\|function\\|toc"  "Partial regular expression to recognize MATLAB block-end keywords.")(defconst matlab-block-end-pre-no-if  "end\\|toc"  "Partial regular expression to recognize MATLAB block-end keywords.")(defun matlab-block-end-pre ()  "Partial regular expression to recognize MATLAB block-end keywords."  (if matlab-indent-function      matlab-block-end-pre-if    matlab-block-end-pre-no-if));; Not used.;;(defconst matlab-other-pre;;  "function\\|return";;  "Partial regular express to recognize MATLAB non-block keywords.")(defconst matlab-endless-blocks  "case\\|otherwise"  "Keywords which initialize new blocks, but don't have explicit ends.Thus, they are endless.  A new case or otherwise will end a previousendless block, and and end will end this block, plus any outside normalblocks.")(defun matlab-block-re ()  "Regular expression for keywords which begin MATLAB blocks."  (concat "\\(^\\|[;,]\\)\\s-*\\(" 	  (matlab-block-beg-pre) "\\|"  	  matlab-block-mid-pre "\\|" 	  (matlab-block-end-pre) "\\|" 	  matlab-endless-blocks "\\)\\b"))  (defun matlab-block-scan-re ()  "Expression used to scan over matching pairs of begin/ends."  (concat "\\(^\\|[;,]\\)\\s-*\\(" 	  (matlab-block-beg-pre) "\\|" 	  (matlab-block-end-pre) "\\)\\b"))(defun matlab-block-beg-re ()  "Expression used to find the beginning of a block."  (concat "\\(" (matlab-block-beg-pre) "\\)"))(defun matlab-block-mid-re ()  "Expression used to find block center parts (like else)."  (concat "\\(" matlab-block-mid-pre "\\)"))(defun matlab-block-end-re ()  "Expression used to end a block.  Usually just `end'."  (concat "\\(" (matlab-block-end-pre) "\\)"))(defun matlab-block-end-no-function-re ()  "Expression representing and end if functions are excluded."  (concat "\\<\\(" matlab-block-end-pre-no-if "\\)\\>"))(defun matlab-endless-blocks-re ()  "Expression of block starters that do not have associated ends."  (concat "\\(" matlab-endless-blocks "\\)"))(defun matlab-match-function-re ()  "Expression to match a function start line.There are no reliable numeric matches in this expression.Know that `match-end' of 0 is the end of the functin name."  ;; old function was too unstable.  ;;"\\(^function\\s-+\\)\\([^=\n]+=[ \t\n.]*\\)?\\(\\sw+\\)"  (concat "\\(^\\s-*function\\b[ \t\n.]*\\)\\(\\(\\[[^]]*\\]\\|\\sw+\\)"	  "[ \t\n.]*=[ \t\n.]*\\)?\\(\\sw+\\)"))(defconst matlab-cline-start-skip "[ \t]*%[ \t]*"  "*The regular expression for skipping comment start.");;; Lists for matlab keywords =================================================(defvar matlab-keywords-solo  '("break" "case" "else" "elseif" "end" "for" "function" "if" "tic" "toc"    "otherwise" "profile" "switch" "while")  "Keywords that appear on a line by themselves.")(defvar matlab-keywords-return  '("acos" "acosh" "acot" "acoth" "acsch" "asech" "asin" "asinh"    "atan" "atan2" "atanh" "cos" "cosh" "coth" "csc" "csch" "exp"    "log" "log10" "log2" "sec" "sech" "sin" "sinh" "tanh"    "abs" "sign" "sqrt" )  "List of MATLAB keywords that have return arguments.This list still needs lots of help.")(defvar matlab-keywords-boolean  '("all" "any" "exist" "isempty" "isequal" "ishold" "isfinite" "isglobal"    "isinf" "isletter" "islogical" "isnan" "isprime" "isreal" "isspace"    "logical")  "List of keywords that are typically used as boolean expressions.")(defvar matlab-core-properties  '("ButtonDownFcn" "Children" "Clipping" "CreateFcn" "DeleteFcn"    "BusyAction" "HandleVisibility" "HitTest" "Interruptible"    "Parent" "Selected" "SelectionHighlight" "Tag" "Type"    "UIContextMenu" "UserData" "Visible")  "List of properties belonging to all HG objects.")(defvar matlab-property-lists  '(("root" .     ("CallbackObject" "Language" "CurrentFigure" "Diary" "DiaryFile"      "Echo" "ErrorMessage" "Format" "FormatSpacing" "PointerLocation"      "PointerWindow" "Profile" "ProfileFile" "ProfileCount"      "ProfileInterval" "RecursionLimit" "ScreenDepth" "ScreenSize"      "ShowHiddenHandles" "TerminalHideGraphCommand" "TerminalOneWindow"      "TerminalDimensions" "TerminalProtocol" "TerminalShowGraphCommand"      "Units" "AutomaticFileUpdates" ))    ("axes" .     ("AmbientLightColor" "Box" "CameraPosition" "CameraPositionMode"      "CameraTarget" "CameraTargetMode" "CameraUpVector"      "CameraUpVectorMode" "CameraViewAngle" "CameraViewAngleMode" "CLim"      "CLimMode" "Color" "CurrentPoint" "ColorOrder" "DataAspectRatio"      "DataAspectRatioMode" "DrawMode" "FontAngle" "FontName" "FontSize"      "FontUnits" "FontWeight" "GridLineStyle" "Layer" "LineStyleOrder"      "LineWidth" "NextPlot" "PlotBoxAspectRatio" "PlotBoxAspectRatioMode"      "Projection" "Position" "TickLength" "TickDir" "TickDirMode" "Title"      "Units" "View" "XColor" "XDir" "XGrid" "XLabel" "XAxisLocation" "XLim"      "XLimMode" "XScale" "XTick" "XTickLabel" "XTickLabelMode" "XTickMode"      "YColor" "YDir" "YGrid" "YLabel" "YAxisLocation" "YLim" "YLimMode"      "YScale" "YTick" "YTickLabel" "YTickLabelMode" "YTickMode" "ZColor"      "ZDir" "ZGrid" "ZLabel" "ZLim" "ZLimMode" "ZScale" "ZTick"      "ZTickLabel" "ZTickLabelMode" "ZTickMode"))    ("figure" .     ("BackingStore" "CloseRequestFcn" "Color" "Colormap"      "CurrentAxes" "CurrentCharacter" "CurrentObject" "CurrentPoint"      "Dithermap" "DithermapMode" "FixedColors" "IntegerHandle"      "InvertHardcopy" "KeyPressFcn" "MenuBar" "MinColormap" "Name"      "NextPlot" "NumberTitle" "PaperUnits" "PaperOrientation"      "PaperPosition" "PaperPositionMode" "PaperSize" "PaperType"      "Pointer" "PointerShapeCData" "PointerShapeHotSpot" "Position"      "Renderer" "RendererMode" "Resize" "ResizeFcn" "SelectionType"      "ShareColors" "Units" "WindowButtonDownFcn"      "WindowButtonMotionFcn" "WindowButtonUpFcn" "WindowStyle"))    ("image" . ("CData" "CDataMapping" "EraseMode" "XData" "YData"))    ("light" . ("Position" "Color" "Style"))    ("line" .     ("Color" "EraseMode" "LineStyle" "LineWidth" "Marker"      "MarkerSize" "MarkerEdgeColor" "MarkerFaceColor" "XData" "YData"      "ZData"))    ("patch" .     ("CData" "CDataMapping" "FaceVertexCData" "EdgeColor" "EraseMode"      "FaceColor" "Faces" "LineStyle" "LineWidth" "Marker"      "MarkerEdgeColor" "MarkerFaceColor" "MarkerSize" "Vertices"      "XData" "YData" "ZData" "FaceLighting" "EdgeLighting"      "BackFaceLighting" "AmbientStrength" "DiffuseStrength"      "SpecularStrength" "SpecularExponent" "SpecularColorReflectance"      "VertexNormals" "NormalMode"))    ("surface" .     ("CData" "CDataMapping" "EdgeColor" "EraseMode" "FaceColor"      "LineStyle" "LineWidth" "Marker" "MarkerEdgeColor"      "MarkerFaceColor" "MarkerSize" "MeshStyle" "XData" "YData"      "ZData" "FaceLighting" "EdgeLighting" "BackFaceLighting"      "AmbientStrength" "DiffuseStrength" "SpecularStrength"      "SpecularExponent" "SpecularColorReflectance" "VertexNormals"      "NormalMode"))    ("text\\|title\\|xlabel\\|ylabel\\|zlabel" .     ("Color" "EraseMode" "Editing" "Extent" "FontAngle" "FontName"      "FontSize" "FontUnits" "FontWeight" "HorizontalAlignment"      "Position" "Rotation" "String" "Units" "Interpreter"      "VerticalAlignment"))    ("uicontextmenu" . ("Callback"))    ("uicontrol" .     ("BackgroundColor" "Callback" "CData" "Enable" "Extent"      "FontAngle" "FontName" "FontSize" "FontUnits" "FontWeight"      "ForegroundColor" "HorizontalAlignment" "ListboxTop" "Max" "Min"      "Position" "String" "Style" "SliderStep" "TooltipString" "Units"      "Value"))

⌨️ 快捷键说明

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