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

📄 matlab.el

📁 Servlet,处理客户端输入,调查问卷,发送非HTML文档,获取Servlet配置参数,Cookie会话跟踪
💻 EL
📖 第 1 页 / 共 5 页
字号:
(defcustom matlab-verify-on-save-flag t  "*Non-nil means to verify M whenever we save a file."  :group 'matlab  :type 'boolean)(defcustom matlab-mode-verify-fix-functions  '(matlab-mode-vf-functionname)  "List of function symbols which perform a verification and fix to M code.Each function gets no arguments, and returns nothing.  They can movepoint, but it will be restored for them."  :group 'matlab  :type '(repeat (choice :tag "Function: "			 '(matlab-mode-vf-functionname			   matlab-mode-vf-block-matches-forward			   matlab-mode-vf-block-matches-backward			   matlab-mode-vf-quietafy-buffer			   ))))(defcustom matlab-block-verify-max-buffer-size 50000  "*Largest buffer size allowed for block verification during save."  :group 'matlab  :type 'integer)(defcustom matlab-vers-on-startup t  "*If non-nil, show the version number on startup."  :group 'matlab  :type 'boolean)(defcustom matlab-highlight-block-match-flag t  "*Non-nil means to highlight the matching if/end/whatever.The highlighting only occurs when the cursor is on a block start or endkeyword."  :group 'matlab  :type 'boolean)(defcustom matlab-show-periodic-code-details-flag nil  "*Non-nil means to show code details in the minibuffer.This will only work if `matlab-highlight-block-match-flag' is non-nil."  :group 'matlab  :type 'boolean)(defcustom matlab-mode-hook nil  "*List of functions to call on entry to MATLAB mode."  :group 'matlab  :type 'hook)(defcustom matlab-completion-technique 'complete  "*How the `matlab-complete-symbol' interfaces with the user.Valid values are:'increment - which means that new strings are tried with each             successive call until all methods are exhausted.             (Similar to `hippie-expand'.)'complete  - Which means that if there is no single completion, then             all possibilities are displayed in a completion buffer."  :group 'matlab  :type '(radio (const :tag "Incremental completion (hippie-expand)."		       increment)		(const :tag "Show completion buffer."		       complete)));; Load in the region we use for highlighting stuff.(if (and (featurep 'custom) (fboundp 'custom-declare-variable))    (let ((l-region-face (if (facep 'region) 'region 'zmacs-region)))      ;; If we have custom, we can make our own special face like this      (defface matlab-region-face	(list	 (list t	       (list :background (face-background l-region-face)		     :foreground (face-foreground l-region-face))))	"*Face used to highlight a matlab region."	:group 'matlab))  ;; If we do not, then we can fake it by copying 'region.  (cond ((facep 'region)	 (copy-face 'region 'matlab-region-face))	(t	 (copy-face 'zmacs-region 'matlab-region-face))))(defvar matlab-unterminated-string-face 'matlab-unterminated-string-face  "Self reference for unterminated string face.")(defvar matlab-simulink-keyword-face 'matlab-simulink-keyword-face  "Self reference for simulink keywords.")(defun matlab-font-lock-adjustments ()  "Make adjustments for font lock.If font lock is not loaded, lay in wait."  (if (and (featurep 'custom) (fboundp 'custom-declare-variable))	      (progn	(defface matlab-unterminated-string-face	  (list	   (list t		 (list :background (face-background font-lock-string-face)		       :foreground (face-foreground font-lock-string-face)		       :underline t)))	  "*Face used to highlight unterminated strings."	  :group 'matlab)	(defface matlab-simulink-keyword-face	  (list	   (list t		 (list :background (face-background font-lock-type-face)		       :foreground (face-foreground font-lock-type-face)		       :underline t)))	  "*Face used to highlight simulink specific functions.")	)          ;; Now, lets make the unterminated string face    (cond ((facep 'font-lock-string-face)	   (copy-face 'font-lock-string-face		      'matlab-unterminated-string-face))	  (t	   (make-face 'matlab-unterminated-string-face)))    (set-face-underline-p 'matlab-unterminated-string-face t)        ;; Now make some simulink faces    (cond ((facep 'font-lock-type-face)	   (copy-face 'font-lock-type-face 'matlab-simulink-keyword-face))	  (t	   (make-face 'matlab-simulink-keyword-face)))    (set-face-underline-p 'matlab-simulink-keyword-face t)    )  (remove-hook 'font-lock-mode-hook 'matlab-font-lock-adjustments));; Make the adjustments for font lock after it's loaded.;; I found that eval-after-load was unreliable.(if (featurep 'font-lock)    (matlab-font-lock-adjustments)  (add-hook 'font-lock-mode-hook 'matlab-font-lock-adjustments));;; MATLAB mode variables =====================================================(defvar matlab-tempo-tags nil  "List of templates used in MATLAB mode.");; syntax table(defvar matlab-mode-syntax-table  (let ((st (make-syntax-table (standard-syntax-table))))    (modify-syntax-entry ?_  "_" st)    (modify-syntax-entry ?%  "<" st)    (modify-syntax-entry ?\n ">" st)    (modify-syntax-entry ?\\ "." st)    (modify-syntax-entry ?\t " " st)    (modify-syntax-entry ?+  "." st)    (modify-syntax-entry ?-  "." st)    (modify-syntax-entry ?*  "." st)    (modify-syntax-entry ?'  "." st)    (modify-syntax-entry ?/  "." st)    (modify-syntax-entry ?=  "." st)    (modify-syntax-entry ?<  "." st)    (modify-syntax-entry ?>  "." st)    (modify-syntax-entry ?&  "." st)    (modify-syntax-entry ?|  "." st)    st)  "The syntax table used in `matlab-mode' buffers.")(defvar matlab-mode-special-syntax-table  (let ((st (copy-syntax-table matlab-mode-syntax-table)))    ;; Make _ a part of words so we can skip them better    (modify-syntax-entry ?_  "w" st)    st)  "The syntax table used when navigating blocks.");; abbrev table(defvar matlab-mode-abbrev-table nil  "The abbrev table used in `matlab-mode' buffers.")(define-abbrev-table 'matlab-mode-abbrev-table ());;; Keybindings ===============================================================(defvar matlab-help-map  (let ((km (make-sparse-keymap)))    (define-key km "r" 'matlab-shell-run-command)    (define-key km "f" 'matlab-shell-describe-command)    (define-key km "a" 'matlab-shell-apropos)    (define-key km "v" 'matlab-shell-describe-variable)    (define-key km "t" 'matlab-shell-topic-browser)    km)  "The help key map for `matlab-mode' and `matlab-shell-mode'.")(defvar matlab-insert-map  (let ((km (make-sparse-keymap)))    (define-key km "c" 'matlab-insert-next-case)    (define-key km "e" 'matlab-insert-end-block)    (define-key km "i" 'tempo-template-matlab-if)    (define-key km "I" 'tempo-template-matlab-if-else)    (define-key km "f" 'tempo-template-matlab-for)    (define-key km "s" 'tempo-template-matlab-switch)    (define-key km "t" 'tempo-template-matlab-try)    (define-key km "w" 'tempo-template-matlab-while)    (define-key km "F" 'tempo-template-matlab-function)    (define-key km "'" 'matlab-stringify-region)    ;; Not really inserts, but auto coding stuff    (define-key km "\C-s" 'matlab-ispell-strings)    (define-key km "\C-c" 'matlab-ispell-comments)    km)  "Keymap used for inserting simple texts based on context.");; mode map(defvar matlab-mode-map  (let ((km (make-sparse-keymap)))    (define-key km [return] 'matlab-return)    (define-key km "\C-c;" 'matlab-comment-region)    (define-key km "\C-c:" 'matlab-uncomment-region)    (define-key km [(control c) return] 'matlab-comment-return)    (define-key km [(control c) (control c)] matlab-insert-map)    (define-key km [(control c) (control f)] 'matlab-fill-comment-line)    (define-key km [(control c) (control j)] 'matlab-justify-line)    (define-key km [(control c) (control q)] 'matlab-fill-region)    (define-key km [(control c) (control s)] 'matlab-shell-save-and-go)    (define-key km [(control c) (control r)] 'matlab-shell-run-region)    (define-key km [(control c) (control t)] 'matlab-show-line-info)    (define-key km [(control c) ?. ] 'matlab-find-file-on-path)    (define-key km [(control h) (control m)] matlab-help-map)    (define-key km [(control j)] 'matlab-linefeed)    (define-key km "\M-\r" 'newline)    (define-key km [(meta \;)] 'matlab-comment)    (define-key km [(meta q)] 'matlab-fill-paragraph)    (define-key km [(meta a)] 'matlab-beginning-of-command)    (define-key km [(meta e)] 'matlab-end-of-command)    (define-key km [(meta j)] 'matlab-comment-line-break-function)    (define-key km [(meta s)] 'matlab-show-matlab-shell-buffer)    (define-key km "\M-\t" 'matlab-complete-symbol)    (define-key km [(meta control f)] 'matlab-forward-sexp)    (define-key km [(meta control b)] 'matlab-backward-sexp)    (define-key km [(meta control a)] 'matlab-beginning-of-defun)    (define-key km [(meta control e)] 'matlab-end-of-defun)    (if (string-match "XEmacs" emacs-version)	(define-key km [(control meta button1)] 'matlab-find-file-click)      (define-key km [(control meta mouse-2)] 'matlab-find-file-click))    (substitute-key-definition 'comment-region 'matlab-comment-region			       km) ; global-map ;torkel    km)  "The keymap used in `matlab-mode'.");;; Font locking keywords =====================================================(defvar matlab-string-start-regexp "\\(^\\|[^]})a-zA-Z0-9_.']\\)"  "Regexp used to represent the character before the string char '.The ' character has restrictions on what starts a string which is neededwhen attempting to understand the current context.");; To quote a quote, put two in a row, thus we need an anchored;; first quote.  In addition, we don't want to color strings in comments.(defvar matlab-string-end-regexp "[^'\n]*\\(''[^'\n]*\\)*'"  "Regexp used to represent the character pattern for ending a string.The ' character can be used as a transpose, and can transpose transposes.Therefore, to end, we must check all that goop.")(defun matlab-font-lock-string-match-normal (limit)  "When font locking strings, call this function for normal strings.Argument LIMIT is the maximum distance to scan."  (matlab-font-lock-string-match-here   (concat matlab-string-start-regexp	   "\\('" matlab-string-end-regexp "\\)"	   "\\([^']\\|$\\)")   limit))(defun matlab-font-lock-string-match-unterminated (limit)  "When font locking strings, call this function for normal strings.Argument LIMIT is the maximum distance to scan."  (matlab-font-lock-string-match-here   (concat matlab-string-start-regexp "\\('[^'\n]*\\(''[^'\n]*\\)*\\)$")   limit))(defun matlab-font-lock-string-match-here (regex limit)  "When font-locking strings, call this function to determine a match.Argument REGEX is the expression to scan for.  Match 2 must be the string.Argument LIMIT is the maximum distance to scan."  (let (e)    (while (and (re-search-forward regex limit t)		(progn		  ;; This gets us out of a comment after the string.		  (setq e (match-end 2))		  (goto-char (match-beginning 2))		  (prog1		      (or (matlab-cursor-in-comment)			  (if (bolp) nil			    (save-excursion			      (forward-char -1)			      (matlab-cursor-in-string))))		    (goto-char e))))      (setq e nil))    (if (not e)	nil      (goto-char e)      t)))(defun matlab-font-lock-comment-match (limit)  "When font-locking comments, call this function to determine a match.Argument LIMIT is the maximum distance to scan."  (let (e)    (while (and (re-search-forward "\\(%[^%\n]*\\)" limit t)		(progn		  (setq e (match-end 1))		  (member (get-text-property (match-beginning 0) 'face)			  '(font-lock-string-face			    matlab-unterminated-string-face))))      (setq e nil))    (if (not e)	nil      (goto-char e)      t)))(defun matlab-find-unreachable-code (limit)  "Find code that is if'd out with if(0), and mark it as a comment.The if(0) and else/end construct sould be highlighted differently.Argument LIMIT is the maximum distance to search."  (if (and (< (point) limit)	   (re-search-forward	    "\\<\\(if\\>\\s-*(?\\s-*0\\s-*)?$\\)"	    limit t))      (let ((b1 (match-beginning 1))	    (e1 (match-end 1))	    (b2 nil) (e2 nil)	    (b3 nil) (e3 nil))	(goto-char b1)	(condition-case nil	    (progn	      ;; Go forward over the matlab sexp.  Include scanning	      ;; for ELSE since parts of the ELSE block are not	      ;; `commented out'.	      (matlab-forward-sexp t)	      (forward-word -1)	      ;; Is there an ELSE in this block?	      (if (looking-at (matlab-block-mid-re))		  (progn		    (setq b3 (match-beginning 0)			  e3 (match-end 0))		    ;; Now find the REAL end.		    (matlab-forward-sexp)		    (forward-word -1)))	      ;; End of block stuff	      (if (looking-at (matlab-block-end-re))		  (progn

⌨️ 快捷键说明

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