├── templates ├── Project.ede ├── Makefile └── srecode-matlab.srt ├── toolbox ├── opentoline.m └── emacsinit.m ├── Project.ede ├── cedet-matlab.el ├── Makefile ├── README ├── INSTALL ├── company-matlab-shell.el ├── dl_emacs_support.m ├── matlab-load.el ├── matlab-publish.el ├── tlc.el ├── ChangeLog ├── semanticdb-matlab.el ├── semantic-matlab.el ├── ChangeLog.old2 ├── mlint.el └── ChangeLog.old1 /templates/Project.ede: -------------------------------------------------------------------------------- 1 | ;; Object Templates 2 | ;; EDE project file. 3 | (ede-proj-project "Templates" 4 | :name "Templates" 5 | :file "Project.ede" 6 | :targets (list 7 | (ede-proj-target-makefile-miscelaneous "templates" 8 | :name "templates" 9 | :path "" 10 | :source '("srecode-matlab.srt") 11 | ) 12 | ) 13 | ) 14 | -------------------------------------------------------------------------------- /templates/Makefile: -------------------------------------------------------------------------------- 1 | # Automatically Generated Makefile by EDE. 2 | # For use with: make 3 | # 4 | # DO NOT MODIFY THIS FILE OR YOUR CHANGES MAY BE LOST. 5 | # EDE is the Emacs Development Environment. 6 | # http://cedet.sourceforge.net/ede.shtml 7 | # 8 | 9 | top=../ 10 | ede_FILES=Project.ede Makefile 11 | 12 | templates_MISC=srecode-matlab.srt 13 | VERSION=3.3.0 14 | DISTDIR=$(top)matlab-emacs-$(VERSION)/templates 15 | 16 | 17 | 18 | all: templates 19 | 20 | templates: 21 | @ 22 | 23 | tags: 24 | 25 | .PHONY: dist 26 | 27 | dist: 28 | mkdir $(DISTDIR) 29 | cp $(templates_MISC) $(ede_FILES) $(DISTDIR) 30 | 31 | Makefile: Project.ede 32 | @echo Makefile is out of date! It needs to be regenerated by EDE. 33 | @echo If you have not modified Project.ede, you can use 'touch' to update the Makefile time stamp. 34 | @false 35 | 36 | 37 | 38 | # End of Makefile 39 | -------------------------------------------------------------------------------- /toolbox/opentoline.m: -------------------------------------------------------------------------------- 1 | function opentoline(file, line, column) 2 | %OPENTOLINE Open to specified line in function file in Emacs. 3 | % This is a hack to override the built-in opentoline program in MATLAB. 4 | % 5 | % Remove this M file from your path to get the old behavior. 6 | 7 | editor = system_dependent('getpref', 'EditorOtherEditor'); 8 | editor = editor(2:end); 9 | 10 | if nargin==3 11 | linecol = sprintf('+%d:%d',line,column); 12 | else 13 | linecol = sprintf('+%d',line); 14 | end 15 | 16 | if ispc 17 | % On Windows, we need to wrap the editor command in double quotes 18 | % in case it contains spaces 19 | system(['"' editor '" "' linecol '" "' file '"&']); 20 | else 21 | % On UNIX, we don't want to use quotes in case the user's editor 22 | % command contains arguments (like "xterm -e vi") 23 | system([editor ' "' linecol '" "' file '" &']); 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /toolbox/emacsinit.m: -------------------------------------------------------------------------------- 1 | function emacsinit(clientcommand) 2 | % EMACSINIT Initialize the current MATLAB session for matlab-shell-mode 3 | 4 | if usejava('jvm') 5 | % Disable built-in editor showing up for debugging 6 | com.mathworks.services.Prefs.setBooleanPref('EditorGraphicalDebugging', false); 7 | % Disable the built-in editor for normal editing 8 | com.mathworks.services.Prefs.setBooleanPref('EditorBuiltinEditor', false); 9 | % Use emacsclient no-wait to send edit requests to a 10 | % running emacs. 11 | if nargin == 0 12 | clientcommand = 'emacsclient -n'; 13 | end 14 | com.mathworks.services.Prefs.setStringPref('EditorOtherEditor', clientcommand); 15 | end 16 | 17 | % Use the desktop hotlinking system in MATLAB Shell. matlab-shell 18 | % will interpret them, and provide clickable areas. 19 | % NOTE: This doesn't work in all cases where HotLinks are used. 20 | feature('HotLinks','on'); 21 | end -------------------------------------------------------------------------------- /Project.ede: -------------------------------------------------------------------------------- 1 | ;; Object ede-proj-project 2 | ;; EDE project file. 3 | (ede-proj-project "ede-proj-project" 4 | :name "matlab-emacs" 5 | :version "3.3.0" 6 | :file "Project.ede" 7 | :targets (list 8 | (ede-proj-target-elisp-autoloads "autoloads" 9 | :name "autoloads" 10 | :path "" 11 | :autoload-file "matlab-load.el" 12 | ) 13 | (ede-proj-target-makefile-miscelaneous "misc" 14 | :name "misc" 15 | :path "" 16 | :source '("ChangeLog" "ChangeLog.old1" "ChangeLog.old2" "INSTALL" "README" "dl_emacs_support.m") 17 | ) 18 | (ede-proj-target-elisp "lisp" 19 | :name "lisp" 20 | :path "" 21 | :source '("matlab.el" "mlint.el" "tlc.el" "matlab-publish.el") 22 | :versionsource '("matlab.el") 23 | :aux-packages '("eieio") 24 | ) 25 | (ede-proj-target-elisp "cedet" 26 | :name "cedet" 27 | :path "" 28 | :source '("semantic-matlab.el" "semanticdb-matlab.el" "cedet-matlab.el" "company-matlab-shell.el") 29 | :aux-packages '("semantic" "semantic-el") 30 | ) 31 | ) 32 | ) 33 | -------------------------------------------------------------------------------- /cedet-matlab.el: -------------------------------------------------------------------------------- 1 | ;;; cedet-matlab.el --- CEDET Setup support 2 | ;; 3 | ;; Copyright (C) 2009 Eric Ludlam 4 | ;; 5 | ;; Author: Eric Ludlam 6 | ;; X-RCS: $Id: cedet-matlab.el,v 1.1 2009/07/06 19:48:15 zappo Exp $ 7 | ;; 8 | ;; This program is free software; you can redistribute it and/or 9 | ;; modify it under the terms of the GNU General Public License as 10 | ;; published by the Free Software Foundation; either version 2, or (at 11 | ;; your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, but 14 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ;; General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program; see the file COPYING. If not, write to 20 | ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 | ;; Boston, MA 02110-1301, USA. 22 | 23 | ;;; Commentary: 24 | ;; 25 | ;; Setup miscelaneous CEDET tools to work with MATLAB. 26 | 27 | ;;; Code: 28 | ;;;###autoload 29 | (defun matlab-cedet-setup () 30 | "Update various paths to get SRecode to identify our macros." 31 | (interactive) 32 | 33 | ;; Setup Semantic parser: 34 | (add-hook 'matlab-mode-hook 'semantic-default-matlab-setup) 35 | 36 | ;; Setup semanticdb for MATLAB support: 37 | (require 'semanticdb-matlab) 38 | 39 | ;; Setup Semantic Recoder (Template support for MATLAB and TLC.): 40 | (let* ((lib (locate-library "matlab.el" t)) 41 | (ededir (file-name-directory lib)) 42 | (tmpdir (file-name-as-directory 43 | (expand-file-name "templates" ededir)))) 44 | (when (not tmpdir) 45 | (error "Unable to locate MATLAB Templates directory")) 46 | 47 | ;; Rig up the map. 48 | (require 'srecode-map) 49 | (add-to-list 'srecode-map-load-path tmpdir) 50 | (srecode-map-update-map t) 51 | ) 52 | 53 | 54 | ) 55 | 56 | 57 | (provide 'cedet-matlab) 58 | ;;; cedet-matlab.el ends here 59 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Automatically Generated Makefile by EDE. 2 | # For use with: make 3 | # 4 | # DO NOT MODIFY THIS FILE OR YOUR CHANGES MAY BE LOST. 5 | # EDE is the Emacs Development Environment. 6 | # http://cedet.sourceforge.net/ede.shtml 7 | # 8 | 9 | top= 10 | ede_FILES=Project.ede Makefile 11 | 12 | EMACS=emacs 13 | LOADPATH= ../cedet/common/ ../cedet/eieio/\ 14 | ../cedet/semantic/bovine/ ../cedet/semantic/ 15 | LOADDEFS=matlab-load.el 16 | LOADDIRS=. 17 | misc_MISC=ChangeLog ChangeLog.old1 ChangeLog.old2 INSTALL README dl_emacs_support.m 18 | lisp_LISP=matlab.el mlint.el tlc.el matlab-publish.el 19 | EMACS=emacs 20 | EMACSFLAGS=-batch --no-site-file 21 | cedet_LISP=semantic-matlab.el semanticdb-matlab.el cedet-matlab.el company-matlab-shell.el 22 | VERSION=3.3.0 23 | DISTDIR=$(top)matlab-emacs-$(VERSION) 24 | 25 | 26 | 27 | all: autoloads misc lisp cedet Templates 28 | 29 | .PHONY: autoloads 30 | autoloads: 31 | @echo "(add-to-list 'load-path nil)" > $@-compile-script 32 | for loadpath in . ${LOADPATH}; do \ 33 | echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ 34 | done; 35 | @echo "(require 'cedet-autogen)" >> $@-compile-script 36 | "$(EMACS)" -batch --no-site-file -l $@-compile-script -f cedet-batch-update-autoloads $(LOADDEFS) $(LOADDIRS) 37 | 38 | misc: 39 | @ 40 | 41 | .PHONY: lisp 42 | lisp: $(lisp_LISP) 43 | @echo "(add-to-list 'load-path nil)" > $@-compile-script 44 | for loadpath in . ${LOADPATH}; do \ 45 | echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ 46 | done; 47 | @echo "(setq debug-on-error t)" >> $@-compile-script 48 | "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ 49 | 50 | .PHONY: cedet 51 | cedet: $(cedet_LISP) 52 | @echo "(add-to-list 'load-path nil)" > $@-compile-script 53 | for loadpath in . ${LOADPATH}; do \ 54 | echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ 55 | done; 56 | @echo "(setq debug-on-error t)" >> $@-compile-script 57 | "$(EMACS)" $(EMACSFLAGS) -l $@-compile-script -f batch-byte-compile $^ 58 | 59 | .PHONY:Templates 60 | Templates: 61 | $(MAKE) -C templates 62 | 63 | tags: 64 | $(MAKE) -C templates/ $(MFLAGS) $@ 65 | 66 | 67 | clean: 68 | rm -f *.elc 69 | 70 | .PHONY: dist 71 | 72 | dist: autoloads 73 | rm -rf $(DISTDIR) 74 | mkdir $(DISTDIR) 75 | cp matlab-load.el $(misc_MISC) $(lisp_LISP) $(cedet_LISP) $(ede_FILES) $(DISTDIR) 76 | $(MAKE) -C templates $(MFLAGS) DISTDIR=$(DISTDIR)/templates dist 77 | tar -cvzf $(DISTDIR).tar.gz $(DISTDIR) 78 | rm -rf $(DISTDIR) 79 | 80 | Makefile: Project.ede 81 | @echo Makefile is out of date! It needs to be regenerated by EDE. 82 | @echo If you have not modified Project.ede, you can use 'touch' to update the Makefile time stamp. 83 | @false 84 | 85 | 86 | 87 | # End of Makefile 88 | -------------------------------------------------------------------------------- /templates/srecode-matlab.srt: -------------------------------------------------------------------------------- 1 | ;; srecode-matlab.srt --- SREcode Templates for MATLAB. 2 | 3 | ;; Copyright (C) 2008 Eric Ludlam 4 | 5 | ;; Author: Eric Ludlam 6 | ;; X-RCS: $Id: srecode-matlab.srt,v 1.1 2009/07/06 19:51:41 zappo Exp $ 7 | 8 | ;; This program is free software; you can redistribute it and/or 9 | ;; modify it under the terms of the GNU General Public License as 10 | ;; published by the Free Software Foundation; either version 2, or (at 11 | ;; your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, but 14 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | ;; General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program; see the file COPYING. If not, write to 20 | ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 | ;; Boston, MA 02110-1301, USA. 22 | 23 | 24 | set mode "matlab-mode" 25 | set escape_start "{{" 26 | set escape_end "}}" 27 | 28 | context file 29 | 30 | set comment_start "%" 31 | set comment_prefix "%" 32 | set comment_end "" 33 | 34 | ;; @todo - add argument support. 35 | ;; choose template based on script/function or class in current dir. 36 | template empty :file :user :time 37 | "Fill out an empty file." 38 | ---- 39 | function {{FILE}} 40 | % {{FILE:upcase}} - 41 | 42 | {{comment_prefix}} Copyright (C) {{YEAR}} {{?AUTHOR}} 43 | 44 | {{^}} 45 | 46 | end 47 | ---- 48 | bind "e" 49 | 50 | 51 | context declaration 52 | 53 | 54 | prompt NAME "Name for declaration: " 55 | 56 | template classdef :time 57 | "Template to declare a class" 58 | ---- 59 | classdef {{?NAME}} 60 | % Class {{NAME}} 61 | % 62 | % Copyright (C) {{YEAR}} {{?AUTHOR}} 63 | 64 | properties 65 | 66 | end 67 | 68 | methods 69 | function h = {{NAME}}(varargin) 70 | {{^}} 71 | end 72 | end 73 | end 74 | ---- 75 | bind "c" 76 | 77 | template function :blank :indent 78 | "Template to declare a function." 79 | ---- 80 | function {{?NAME}} 81 | {{^}} 82 | end 83 | ---- 84 | bind "f" 85 | 86 | template variable :blank :indent 87 | "Template to declare a variable." 88 | ---- 89 | global {{?NAME}} 90 | ---- 91 | bind "v" 92 | 93 | context code 94 | 95 | template function :blank :indent 96 | "Nested functions are indented." 97 | ---- 98 | function {{?NAME}} 99 | {{^}} 100 | end 101 | ---- 102 | bind "f" 103 | 104 | template variable :blank :indent 105 | "Template to declare a variable." 106 | ---- 107 | persistent {{?NAME}} 108 | ---- 109 | bind "v" 110 | 111 | 112 | ;; end -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | matlab-emacs Project: 2 | 3 | MATLAB and Emacs integration 4 | 5 | * INSTALL 6 | 7 | Add the following to your .emacs file: 8 | 9 | ;; Replace path below to be where your matlab.el file is. 10 | (add-to-list 'load-path "~/path/to/matlab-emacs") 11 | (load-library "matlab-load") 12 | 13 | ;; Enable CEDET feature support for MATLAB code. (Optional) 14 | ;; (matlab-cedet-setup) 15 | 16 | 17 | * Finding Updates 18 | 19 | ** Releases 20 | 21 | The most recent version of matlab.el is always in CVS. 22 | 23 | The last stabilized version of matlab.el can be found on MATLAB Central: 24 | 25 | Category: 26 | http://www.mathworks.com/matlabcentral/fileexchange/loadCategory.do?objectId=19&objectType=Category 27 | This File 28 | http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=104&objectType=file 29 | 30 | Older versions of matlab.el can be found as matlab.el.1.10.1 31 | for emacsen that do not have the latest additional utilities such 32 | as tempo and derived. 33 | 34 | matlab.el and mlint.el has shipped on MATLAB CDs starting with 6.5 35 | (R13). Updates after a release of MATLAB will be made to MATLAB 36 | Central and announced on the mailing list. 37 | 38 | matlab.el and mlint.el will no longer ship on MATLAB CDs starting 39 | with MATLAB release R2008b. If you are using a version of MATLAB 40 | from before R2008a, you will want to use the version of mlint from 41 | that CD. 42 | 43 | ** CVS 44 | 45 | matlab-emacs is available via CVS from SourceForge. 46 | 47 | Homepage: 48 | http://matlab-emacs.sf.net 49 | 50 | Project Page: 51 | http://sourceforge.net/projects/matlab-emacs 52 | 53 | CVS Repository: 54 | http://sourceforge.net/cvs/?group_id=154105 55 | 56 | If you do not have a CVS client on your machine, you can use the 57 | MATLAB script dl_emacs_support.m to download a fresh copy of the 58 | matlab.el sources. 59 | 60 | ** Dependancies 61 | 62 | MATLAB-Emacs can now use the CEDET suite for the following items: 63 | - Modifying the build system (Makefiles, etc) 64 | - mlint (uses EIEIO object system) 65 | - parsing/completion (uses semantic parsing system) 66 | - some template insertion features 67 | 68 | See http://cedet.sf.net for downloading CEDET. 69 | 70 | If you only want to use matlab.el for editing code or running the 71 | MATLAB shell, you DO NOT need to install CEDET. 72 | 73 | If you do want to use CEDET, add the following to your .emacs file: 74 | 75 | (matlab-cedet-setup) 76 | 77 | * Mailing List: 78 | 79 | ** New Mailing List 80 | 81 | A new matlab-emacs-discuss mailing lisit has been created at 82 | SourceForge. Use this list to get updates on new releases and 83 | discuss topics relivant to the matlab-emacs project. 84 | 85 | http://lists.sourceforge.net/mailman/listinfo/matlab-emacs-discuss 86 | 87 | ** Old Mailing List 88 | 89 | The original mailing list where beta versions of matlab.el were 90 | posted, and where comments, questions, bug reports, and answers to 91 | questions could be sent. If you were subscribed to this list, 92 | please unsubscribe, and subscribe to the new list above. 93 | 94 | to unsubscribe, send email with the body of: "unsubscribe matlab-emacs" 95 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Installation: 2 | 3 | ** DEPENDANCIES 4 | 5 | This matlab-emacs build system now requires the CEDET suite. 6 | 7 | http://cedet.sf.net 8 | 9 | The build system uses EDE for project management, Makefile creation, 10 | and autoload generation. 11 | 12 | To build if CEDET is installed in ../cedet: 13 | 14 | make 15 | 16 | To build if CEDET is installed in some other location: 17 | 18 | make "LOADPATH=../cedet-VER/common ../cedet-VER/eieio ../cedet-VER/semantic/bovine/ ../cedet-VER/semantic/" 19 | 20 | where ../cedet-VER is a full or relative path to the CEDET suite. If 21 | you get CEDET from CVS, then it is likey just "../cedet", if you use 22 | CEDET from a release, then it may be "../cedet-1.0pre6", or similar. 23 | 24 | This tool requires CEDET 1.0pre3 or later. 25 | 26 | If you have CEDET installed in "../cedet" then you do not need to 27 | specify a LOADPATH on the make command line. 28 | 29 | It is possible to use matlab.el, and associated programs without this 30 | extra package. To do so, install and compile only those lisp files 31 | you need. 32 | 33 | ** FULL INSTALL 34 | 35 | To install all the Emacs tools for MATLAB, add this to your .emacs file: 36 | 37 | (add-to-list 'load-path "~/path/to/matlab_el") 38 | (require 'matlab-load) 39 | 40 | ** matlab.el: 41 | 42 | If you want to only use matlab.el for editing your code, and do not 43 | want to try the other tools, you can do that also, though the install 44 | code you need is more complex: 45 | 46 | 47 | Put the this file as "matlab.el" somewhere on your load path, then 48 | add this to your .emacs or site-init.el file: 49 | 50 | (autoload 'matlab-mode "matlab" "Enter MATLAB mode." t) 51 | (setq auto-mode-alist (cons '("\\.m\\'" . matlab-mode) auto-mode-alist)) 52 | (autoload 'matlab-shell "matlab" "Interactive MATLAB mode." t) 53 | 54 | User Level customizations (You need not use them all): 55 | (setq matlab-indent-function-body t) ; if you want function bodies indented 56 | (setq matlab-verify-on-save-flag nil) ; turn off auto-verify on save 57 | (defun my-matlab-mode-hook () 58 | (setq fill-column 76)) ; where auto-fill should wrap 59 | (add-hook 'matlab-mode-hook 'my-matlab-mode-hook) 60 | (defun my-matlab-shell-mode-hook () 61 | '()) 62 | (add-hook 'matlab-shell-mode-hook 'my-matlab-shell-mode-hook) 63 | 64 | Please read the mode help for matlab-mode for additional 65 | configuration options. 66 | 67 | Syntax highlighting: 68 | To get font-lock try adding this for older emacsen: 69 | (font-lock-mode 1) 70 | Or for newer versions of Emacs: 71 | (global-font-lock-mode t) 72 | To get hilit19 support try adding: 73 | (matlab-mode-hilit) 74 | 75 | This package requires easymenu, tempo, and derived. 76 | This package will optionally use custom, shell, and gud. 77 | This package supports language specific extensions in imenu, func-menu, 78 | speedbar, font-lock, and hilit19. 79 | 80 | ** tlc.el 81 | 82 | To use this mode without using the full instatll, put the this file 83 | into your load path, and add the following to your .emacs file: 84 | 85 | (require 'tlc) 86 | or 87 | (autoload 'tlc-mode "tlc" "tlc Editing Mode" t) 88 | (add-to-list 'auto-mode-alist '("\\.tlc$" . tlc-mode)) 89 | (setq tlc-indent-function t) 90 | 91 | 92 | ** semantic-matlab.el, semanticdb-matlab.el 93 | 94 | 95 | Note that this feature requires CEDET 1.0pre4 or newer. 96 | -------------------------------------------------------------------------------- /company-matlab-shell.el: -------------------------------------------------------------------------------- 1 | ;;; company-matlab-shell.el --- a matlab-shell-mode completion back-end for AUCTeX 2 | ;; 3 | ;; Copyright (C) 2009 David Engster 4 | ;; 5 | ;; This program is free software; you can redistribute it and/or 6 | ;; modify it under the terms of the GNU General Public License 7 | ;; as published by the Free Software Foundation; either version 2 8 | ;; of the License, or (at your option) any later version. 9 | ;; 10 | ;; This program is distributed in the hope that it will be useful, 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ;; GNU General Public License for more details. 14 | ;; 15 | ;; You should have received a copy of the GNU General Public License 16 | ;; along with this program. If not, see . 17 | 18 | (condition-case nil 19 | (require 'company) 20 | (error nil)) 21 | (eval-when-compile (require 'cl)) 22 | (require 'matlab) 23 | 24 | ;; the following code is mostly taken from matlab.el, (C) Eric M. Ludlam 25 | (defun company-matlab-shell-tab () 26 | "Send [TAB] to the currently running matlab process and retrieve completion." 27 | (goto-char (point-max)) 28 | (let ((inhibit-field-text-motion t)) 29 | (beginning-of-line)) 30 | (re-search-forward comint-prompt-regexp) 31 | (let* ((lastcmd (buffer-substring (point) (matlab-point-at-eol))) 32 | (tempcmd lastcmd) 33 | (completions nil) 34 | (limitpos nil)) 35 | ;; search for character which limits completion, and limit command to it 36 | (setq limitpos 37 | (if (string-match ".*\\([( /[,;=']\\)" lastcmd) 38 | (1+ (match-beginning 1)) 39 | 0)) 40 | (setq lastcmd (substring lastcmd limitpos)) 41 | ;; Whack the old command so we can insert it back later. 42 | (delete-region (+ (point) limitpos) (matlab-point-at-eol)) 43 | ;; double every single quote 44 | (while (string-match "[^']\\('\\)\\($\\|[^']\\)" tempcmd) 45 | (setq tempcmd (replace-match "''" t t tempcmd 1))) 46 | ;; collect the list 47 | (setq completions (matlab-shell-completion-list tempcmd)) 48 | (goto-char (point-max)) 49 | (insert lastcmd) 50 | completions)) 51 | 52 | (defun company-matlab-shell-grab-symbol () 53 | (when (string= (buffer-name (current-buffer)) (concat "*" matlab-shell-buffer-name "*")) 54 | (save-excursion 55 | (goto-char (point-max)) 56 | (let ((inhibit-field-text-motion t)) 57 | (beginning-of-line)) 58 | (re-search-forward comint-prompt-regexp) 59 | (let* ((lastcmd (buffer-substring (point) (matlab-point-at-eol))) 60 | limitpos) 61 | (setq limitpos 62 | (if (string-match ".*\\([( /[,;=']\\)" lastcmd) 63 | (1+ (match-beginning 1)) 64 | 0)) 65 | (substring-no-properties lastcmd limitpos))))) 66 | 67 | 68 | (defun company-matlab-shell-get-completions () 69 | (when (string= (buffer-name (current-buffer)) (concat "*" matlab-shell-buffer-name "*")) 70 | (mapcar 'car (company-matlab-shell-tab)))) 71 | 72 | ;;;###autoload 73 | (defun company-matlab-shell (command &optional arg &rest ignored) 74 | "A `company-mode' completion back-end for Matlab-Shell." 75 | (interactive (list 'interactive)) 76 | (case command 77 | ('interactive (company-begin-backend 'company-matlab-shell)) 78 | ('prefix (company-matlab-shell-grab-symbol)) 79 | ('candidates (company-matlab-shell-get-completions)) 80 | ('sorted t))) 81 | 82 | (provide 'company-matlab-shell) 83 | ;;; company-matlab-shell.el ends here 84 | -------------------------------------------------------------------------------- /dl_emacs_support.m: -------------------------------------------------------------------------------- 1 | function dl_emacs_support(varargin) 2 | % Download MATLAB support files for Emacs 3 | % 4 | % DL_EMACS_SUPPRT - download all Emacs support files into the 5 | % current directory. 6 | % 7 | % DL_EMACS_SUPPORT(FILESET) - download a FILESET of Emacs support. 8 | % Sets are: 9 | % core - Just the core MATLAB support files. 10 | % tlc - Just the core MATLAB/TLC support files. 11 | % cedet - Core, plus additional support for MATLAB using CEDET support. 12 | % Learn more about CEDET at: http://cedet.sf.net 13 | % support - Just the build files and READMEs for compiling. 14 | % all - All files 15 | % 16 | % DL_EMACS_SUPPORT(FILESET,DEST) - download FILESET and save in 17 | % destination directory DEST 18 | 19 | po = inputParser; 20 | 21 | addOptional(po, 'fileset', 'all', @ischar) 22 | addOptional(po, 'destination', pwd, @ischar) 23 | 24 | po.parse(varargin{:}); 25 | 26 | stuff = po.Results; 27 | 28 | if exist(stuff.destination,'dir') ~= 7 29 | error(['The folder: ''',stuff.destination, ''', does not exist.']); 30 | end 31 | 32 | coreFiles = { 'matlab-load.el' 'matlab.el' 'mlint.el' ... 33 | 'matlab-publish.el' 'company-matlab-shell.el' ... 34 | 'toolbox/emacsinit.m' 'toolbox/opentoline.m' }; 35 | tlcFiles = { 'tlc.el' }; 36 | cedetFiles = { 'cedet-matlab.el' 'semantic-matlab.el' ... 37 | 'semanticdb-matlab.el' 'templates/srecode-matlab.srt' }; 38 | supportFiles = { 'dl_emacs_support.m' 'README' 'Makefile' ... 39 | 'Project.ede' 'INSTALL' 'ChangeLog' ... 40 | 'templates/Project.ede' 'templates/Makefile'}; 41 | 42 | switch stuff.fileset 43 | case 'core' 44 | mktoolboxdir 45 | getfiles(coreFiles); 46 | case 'tlc' 47 | mktoolboxdir 48 | getfiles(coreFiles); 49 | getfiles(tlcFiles); 50 | case 'cedet' 51 | mktoolboxdir 52 | getfiles(coreFiles); 53 | mktemplatedir; 54 | getfiles(cedetFiles); 55 | case 'support' 56 | mktemplatedir; 57 | getfiles(supportFiles); 58 | case 'all' 59 | mktoolboxdir 60 | getfiles(coreFiles); 61 | getfiles(tlcFiles); 62 | mktemplatedir; 63 | getfiles(cedetFiles); 64 | getfiles(supportFiles); 65 | otherwise 66 | error('Unknown fileset %s.', stuff.fileset); 67 | end 68 | 69 | function mktemplatedir 70 | templateDir = fullfile(stuff.destination,'templates'); 71 | if ~exist(templateDir,'dir') 72 | mkdir(templateDir); 73 | end 74 | end 75 | 76 | function mktoolboxdir 77 | toolboxDir = fullfile(stuff.destination,'toolbox'); 78 | if ~exist(toolboxDir,'dir') 79 | mkdir(toolboxDir); 80 | end 81 | end 82 | 83 | function getfiles(fList) 84 | for i = 1:length(fList) 85 | file = fList{i}; 86 | destFullFile = fullfile(stuff.destination,file); 87 | [ contents status ] = ... 88 | urlread(['http://matlab-emacs.cvs.sourceforge.net/viewvc/*checkout*/matlab-emacs/matlab-emacs/',... 89 | file,'?revision=HEAD']); 90 | if ~status 91 | fprintf('Unable to download %s.\n', file); 92 | else 93 | fid = fopen(destFullFile,'w'); 94 | fwrite(fid,contents); 95 | fclose(fid); 96 | fprintf('Successfully downloaded and created: ''%s''.\n',... 97 | destFullFile); 98 | end 99 | end 100 | end 101 | end 102 | 103 | -------------------------------------------------------------------------------- /matlab-load.el: -------------------------------------------------------------------------------- 1 | ;;; matlab-load.el --- Auto-generated CEDET autoloads 2 | ;; 3 | ;;; Code: 4 | 5 | 6 | ;;;### (autoloads (matlab-cedet-setup) "cedet-matlab" "cedet-matlab.el" 7 | ;;;;;; (19026 21759)) 8 | ;;; Generated autoloads from cedet-matlab.el 9 | 10 | (autoload 'matlab-cedet-setup "cedet-matlab" "\ 11 | Update various paths to get SRecode to identify our macros. 12 | 13 | \(fn)" t nil) 14 | 15 | ;;;*** 16 | 17 | ;;;### (autoloads (company-matlab-shell) "company-matlab-shell" "company-matlab-shell.el" 18 | ;;;;;; (19026 24400)) 19 | ;;; Generated autoloads from company-matlab-shell.el 20 | 21 | (autoload 'company-matlab-shell "company-matlab-shell" "\ 22 | A `company-mode' completion back-end for Matlab-Shell. 23 | 24 | \(fn COMMAND &optional ARG &rest IGNORED)" t nil) 25 | 26 | ;;;*** 27 | 28 | ;;;### (autoloads (matlab-shell matlab-mode) "matlab" "matlab.el" 29 | ;;;;;; (19086 58944)) 30 | ;;; Generated autoloads from matlab.el 31 | 32 | (add-to-list 'auto-mode-alist '("\\.m$" . matlab-mode)) 33 | 34 | (autoload 'matlab-mode "matlab" "\ 35 | MATLAB(R) mode is a major mode for editing MATLAB dot-m files. 36 | \\ 37 | Convenient editing commands are: 38 | \\[matlab-comment-region] - Comment/Uncomment out a region of code. 39 | \\[matlab-fill-comment-line] - Fill the current comment line. 40 | \\[matlab-fill-region] - Fill code and comments in region. 41 | \\[matlab-fill-paragraph] - Refill the current command or comment. 42 | \\[matlab-complete-symbol] - Symbol completion of matlab symbolsbased on the local syntax. 43 | \\[matlab-indent-sexp] - Indent syntactic block of code. 44 | 45 | Convenient navigation commands are: 46 | \\[matlab-beginning-of-command] - Move to the beginning of a command. 47 | \\[matlab-end-of-command] - Move to the end of a command. 48 | \\[matlab-beginning-of-defun] - Move to the beginning of a function. 49 | \\[matlab-end-of-defun] - Move do the end of a function. 50 | \\[matlab-forward-sexp] - Move forward over a syntactic block of code. 51 | \\[matlab-backward-sexp] - Move backwards over a syntactic block of code. 52 | 53 | Convenient template insertion commands: 54 | \\[tempo-template-matlab-function] - Insert a function definition. 55 | \\[tempo-template-matlab-if] - Insert an IF END block. 56 | \\[tempo-template-matlab-for] - Insert a FOR END block. 57 | \\[tempo-template-matlab-switch] - Insert a SWITCH END statement. 58 | \\[matlab-insert-next-case] - Insert the next CASE condition in a SWITCH. 59 | \\[matlab-insert-end-block] - Insert a matched END statement. With optional ARG, reindent. 60 | \\[matlab-stringify-region] - Convert plaintext in region to a string with correctly quoted chars. 61 | 62 | Variables: 63 | `matlab-indent-level' Level to indent blocks. 64 | `matlab-cont-level' Level to indent continuation lines. 65 | `matlab-cont-requires-ellipsis' Does your MATLAB support implied elipsis. 66 | `matlab-case-level' Level to unindent case statements. 67 | `matlab-indent-past-arg1-functions' 68 | Regexp of functions to indent past the first 69 | argument on continuation lines. 70 | `matlab-maximum-indents' List of maximum indents during lineups. 71 | `matlab-comment-column' Goal column for on-line comments. 72 | `fill-column' Column used in auto-fill. 73 | `matlab-indent-function-body' If non-nil, indents body of MATLAB functions. 74 | `matlab-functions-have-end' If non-nil, MATLAB functions terminate with end. 75 | `matlab-return-function' Customize RET handling with this function. 76 | `matlab-auto-fill' Non-nil, do auto-fill at startup. 77 | `matlab-fill-code' Non-nil, auto-fill code. 78 | `matlab-fill-strings' Non-nil, auto-fill strings. 79 | `matlab-verify-on-save-flag' Non-nil, enable code checks on save. 80 | `matlab-highlight-block-match-flag' 81 | Enable matching block begin/end keywords. 82 | `matlab-vers-on-startup' If t, show version on start-up. 83 | `matlab-handle-simulink' If t, enable simulink keyword highlighting. 84 | 85 | All Key Bindings: 86 | \\{matlab-mode-map} 87 | 88 | \(fn)" t nil) 89 | 90 | (autoload 'matlab-shell "matlab" "\ 91 | Create a buffer with MATLAB running as a subprocess. 92 | 93 | MATLAB shell cannot work on the MS Windows platform because MATLAB is not 94 | a console application. 95 | 96 | \(fn)" t nil) 97 | 98 | ;;;*** 99 | 100 | ;;;### (autoloads (mlint-minor-mode) "mlint" "mlint.el" (19086 58971)) 101 | ;;; Generated autoloads from mlint.el 102 | 103 | (autoload 'mlint-minor-mode "mlint" "\ 104 | Toggle mlint minor mode, a mode for showing mlint errors. 105 | With prefix ARG, turn mlint minor mode on iff ARG is positive. 106 | \\{mlint-minor-mode-map\\} 107 | 108 | \(fn &optional ARG)" t nil) 109 | 110 | ;;;*** 111 | 112 | ;;;### (autoloads (semantic-default-matlab-setup) "semantic-matlab" 113 | ;;;;;; "semantic-matlab.el" (19026 21813)) 114 | ;;; Generated autoloads from semantic-matlab.el 115 | 116 | (autoload 'semantic-default-matlab-setup "semantic-matlab" "\ 117 | Set up a buffer for parsing of MATLAB files. 118 | 119 | \(fn)" nil nil) 120 | 121 | ;;;*** 122 | 123 | ;;;### (autoloads (tlc-mode) "tlc" "tlc.el" (17295 18676)) 124 | ;;; Generated autoloads from tlc.el 125 | 126 | (autoload 'tlc-mode "tlc" "\ 127 | Major mode for editing Tlc files, or files found in tlc directories. 128 | 129 | \(fn)" t nil) 130 | (add-to-list 'auto-mode-alist '("\\.tlc$" .tlc-mode)) 131 | 132 | ;;;*** 133 | 134 | ;;;### (autoloads nil nil ("hg2.el" "matlab-publish.el" "semanticdb-matlab.el") 135 | ;;;;;; (19086 58974 113326)) 136 | 137 | ;;;*** 138 | 139 | (provide 'matlab-load) 140 | ;; Local Variables: 141 | ;; version-control: never 142 | ;; no-byte-compile: t 143 | ;; no-update-autoloads: t 144 | ;; coding: utf-8 145 | ;; End: 146 | ;;; matlab-load.el ends here 147 | -------------------------------------------------------------------------------- /matlab-publish.el: -------------------------------------------------------------------------------- 1 | ;;; matlab-publish.el --- Utilities for editing MATLAB files for publishing 2 | 3 | ;; Copyright (C) 2009 Uwe Brauer 4 | 5 | ;; Author: Uwe Brauer oub@mat.ucm.es 6 | ;; Maintainer: Uwe Brauer oub@mat.ucm.es 7 | ;; Created: 25 Feb 2009 8 | ;; Version: 1.0 9 | ;; Keywords: 10 | 11 | 12 | ;; This program is free software; you can redistribute it and/or modify 13 | ;; it under the terms of the GNU General Public License as published by 14 | ;; the Free Software Foundation; either version 1, or (at your option) 15 | ;; any later version. 16 | 17 | ;; This program is distributed in the hope that it will be useful, 18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | ;; GNU General Public License for more details. 21 | 22 | ;; A copy of the GNU General Public License can be obtained from this 23 | ;; program's author (send electronic mail to oub@mat.ucm.es) or from 24 | ;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 25 | ;; 02139, USA. 26 | 27 | ;; LCD Archive Entry: 28 | ;; my-pub|Uwe Brauer|oub@mat.ucm.es 29 | ;; | 30 | ;; |$Date: 2009/07/06 19:59:10 $|$Revision: 1.1 $|~/packages/my-pub.el 31 | 32 | ;;; Commentary: 33 | 34 | ;;{{{Change log: 35 | 36 | ;; $Id: matlab-publish.el,v 1.1 2009/07/06 19:59:10 zappo Exp $ 37 | ;; $Log: matlab-publish.el,v $ 38 | ;; Revision 1.1 2009/07/06 19:59:10 zappo 39 | ;; Utilities for editing MATLAB files for publishing 40 | ;; 41 | ;; Revision 1.9 2009/03/08 09:38:31 oub 42 | ;; * matlab-publish.el (matlab-select-environment): change function 43 | ;; slightly 44 | ;; (matlab-insert-section): new function 45 | ;; 46 | ;; Revision 1.8 2009/03/07 13:54:57 oub 47 | ;; (matlab-write-region-novisit): New function 48 | ;; (matlab-publish-region-old): new function 49 | ;; (matlab-publish-region): New function 50 | ;; (matlab-publish-region-latex): new function 51 | ;; (matlab-publish-region-html): new function 52 | ;; 53 | ;; Revision 1.7 2009/03/07 13:26:55 oub 54 | ;; (matlab-show-matlab-shell): New variable 55 | ;; (matlab-publish-file-latex): add 56 | ;; (if matlab-show-matlab-shell 57 | ;; (matlab-show-matlab-shell-buffer))) 58 | ;; 59 | ;; Revision 1.6 2009/03/07 11:00:04 oub 60 | ;; * matlab-publish.el (matlab-boldify): Modify the function. 61 | ;; 62 | ;; Revision 1.5 2009/03/06 14:24:47 oub 63 | ;; * matlab-publish.el (matlab-temp-region-file): new variable 64 | ;; (matlab-write-region): New function 65 | ;; 66 | ;; Revision 1.4 2009/02/26 16:18:23 oub 67 | ;; modifiy the insert functions in order that the jump to the text where 68 | ;; new stuff has to be inserted. 69 | ;; 70 | ;; Revision 1.3 2009/02/26 16:06:08 oub 71 | ;; (defun matlab-select-environment (ch) 72 | ;; (interactive "c1: title, 2: descr, 3: bold:, 4:mono, 5:pre, 6:equation, 7:list ") 73 | ;; (setq ch (downcase ch)) 74 | ;; (call-interactively (cond ((eql ch ?1) #'matlab-insert-title) 75 | ;; ((eql ch ?2) #'matlab-insert-description-text) 76 | ;; ((eql ch ?3) #'matlab-insert-bold-text) 77 | ;; ((eql ch ?4) #'matlab-insert-monospaces-text) 78 | ;; ((eql ch ?5) #'matlab-insert-preformated-text) 79 | ;; ((eql ch ?6) #'matlab-insert-equation) 80 | ;; ((eql ch ?7) #'matlab-insert-bullet-list) 81 | ;; (t (error 'args-out-of-range '(1 2 3 5 6 7 ch)))))) 82 | ;; 83 | ;; Revision 1.2 2009/02/26 11:24:17 oub 84 | ;; New functions 85 | ;; (defun matlab-insert-title () 86 | ;; 87 | ;; (defun matlab-insert-description-text () 88 | ;; 89 | ;; 90 | ;; (defun matlab-insert-bold-text () 91 | ;; 92 | ;; 93 | ;; (defun matlab-insert-monospaces-text () 94 | ;; 95 | ;; 96 | ;; 97 | ;; (defun matlab-insert-preformated-text () 98 | ;; 99 | ;; 100 | ;; (defun matlab-insert-equation () 101 | ;; 102 | ;; 103 | ;; (defun matlab-insert-bullet-list () 104 | ;; 105 | ;; Revision 1.1 2009/02/26 11:15:02 oub 106 | ;; Initial revision 107 | ;; 108 | 109 | ;;}}} 110 | 111 | ;;; Code: 112 | 113 | 114 | ;; (defun my-publish-matlab () 115 | ;; (interactive) 116 | ;; (let ((pub (file-name-nondirectory (buffer-file-name)))) 117 | ;; (let ((arg (concat "publish('" pub "','latex')"))) 118 | ;; (matlab-shell-run-command arg)))) 119 | 120 | (require 'matlab) 121 | 122 | ;; Variables 123 | (defvar matlab-temp-region-file "region.m" ;Version-1.5 124 | "*Variable for the file which saves the region for publishing.") 125 | 126 | (defvar matlab-show-matlab-shell t 127 | "* t means the matlab buffer shell is shown when running matlab.") 128 | 129 | ;; Functions 130 | (defun matlab-select-publish-form (ch) 131 | "This function allows to publish the m file, either as in LaTeX or in 132 | HTML format." 133 | (interactive "c1: LaTeX, 2: HTML ") 134 | (setq ch (downcase ch)) 135 | (call-interactively (cond ((eql ch ?1) #'matlab-publish-file-latex) 136 | ((eql ch ?2) #'matlab-publish-file-html) 137 | (t (error 'args-out-of-range '(1 2 ch)))))) 138 | 139 | (defun matlab-publish-file-latex () ;Version-1.7 140 | "Publish a matlab file in the LaTeX format." 141 | (interactive) 142 | (let ((pub (file-name-nondirectory (buffer-file-name)))) 143 | (matlab-shell-run-command (format "publish('%s','latex')" pub))) 144 | (if matlab-show-matlab-shell 145 | (matlab-show-matlab-shell-buffer))) 146 | 147 | 148 | 149 | (defun matlab-publish-file-html () ;Version-1.7 150 | (interactive) 151 | "Publish a matlab file in the html format." 152 | (let ((pub (file-name-nondirectory (buffer-file-name)))) 153 | (matlab-shell-run-command (format "publish('%s','html')" pub))) 154 | (if matlab-show-matlab-shell 155 | (matlab-show-matlab-shell-buffer))) 156 | 157 | 158 | 159 | (defun matlab-select-environment (ch) ;Version-1.9 160 | "This functions inserts structured text, which results for example 161 | in LaTeX mode in title, sections, description, boldified text, unnumbered equations and bullet list." 162 | (interactive "c1: title, 2: section, 3:descrip, 4:boldify, 5:equation, 6:list ") 163 | (setq ch (downcase ch)) 164 | (call-interactively (cond ((eql ch ?1) #'matlab-insert-title) 165 | ((eql ch ?2) #'matlab-insert-section) 166 | ((eql ch ?3) #'matlab-insert-description-text) 167 | ((eql ch ?4) #'matlab-boldify) 168 | ((eql ch ?5) #'matlab-insert-equation) 169 | ((eql ch ?6) #'matlab-insert-bullet-list) 170 | (t (error 'args-out-of-range '(1 2 3 5 6 ch)))))) 171 | 172 | 173 | (defun matlab-insert-title () 174 | (interactive) 175 | (beginning-of-buffer nil) 176 | (insert "%% TITLE\n") 177 | (previous-line 1) 178 | (forward-char 3)) 179 | 180 | (defun matlab-insert-section () ;Version-1.9 181 | (interactive) 182 | (insert "%% Section\n") 183 | (previous-line 1) 184 | (forward-char 3)) 185 | 186 | 187 | (defun matlab-insert-description-text () 188 | (interactive) 189 | (insert "%%\n") 190 | (insert "% DESCRIPTIVE TEXT\n") 191 | (previous-line 1) 192 | (forward-char 2)) 193 | 194 | 195 | 196 | (defun matlab-boldify () ;Version-1.6 197 | "Insert either \%\%\\n \% \*BOLD TEXT\*\\n or, when mark is active, 198 | surrounds region by * *." 199 | (interactive) 200 | (if (or (and (boundp 'zmacs-region-active-p) zmacs-region-active-p) 201 | (and (boundp 'transient-mark-mode) transient-mark-mode mark-active)) 202 | (save-excursion 203 | (goto-char (point)) 204 | (insert "*") 205 | (goto-char (mark)) 206 | (insert "*")) 207 | (insert "\n%%\n") 208 | (insert "% *BOLD TEXT*\n") 209 | (backward-char 2))) 210 | 211 | 212 | (defun matlab-insert-bold-text () 213 | (interactive) 214 | (insert "%%\n") 215 | (insert "% *BOLD TEXT*\n") 216 | (previous-line 1) 217 | (forward-char 2)) 218 | 219 | (defun matlab-insert-monospaces-text () 220 | (interactive) 221 | (insert "%%\n") 222 | (insert "% |MONOSPACED TEXT|\n") 223 | (previous-line 1) 224 | (forward-char 2)) 225 | 226 | 227 | (defun matlab-insert-preformated-text () 228 | (interactive) 229 | (insert "%%\n") 230 | (insert "%\n") 231 | (insert "% PREFORMATTED\n") 232 | (insert "% TEXT\n") 233 | (insert "% \n") 234 | (previous-line 3) 235 | (forward-char 3)) 236 | 237 | (defun matlab-insert-equation () 238 | (interactive) 239 | (insert "%%\n") 240 | (insert "% \n") 241 | (insert "% $$e^{\pi i} + 1 = 0$$\n") 242 | (insert "% \n") 243 | (previous-line 2) 244 | (forward-char 4)) 245 | 246 | 247 | (defun matlab-insert-bullet-list () 248 | (interactive) 249 | (insert "%%\n") 250 | (insert "% \n") 251 | (insert "% * ITEM1\n") 252 | (insert "% * ITEM2\n") 253 | (insert "% \n") 254 | (previous-line 3) 255 | (forward-char 4)) 256 | 257 | 258 | 259 | 260 | (defun matlab-write-region (start end) ;Version-1.5 261 | (interactive "r") 262 | (write-region start end (expand-file-name matlab-temp-region-file) nil nil nil nil) 263 | (find-file matlab-temp-region-file)) 264 | 265 | 266 | (defun matlab-write-region-novisit (start end) 267 | (interactive "r") 268 | (write-region start end (expand-file-name matlab-temp-region-file) nil nil nil nil)) 269 | 270 | 271 | 272 | 273 | (defun matlab-publish-region-old (ch) ;Version-1.8 274 | (interactive "c1: LaTeX, 2: HTML ") 275 | (setq ch (downcase ch)) 276 | (matlab-write-region-novisit (region-beginning) (region-end)) 277 | (call-interactively (cond ((eql ch ?1) #'matlab-publish-region-latex) 278 | ((eql ch ?2) #'matlab-publish-region-html) 279 | (t (error 'args-out-of-range '(1 2 ch)))))) 280 | 281 | 282 | (defun matlab-publish-region (start end ch) ;Version-1.8 283 | (interactive "r\nc1: LaTeX, 2: HTML ") 284 | (setq ch (downcase ch)) 285 | (write-region start end (expand-file-name matlab-temp-region-file) nil nil nil nil) 286 | (call-interactively (cond ((eql ch ?1) #'matlab-publish-region-latex) 287 | ((eql ch ?2) #'matlab-publish-region-html) 288 | (t (error 'args-out-of-range '(1 2 ch)))))) 289 | 290 | 291 | 292 | (defun matlab-publish-region-latex () ;Version-1.8 293 | (interactive) 294 | (matlab-shell-run-command (format "publish('%s','latex')" matlab-temp-region-file)) 295 | (if matlab-show-matlab-shell 296 | (matlab-show-matlab-shell-buffer))) 297 | 298 | 299 | 300 | (defun matlab-publish-region-html () ;Version-1.8 301 | (interactive) 302 | (matlab-shell-run-command (format "publish('%s','html')" matlab-temp-region-file)) 303 | (if matlab-show-matlab-shell 304 | (matlab-show-matlab-shell-buffer))) 305 | 306 | 307 | 308 | 309 | (provide 'matlab-publish) 310 | 311 | ;;; MY-PUB.EL ends here 312 | 313 | ;; (defvar isp "hallo" 314 | ;; "*check") 315 | ;; 316 | ;; (when (string-match isp "hallo")) 317 | ;; (message "it works")) -------------------------------------------------------------------------------- /tlc.el: -------------------------------------------------------------------------------- 1 | ;;; tlc --- Major mode for editing tlc files 2 | ;; 3 | ;; Author: Eric M. Ludlam 4 | ;; Keywords: tlc 5 | ;; X-Abstract: Major mode for editing tlc files 6 | ;; Version: 7 | 8 | (defvar tlc-version "1.2" 9 | "The current version of TLC mode.") 10 | 11 | ;; 12 | ;; Copyright 1997-2005 The MathWorks, Inc. 13 | ;; 14 | ;; This program is derived from free software; you can redistribute it 15 | ;; and/or modify it under the terms of the GNU General Public License 16 | ;; as published by the Free Software Foundation; either version 2, or 17 | ;; (at your option) any later version. 18 | ;; 19 | ;; This program is distributed in the hope that it will be useful, 20 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | ;; GNU General Public License for more details. 23 | ;; 24 | ;; You should have received a copy of the GNU General Public License 25 | ;; along with GNU Emacs; see the file COPYING. If not, write to 26 | ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 27 | ;; 28 | ;;; Commentary: 29 | ;; 30 | ;; This is a major mode for editing Target Language Compiler scripts. 31 | ;; It automatically indents the programming constructs. 32 | ;; 33 | 34 | ;;; History: 35 | ;; 36 | ;; 10Sep1998 by Eric M. Ludlam 37 | ;; Posted First revision onto the FTP site. 38 | ;; 39 | ;; 06Oct2005 Peter S galbraith 40 | ;; Minor changes for: 41 | ;; - support customization. 42 | ;; - added autoload cookies. 43 | ;; - CVS storage elsewhere without changing the version number. 44 | ;; 45 | ;; Add history items to the ChangeLog. 46 | 47 | ;;; Code: 48 | (defun tlc-version () 49 | "Display the current version of TLC mode." 50 | (interactive) 51 | (message tlc-version)) 52 | 53 | (defgroup tlc nil 54 | "Major mode for editing tlc files." 55 | :group 'languages) 56 | 57 | (defvar tlc-syntax-table nil 58 | "Syntax table used in an TLC file.") 59 | 60 | (unless tlc-syntax-table 61 | (setq tlc-syntax-table (make-syntax-table (standard-syntax-table))) 62 | (modify-syntax-entry ?/ ". 14" tlc-syntax-table) 63 | (modify-syntax-entry ?% ". 2356" tlc-syntax-table) 64 | (modify-syntax-entry ?\n "> b" tlc-syntax-table) 65 | (modify-syntax-entry ?\" "\"" tlc-syntax-table) 66 | (modify-syntax-entry ?< "(>" tlc-syntax-table) 67 | (modify-syntax-entry ?> ")>" tlc-syntax-table) 68 | ) 69 | 70 | (defvar tlc-mode-map 71 | (let ((km (make-sparse-keymap))) 72 | (define-key km "\C-m" 'tlc-return) 73 | (define-key km [return] 'tlc-return) 74 | (define-key km "\C-i" 'tlc-indent) 75 | km) 76 | "Keymap for `tlc-mode'.") 77 | 78 | (defvar tlc-font-lock-output-code 'tlc-font-lock-output-code 79 | "Face for output code.") 80 | 81 | (defface tlc-font-lock-output-code 82 | '((((class grayscale) (background light)) 83 | (:foreground "DimGray" :underline t)) 84 | (((class grayscale) (background dark)) 85 | (:foreground "LightGray" :underline t)) 86 | (((class color) (background light)) (:foreground "DarkGreen")) 87 | (((class color) (background dark)) (:foreground "chartreuse")) 88 | (t (:underline t))) 89 | "Font Lock mode face used to highlight tlc keywords." 90 | :group 'tlc) 91 | 92 | (defcustom tlc-keywords 93 | '("CAST" "EXISTS" "FEVAL" "FILE_EXISTS" "FORMAT" 94 | "FIELDNAMES" "GETFIELD" "GENERATE" 95 | "GENERATE_FILENAME" "GENERATE_FORMATTED_VALUE" 96 | "GENERATE_FUNCTION_EXISTS" "GENERATE_TYPE" 97 | "GENERATE_TYPE_FUNCTION_EXISTS" "GET_COMMAND_SWITCH" 98 | "IDNUM" "IMAG" 99 | "INT8MAX" "INT8MIN" 100 | "INT16MAX" "INT16MIN" 101 | "INT32MAX" "INT32MIN" 102 | "ISEQUAL" "ISFIELD" "ISINF" "ISNAN" "ISFINITE" 103 | "NULL_FILE" "NUMTLCFILES" 104 | "OUTPUT_LINES" "SIZE" "STDOUT" "STRING" "STRINGOF" 105 | "SYSNAME" "TLCFILES" "TLC_TIME" 106 | "TLC_FALSE" "TLC_TRUE" 107 | "TLC_VERSION" "TYPE" 108 | "UINT8MAX" "UINT16MAX" "UINT32MAX" 109 | "UINTWHITE_SPACE" "WILL_ROLL") 110 | "Keywords to highlight in TLC." 111 | :type '(repeat (string :tag "keyword")) 112 | :group 'tlc) 113 | 114 | (defvar tlc-font-lock-keywords 115 | (list 116 | ;; Some keywords 117 | '("^%function\\s-+\\(\\sw+\\)\\s-*(" 1 font-lock-function-name-face) 118 | '("^%function\\s-+\\(\\sw+\\)\\s-*(" 119 | ("\\s-*\\(\\sw+\\)\\s-*[,)]" nil nil 120 | (1 font-lock-variable-name-face))) 121 | '("\\(%%[^\n]*\\)\n" 1 font-lock-comment-face prepend) 122 | '("\\(^[ \t]*\\([^ \n\t%]\\|%<\\)[^\n]*\\)$" 1 tlc-font-lock-output-code append) 123 | '("\\(^\\|\\s-\\)\\(%[^% \t(\n>]+\\)\\>" 2 font-lock-keyword-face) 124 | '("%assign\\s-+:*\\([_a-zA-Z0-9.]+\\)\\s-*\\($\\|=\\)" 1 font-lock-variable-name-face) 125 | '("%\\(exit\\|warning\\|error\\|trace\\) \\([^\n]+\\)$" 2 font-lock-string-face prepend) 126 | '("\\(%<[^%\n>]+>\\)" 1 font-lock-reference-face prepend) 127 | (list (concat "\\<\\(" (regexp-opt tlc-keywords) "\\)\\>") 128 | 1 'font-lock-type-face) 129 | '("[^.]\\(\\.\\.\\.\\)$" 1 'underline prepend) 130 | ) 131 | "List of keywords for nicely coloring X defaults.") 132 | 133 | ;;;###autoload 134 | (defun tlc-mode () 135 | "Major mode for editing Tlc files, or files found in tlc directories." 136 | (interactive) 137 | (kill-all-local-variables) 138 | (setq major-mode 'tlc-mode) 139 | (setq mode-name "TLC") 140 | (use-local-map tlc-mode-map) 141 | (set-syntax-table tlc-syntax-table) 142 | (make-variable-buffer-local 'comment-start-skip) 143 | (make-local-variable 'comment-start) 144 | (make-local-variable 'comment-end) 145 | (make-local-variable 'comment-column) 146 | (make-local-variable 'comment-start-skip) 147 | (make-local-variable 'comment-multi-line) 148 | (setq comment-start "/% " 149 | comment-end " %/" 150 | comment-multi-line t) 151 | (setq comment-start-skip "%%\\|/%") 152 | (make-variable-buffer-local 'font-lock-comment-start-regexp) 153 | (make-local-variable 'indent-line-function) 154 | (setq indent-line-function 'tlc-indent) 155 | (make-local-variable 'font-lock-defaults) 156 | (setq font-lock-defaults '((tlc-font-lock-keywords 157 | ) 158 | nil ; do not do string/comment highlighting 159 | nil ; keywords are case sensitive. 160 | ;; This puts _ as a word constituant, 161 | ;; simplifying our keywords significantly 162 | ((?_ . "w")))) 163 | (tlc-version) 164 | ) 165 | 166 | (defun tlc-return () 167 | "Handle carriage return in `tlc-mode'." 168 | (interactive) 169 | (newline) 170 | (tlc-indent)) 171 | 172 | (defun tlc-indent () 173 | "Indent the current line to the indentation of the previous line." 174 | (interactive) 175 | (beginning-of-line) 176 | (delete-horizontal-space) 177 | (indent-to (tlc-calc-indentation)) 178 | ) 179 | 180 | (defun tlc-calc-indentation () 181 | "Calculate the indentation of this line." 182 | (beginning-of-line) 183 | (let ((i (cond 184 | ((looking-at 185 | "\\s-*\\(\\(\\(%end\\(roll\\|with\\|if\\|for\\|\ 186 | foreach\\|while\\|function\\)\\|%else\\|%elseif\\|%case\\|%default\\)\\>\\)\ 187 | \\|}\\)") 188 | -2) 189 | ((looking-at "\\s-*%/") 190 | -1) 191 | ((looking-at "\\s-*%endswitch") 192 | -4) 193 | (t 0))) 194 | (percent (looking-at "\\s-*%")) 195 | (percent-slash (looking-at "\\s-*%/")) 196 | (percent-percent (looking-at "\\s-*%%")) 197 | (indent-because-of-continuation nil)) 198 | 199 | (if (bobp) (current-indentation) 200 | (save-excursion 201 | (forward-line -1) 202 | (beginning-of-line) 203 | (while (and (looking-at "^\\s-*$") (not (bobp))) (forward-line -1)) 204 | (cond ((bobp) nil) 205 | ((and percent (looking-at "\\s-*/%")) 206 | (setq i (+ (current-indentation) 1))) 207 | ((and percent-slash (tlc-in-multiline-comment) 208 | (looking-at "\\s-*%")) 209 | (setq i (+ (current-indentation) 0))) 210 | (t 211 | (let* ((nexti (tlc-calc-next-indentation))) 212 | (setq i (+ (current-indentation) 213 | (if (and indent-because-of-continuation 214 | (or (> 0 i) percent-percent)) 215 | i 216 | (+ i nexti))))) 217 | (if (< i 0) (setq i 0)))) 218 | i)))) 219 | 220 | (defun tlc-calc-next-indentation () 221 | "Calc how much more to indent the next line." 222 | (+ 223 | (cond ((save-excursion 224 | (and (not (tlc-assignment-continuation-p)) 225 | (tlc-beginning-of-statement)) 226 | (looking-at "\\s-*\\(\\(%\\(case\\|roll\\|with\\|if\\|for\\|\ 227 | foreach\\|while\\|else\\|elseif\\|default\\|function\\)\\>\\)\\|/%\\)")) 228 | 2) 229 | ((looking-at "\\s-*%/") 230 | -1) 231 | ((looking-at "\\s-*\\(%switch\\)\\>") 232 | 4) 233 | ;((looking-at "\\s-*%break\\>") 234 | ; -2) 235 | ((and (save-excursion (end-of-line) 236 | (or (tlc-assignment-continuation-p) 237 | (progn (forward-char -3) 238 | (looking-at "\\\\$")))) 239 | (save-excursion (forward-line -1) 240 | (end-of-line) 241 | (not 242 | (or (tlc-assignment-continuation-p) 243 | (progn (forward-char -3) 244 | (looking-at "\\\\$")))))) 245 | (setq indent-because-of-continuation t) 246 | 2) 247 | ((or (save-excursion (end-of-line) 248 | (= (preceding-char) ?{)) 249 | ) 250 | 2) 251 | (t 0)) 252 | (if (and (not (tlc-line-special)) 253 | (not (save-excursion (end-of-line) 254 | (or (tlc-assignment-continuation-p) 255 | (progn (forward-char -3) 256 | (looking-at "\\\\$"))))) 257 | (save-excursion (forward-line -1) 258 | (end-of-line) 259 | (or (tlc-assignment-continuation-p) 260 | (progn (forward-char -3) 261 | (looking-at "\\\\$"))))) 262 | -2 263 | 0))) 264 | 265 | (defun tlc-beginning-of-statement () 266 | "Goto the beginning of a statement, skipping over continuation lines." 267 | (beginning-of-line) 268 | (if (not (save-excursion (forward-line -1) (tlc-assignment-continuation-p))) 269 | nil 270 | (forward-line -1) 271 | (while (tlc-assignment-continuation-p) 272 | (forward-line -1)) 273 | (forward-line 1) 274 | (beginning-of-line))) 275 | 276 | (defun tlc-line-special () 277 | "Return t if the current line is a special language line." 278 | (save-excursion 279 | (save-match-data 280 | (beginning-of-line) 281 | (looking-at "\\s-*\\(%[^<]\\|}\\)")))) 282 | 283 | (defun tlc-assignment-continuation-p () 284 | "See if continuation lines should be indented." 285 | (save-excursion 286 | (beginning-of-line) 287 | (and (progn (end-of-line) (forward-char -3) (looking-at "\\.\\.\\."))))) 288 | 289 | (defun tlc-in-multiline-comment () 290 | "Return t we are in a multiline comment." 291 | (save-excursion 292 | (save-match-data 293 | (if (re-search-backward "/%\\|%/" nil t) 294 | (if (looking-at "/%") 295 | t 296 | nil) 297 | nil)))) 298 | 299 | ;;; Add to mode list 300 | ;;;###autoload(add-to-list 'auto-mode-alist '("\\.tlc$" .tlc-mode)) 301 | (add-to-list 'auto-mode-alist '("\\.tlc$" .tlc-mode)) 302 | 303 | (provide 'tlc) 304 | 305 | ;;; tlc.el ends here 306 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2009-07-07 David Engster 2 | 3 | * semanticdb-matlab.el (semanticdb-matlab-scan-directories): Local 4 | bind for working-spinner-display. 5 | 6 | 2009-07-06 Eric Ludlam 7 | 8 | * company-matlab-shell.el: Company mode support for matlab-shell. 9 | 10 | * README: Added notes on CEDET use. 11 | Added notes on on the MATLAB download script. 12 | 13 | * matlab.el (matlab-mode-version): Update. 14 | 15 | * matlab-publish.el: Utilities for editing MATLAB files for publishing 16 | 17 | * templates/srecode-matlab.srt: SRecode templates for MATLAB Script. 18 | 19 | * semantic-matlab.el: Remove automatic init hook. See cedet-matlab.el 20 | 21 | * cedet-matlab.el: Initialization support for CEDET tools with MATLAB. 22 | 23 | * dl_emacs_support.m: Convenience download script. 24 | 25 | * matlab.el (matlab-indent-function-body): 26 | Allow a value of 'guess, meaning 27 | to guess the indentation style of a pre-existing file. 28 | (matlab-keyword-list,matlab-font-lock-keywords) 29 | (matlab-block-beg-pre-if,matlab-block-beg-pre-no-if) 30 | (matlab-keywords-solo,matlab-quiesce-nosemi-regexp): 31 | Add spmd. 32 | 33 | 2008-10-17 Eric Ludlam 34 | 35 | * matlab.el: Add enumeration support. 36 | 37 | 2008-09-18 David Engster 38 | 39 | * semanticdb-matlab.el (semanticdb-find-tags-by-name-method): 40 | Use our own database as 41 | fall-back method. 42 | (semanticdb-find-tags-for-completion-method): Combine results from 43 | MATLAB shell and our own database. 44 | 45 | 2008-09-08 David Engster 46 | 47 | * semantic-matlab.el: (semantic-ctxt-current-symbol) 48 | (semantic-ctxt-current-symbol-and-bounds): Return nil when no symbol 49 | at point. 50 | 51 | * semantic-matlab.el (semantic-matlab-parse-assignments): 52 | Deal with class methods which 53 | return same class and be more tolerant with whitespaces. 54 | 55 | * semantic-matlab.el (semantic-matlab-parse-assignments): 56 | Fix bug in parsing limit. Don't parse 57 | current line. Deal with class attribute assignments. 58 | 59 | 2008-09-07 David Engster 60 | 61 | * semanticdb-matlab.el (semanticdb-matlab-user-class-cache): 62 | New variable. 63 | (semanticdb-matlab-cache-files): New function for caching files and 64 | classes. 65 | (semanticdb-matlab-find-name): Use it. 66 | (semantic-ctxt-current-class-list): Deal with classes and structures. 67 | 68 | * semantic-matlab.el: (semantic-matlab-parse-oldstyle-class) 69 | (semantic-matlab-find-oldstyle-classes): New functions. 70 | (semantic-matlab-parse-region): Cache files. Use new functions for 71 | parsing classes. 72 | (semantic-matlab-type-hint-string): New variable. 73 | (semantic-matlab-parse-assignments): New function. 74 | (semantic-get-local-variables): New override. 75 | (semantic-ia-insert-tag): Deal with method completions. 76 | (semantic-ctxt-current-symbol) 77 | (semantic-ctxt-current-symbol-and-bounds): New overrides. 78 | 79 | * semantic-matlab.el (semantic-matlab-root-directory): Follow symlink. 80 | 81 | 2008-09-05 Eric Ludlam 82 | 83 | * semanticdb-matlab.el (semanticdb-find-tags-by-name-method): 84 | Fixed to handle case where 85 | matlab lies about the doc file location. 86 | (semanticdb-find-tags-for-completion-method): Adapt to use 87 | matlab-shell when available. 88 | 89 | * semanticdb-matlab.el (semanticdb-find-tags-by-name-method): 90 | Use matlab-shell if available. 91 | 92 | * semantic-matlab.el (semantic-matlab-root-directory): New Function. 93 | (semantic-matlab-function-tags): Update to use above. 94 | 95 | * matlab.el (matlab-shell-which-fcn): Append .m to builtin. 96 | (matlab-shell-matlabroot): New 97 | (matlab-shell-collect-command-output): Stop displaying status messages. 98 | 99 | * matlab.el: (matlab-shell-completion-list): 100 | Enabled to work in a non-shell buffer by switching over. 101 | (matlab-shell-which-fcn): New. 102 | 103 | * INSTALL: 104 | Revies to new matlab-load.el style. Discuss use w/out the Makefile. 105 | Remove semantic-matlab.el doc, it needs a re-write. 106 | 107 | * Makefile (LOADPATH): Add semantic/bovine 108 | 109 | * Project.ede (cedet): Add semantic-el dependency. 110 | 111 | * Makefile (LOADPATH): Now includes semantic. 112 | (cedet_LISP): New veriables. 113 | (cedet): New target. 114 | (dist): Add the cedet support files. 115 | 116 | * Project.ede ("lisp"): Added versionsource file. 117 | ("semantic"): New target 118 | 119 | * matlab.el (matlab-vers-on-startup): Set default to off. 120 | (auto-mode-alist): Add .m files. 121 | (matlab-block-end-pre-no-iff): Fix if/else order typo. 122 | 123 | * README: Update to latest information on installing matlab.el 124 | 125 | 2008-09-02 Eric Ludlam 126 | 127 | * mlint.el (mlint-platform): 128 | Use string-match to determine 64 bit linux-ness. 129 | (mlint-flags): Remove -fix until I get around to supporting it. 130 | 131 | 2008-09-01 David Engster 132 | 133 | * semanticdb-matlab.el: Fix doc-strings. 134 | 135 | * semantic-matlab.el (semantic-idle-summary-function): 136 | Use defvar-mode-local instead of 137 | make-local-variable. 138 | 139 | 2008-08-31 David Engster 140 | 141 | * semantic-matlab.el (semantic-format-tag-prototype): 142 | New overload for matlab-mode. 143 | (semantic-idle-summary-format-matlab-mode): New function, also 144 | displays doc-string. 145 | (semantic-ia-insert-tag): Use it. 146 | (semantic-default-matlab-setup): Bind `semantic-idle-summary-function'. 147 | 148 | * semantic-matlab.el: Unconditional require of semanticdb-matlab. 149 | (semantic-matlab-function-tags): Better parsing of doc strings. 150 | Return flag for builtin functions. 151 | (semantic-matlab-sort-raw-tags): Include new :builtin attribute. 152 | 153 | 2008-08-30 David Engster 154 | 155 | * INSTALL: Added section for semantic-matlab.el 156 | 157 | * semantic-matlab.el (semantic-matlab-system-paths-include): 158 | New variable. 159 | (semantic-matlab-dependency-system-include-path): Use it. 160 | (semantic-matlab-root-directory): Take everything until '/bin' as 161 | MATLAB root. 162 | 163 | * semanticdb-matlab.el: 164 | New file. Semantic database extensions for MATLAB. 165 | 166 | 2008-08-22 Eric Ludlam 167 | 168 | * semantic-matlab.el (semantic-matlab-dependency-system-include-path): 169 | Value should be a list. 170 | 171 | * semantic-matlab.el: Changes contributed by: David Engster 172 | (semanticdb-matlab): Conditional load. 173 | (semeantic-matlb-root-directory): New variable 174 | (semantic-matlab-match-function-re): Support _ 175 | (semantic-matlab-function-tags): Support loading doc strings. 176 | (semantic-matlab-sort-raw-tags): Support doc strings. 177 | (semantic-matlab-dependency-system-include-path) 178 | (semantic-matlab-display-docstring): New variables 179 | (semantic-ia-insert-tag): New overload function. 180 | 181 | 2008-08-05 Eric Ludlam 182 | 183 | * matlab.el (matlab-shell-ask-MATLAB-for-completions): 184 | Change default to t. 185 | Patch from David Engster: 186 | (matlab-shell-completion-list): Set scroll-show-maximum-output to nil. 187 | (matlab-shell-tab): Improve completion list extraction. 188 | 189 | 2008-08-01 Eric Ludlam 190 | 191 | * mlint.el (mlint-symtab-info): New variable. 192 | (mlint-run): Init symtab local var. 193 | Fixed symbol table parsing to work with newer mlint. 194 | 195 | * matlab.el (matlab-block-indent-toc-toc-flag): 196 | New variable. Default nil. 197 | (matlab-block-beg-pre-if, matlab-block-beg-pre-no-if) 198 | (matlab-block-end-pre-if, matlab-block-end-pre-no-if): 199 | If the tic-toc flag is nil, don't indent tic/tocs. 200 | 201 | 2008-05-19 Eric Ludlam 202 | 203 | * semantic-matlab.el: Copied from cedet repository. 204 | 205 | * matlab.el (matlab-keyword-list): Add mcos keywords 206 | (matlab-defun-regex, matlab-block-beg-pre-if, matlab-block-beg-pre-no-if): 207 | Updated w/ mcos keywords. 208 | 209 | * mlint.el (mlint-calculate-cyclic-complexity-flag): New flag. 210 | (mlint-flags): Add -fix 211 | (mlint-run): Use cyclic-complexity flag. 212 | 213 | * matlab.el (matlab-mode-version): Update 214 | (matlab-cellbreak-face): Fancy new face for cell-breaks. 215 | (matlab-font-lock-adjustments): Update cellbreak face. 216 | (matlab-font-lock-keywords): Add cellbreak highlighting. 217 | (matlab-mode): Fix spelling in indent-sexp keybinding to doc. 218 | 219 | 2007-03-06 Eric Ludlam 220 | 221 | * mlint.el: 222 | (mlint-clear-warnings, mlint-clear-cross-function-variable-highlighting): 223 | Make font-lock optional. 224 | 225 | 2007-01-08 Eric Ludlam 226 | 227 | * matlab.el: (matlab-block-end-pre-if, matlab-block-end-pre-no-if): 228 | Support assigning toc into a subs-assign. (Thanks Jim Van Zant) 229 | 230 | 2006-10-04 Eric Ludlam 231 | 232 | * mlint.el (mlint-output-regex): 233 | Support the changed mlint output syntax 234 | (mlint-symtab-line-regexp): Support changed mlint table output syntax 235 | (mlint-warning-code-alist): Obsolete 236 | (mlint-error-fix-alist): Obsolete 237 | (mlint-error-id-fix-alist): New version of the old error-fix-alist. 238 | (mlint-run): Add the "-edit" flag when highlighting crossfunction variables. 239 | Updated parsing of the mlint table for highlighting cross-function variables. 240 | Updated mechanism for highlighting the cross-function variables. 241 | (mlint-lm-entry): Update warningid doc. 242 | (mlint-warning->class, mlint-warningid->class): Name change. Use new table of warning ids 243 | instead of parsing warning strings. 244 | (linemark-new-entry): Use warning id, not warning string for class determination. 245 | (mlint-lm-replace-focus): new-text is no longer class allocated. 246 | (mlint-lm-entry-depricated): New class rule. 247 | (mlint-lm-entry-isstr, mlint-lm-entry-setstr): Deleted. 248 | (mlint-lm-eval->trycatch): Commented out. Not provided by mlint, but it 249 | is cool and could be resurrected. 250 | (mlint-highlight): Can't provide warningcode anymore. 251 | (mlint-clear-cross-function-variable-overlays): Renamed to 252 | (mlint-clear-nested-function-info-overlays): updated w/ more info. 253 | (mlint-clear-cross-function-variable-highlighting) 254 | (mlint-minor-mode): Use new clear function for nested function info. 255 | 256 | * matlab.el: Make fill-paragraph work around cell headings nicely. 257 | Add `matlab-shell-run-cell' for cell-mode style execution of code. 258 | Change the page delimiter to include cell breaks. 259 | 260 | Support "parfor", available in MATLAB 2006a. 261 | Treat cell start comments as the start of a comment block, even if comments preceed it. 262 | Make sure typing in comment chars moves cursor to the correct location. 263 | 264 | 2005-12-02 Eric Ludlam 265 | 266 | * ChangeLog: Build and dependancies changes. 267 | 268 | * INSTALL, README: Add info about CEDET dependancies. 269 | 270 | * Makefile, Project.ede, matlab-load.el: Build system. 271 | 272 | 2005-12-02 Eric Ludlam 273 | 274 | * README, INSTALL: Refer to CEDET project for dependancies. 275 | 276 | * Makefile, Project.ede: New build system. 277 | 278 | * matlab-load.el: autoloads file. 279 | 280 | 2005-12-01 Eric Ludlam 281 | 282 | * matlab.el: Removed ChangLog from end of file. 283 | 284 | -------------------------------------------------------------------------------- /semanticdb-matlab.el: -------------------------------------------------------------------------------- 1 | ;;; semanticdb-matlab.el --- Semantic database extensions for MATLAB 2 | 3 | ;;; Copyright (C) 2008 David Engster 4 | 5 | ;; Author: David Engster 6 | ;; based heavily on semanticdb-skel.el (C) Eric Ludlam 7 | 8 | ;; This file is not part of GNU Emacs. 9 | 10 | ;; This is free software; you can redistribute it and/or modify 11 | ;; it under the terms of the GNU General Public License as published by 12 | ;; the Free Software Foundation; either version 2, or (at your option) 13 | ;; any later version. 14 | 15 | ;; This software is distributed in the hope that it will be useful, 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | ;; GNU General Public License for more details. 19 | 20 | ;; You should have received a copy of the GNU General Public License 21 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 22 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 23 | ;; Boston, MA 02110-1301, USA. 24 | 25 | 26 | (require 'semanticdb-search) 27 | (require 'working) 28 | (eval-when-compile 29 | ;; For generic function searching. 30 | (require 'eieio) 31 | (require 'eieio-opt) 32 | ) 33 | ;;; Code: 34 | 35 | ;; Put all directories which should be recursively scanned for your 36 | ;; personal MATLAB files here. 37 | 38 | (defvar semanticdb-matlab-include-paths 39 | (if (file-exists-p (expand-file-name "~/matlab")) 40 | (list (expand-file-name "~/matlab") ;; Default location for extra code. 41 | ) 42 | ;; Else, no default path. 43 | nil) 44 | "Directories which should be scanned for m-files.") 45 | 46 | ;;; Classes: 47 | (defclass semanticdb-table-matlab (semanticdb-search-results-table) 48 | ((major-mode :initform matlab-mode) 49 | ) 50 | "A table for returning search results from MATLAB path.") 51 | 52 | (defclass semanticdb-project-database-matlab 53 | (semanticdb-project-database 54 | ;; Use SINGLETON if there should be only one copy of this database. 55 | ;; Do not use this if you need a different copy for different projects. 56 | ;; eieio-singleton 57 | ) 58 | ((new-table-class :initform semanticdb-table-matlab 59 | :type class 60 | :documentation 61 | "New tables created for this database are of this class.") 62 | ) 63 | "Database representing MATLAB path.") 64 | 65 | ;; Create the database, and add it to searchable databases for matlab mode. 66 | (defvar-mode-local matlab-mode semanticdb-project-system-databases 67 | (list 68 | (semanticdb-project-database-matlab "Matlab")) 69 | "Search MATLAB path for symbols.") 70 | 71 | ;; NOTE: Be sure to modify this to the best advantage of your 72 | ;; language. 73 | (defvar-mode-local matlab-mode semanticdb-find-default-throttle 74 | '(project omniscience) 75 | "Search project files, then search this omniscience database. 76 | It is not necessary to to system or recursive searching because of 77 | the omniscience database.") 78 | 79 | ;;; Filename based methods 80 | ;; 81 | (defmethod semanticdb-get-database-tables ((obj semanticdb-project-database-matlab)) 82 | "For a MATLAB database, there are no explicit tables. 83 | Create one of our special tables that can act as an intermediary." 84 | ;; NOTE: This method overrides an accessor for the `tables' slot in 85 | ;; a database. You can either construct your own (like tmp here 86 | ;; or you can manage any number of tables. 87 | 88 | ;; We need to return something since there is always the "master table" 89 | ;; The table can then answer file name type questions. 90 | (when (not (slot-boundp obj 'tables)) 91 | (let ((newtable (semanticdb-table-matlab "MATLAB system table"))) 92 | (oset obj tables (list newtable)) 93 | (oset newtable parent-db obj) 94 | (oset newtable tags nil) 95 | )) 96 | (call-next-method)) 97 | 98 | (defmethod semanticdb-file-table ((obj semanticdb-project-database-matlab) filename) 99 | "From OBJ, return FILENAME's associated table object." 100 | ;; NOTE: See not for `semanticdb-get-database-tables'. 101 | (car (semanticdb-get-database-tables obj)) 102 | ) 103 | 104 | (defmethod semanticdb-get-tags ((table semanticdb-table-matlab )) 105 | "Return the list of tags belonging to TABLE." 106 | ;; NOTE: Omniscient databases probably don't want to keep large tabes 107 | ;; lolly-gagging about. Keep internal Emacs tables empty and 108 | ;; refer to alternate databases when you need something. 109 | nil) 110 | 111 | (defmethod semanticdb-equivalent-mode ((table semanticdb-table-matlab) &optional buffer) 112 | "Return non-nil if TABLE's mode is equivalent to BUFFER. 113 | Equivalent modes are specified by by `semantic-equivalent-major-modes' 114 | local variable." 115 | (save-excursion 116 | (set-buffer buffer) 117 | (eq (or mode-local-active-mode major-mode) 'matlab-mode))) 118 | 119 | (defmethod semanticdb-full-filename ((obj semanticdb-table-matlab)) 120 | "Fetch the full filename that OBJ refers to. 121 | This function is currently a stub." 122 | ;; FIXME 123 | ;; return filename for object - what should we do with builtin functions? 124 | nil) 125 | 126 | 127 | ;;; Usage 128 | ;; 129 | ;; Unlike other tables, an omniscent database does not need to 130 | ;; be associated with a path. Use this routine to always add ourselves 131 | ;; to a search list. 132 | (define-mode-local-override semanticdb-find-translate-path matlab-mode 133 | (path brutish) 134 | "Return a list of semanticdb tables asociated with PATH. 135 | If brutish, do the default action. 136 | If not brutish, do the default action, and append the system 137 | database (if available.)" 138 | (let ((default 139 | ;; When we recurse, disable searching of system databases 140 | ;; so that our MATLAB database only shows up once when 141 | ;; we append it in this iteration. 142 | (let ((semanticdb-search-system-databases nil) 143 | ) 144 | (semanticdb-find-translate-path-default path brutish)))) 145 | ;; Don't add anything if BRUTISH is on (it will be added in that fcn) 146 | ;; or if we aren't supposed to search the system. 147 | (if (or brutish (not semanticdb-search-system-databases)) 148 | default 149 | (let ((tables (apply #'append 150 | (mapcar 151 | (lambda (db) (semanticdb-get-database-tables db)) 152 | semanticdb-project-system-databases)))) 153 | (append default tables))))) 154 | 155 | ;;; Search Overrides 156 | ;; 157 | ;; NOTE WHEN IMPLEMENTING: Be sure to add doc-string updates explaining 158 | ;; how your new search routines are implemented. 159 | ;; 160 | 161 | 162 | (defvar semanticdb-matlab-system-files-cache '(nil) 163 | "Internal cache for system M files. 164 | This variable caches all M files in the directories listed in 165 | `semantic-matlab-system-paths-include' under MATLAB root 166 | directory. Users can reset this cache using 167 | `semanticdb-matlab-reset-files-cache'") 168 | 169 | (defvar semanticdb-matlab-user-files-cache '(nil) 170 | "Internal cache for user M files. 171 | This variable caches all M files in the directories listed in 172 | `semanticdb-matlab-include-paths'. Users can reset this cache 173 | using `semanticdb-matlab-reset-files-cache'.") 174 | 175 | (defvar semanticdb-matlab-user-class-cache nil 176 | "Internal cache for user classes.") 177 | 178 | (defun semanticdb-matlab-reset-files-cache () 179 | "Reset semanticdb-matlab file cache." 180 | (interactive) 181 | (setq semanticdb-matlab-user-files-cache '(nil)) 182 | (setq semanticdb-matlab-system-files-cache '(nil))) 183 | 184 | (defun semanticdb-matlab-possibly-add-buffer-to-cache () 185 | "Add current buffer file name to cache. 186 | This function will add the current buffer file name to 187 | `semanticdb-matlab-user-files-cache' if not already there. Meant 188 | to be called in local `after-save-hook'." 189 | (unless (and semanticdb-matlab-user-files-cache 190 | (member (buffer-file-name) 191 | (cdr semanticdb-matlab-user-files-cache))) 192 | (setcdr semanticdb-matlab-user-files-cache 193 | (append (cdr semanticdb-matlab-user-files-cache) 194 | (list (buffer-file-name)))))) 195 | 196 | ;; Make sure newly created MATLAB files get in the user-files-cache 197 | (add-hook 'matlab-mode-hook 198 | (lambda () 199 | ;; add buffer-local after-save-hook 200 | (add-hook 201 | 'after-save-hook 202 | 'semanticdb-matlab-possibly-add-buffer-to-cache t t))) 203 | 204 | ;; Helper functions 205 | 206 | (defun semanticdb-matlab-scan-directories 207 | (dirs &optional recursive exclude-classes exclude-private) 208 | "Get list of all m-files in DIRS. 209 | DIRS is a list of directories. If RECURSIVE, every subdirectory 210 | will be included in the search. If EXCLUDE-CLASSES, class 211 | directories (beginning with '@') will be skipped. If 212 | EXCLUDE-PRIVATE, 'private' directories will be skipped." 213 | (if dirs 214 | (let ((working-status-dynamic-type 'working-spinner-display) 215 | files) 216 | (dolist (dir dirs) 217 | (when (and (boundp 'working-message) 218 | working-message) 219 | (working-dynamic-status)) 220 | (let (subdirs) 221 | (dolist (cur (directory-files dir t "[^.]" t)) 222 | (if (file-directory-p cur) 223 | (when (and recursive 224 | (not (and exclude-classes 225 | (string-match ".*/@" cur))) 226 | (not (and exclude-private 227 | (string-match ".*/private$" cur)))) 228 | (push cur subdirs)) 229 | (when (string-match "\\.m$" cur) 230 | (push cur files)))) 231 | (when subdirs 232 | (setq files 233 | (append files 234 | (semanticdb-matlab-scan-directories 235 | subdirs recursive exclude-classes exclude-private)))))) 236 | files) 237 | nil)) 238 | 239 | (defun semanticdb-matlab-cache-files () 240 | "Cache user and system MATLAB files if necessary." 241 | ;; car of *-file-cache variables is used as flag 242 | (unless (car semanticdb-matlab-system-files-cache) 243 | (working-status-forms 244 | "Searching system MATLAB files" "done" 245 | (setq semanticdb-matlab-system-files-cache 246 | (cons t 247 | (semanticdb-matlab-scan-directories 248 | semantic-matlab-dependency-system-include-path t t t))))) 249 | (unless (car semanticdb-matlab-user-files-cache) 250 | (working-status-forms 251 | "Searching user MATLAB files" "done" 252 | (setq semanticdb-matlab-user-files-cache 253 | (cons t 254 | (semanticdb-matlab-scan-directories 255 | semanticdb-matlab-include-paths t nil nil)))) 256 | ;; cache user defined old-style classes 257 | (setq semanticdb-matlab-user-class-cache 258 | (semantic-matlab-find-oldstyle-classes 259 | (cdr semanticdb-matlab-user-files-cache))))) 260 | 261 | (defun semanticdb-matlab-find-name (name &optional type) 262 | "Find NAME in matlab file names. 263 | If TYPE is 'regex, NAME is a regular expression. 264 | If TYPE is 'prefix, NAME is a prefix." 265 | (semanticdb-matlab-cache-files) 266 | (let ((files (append (cdr semanticdb-matlab-system-files-cache) 267 | (cdr semanticdb-matlab-user-files-cache))) 268 | regexp results) 269 | (cond 270 | ((eq type 'prefix) 271 | (setq regexp (format "^%s.*\\.m$" name))) 272 | ((eq type 'regex) 273 | (setq regexp (format "%s\\.m$" name))) 274 | (t 275 | (setq regexp (format "^%s\\.m" name)))) 276 | (dolist (cur files) 277 | (when (string-match regexp (file-name-nondirectory cur)) 278 | (push cur results))) 279 | results)) 280 | 281 | (define-mode-local-override semantic-ctxt-current-class-list 282 | matlab-mode (point) 283 | "Return a list of tag classes that are allowed at point. 284 | If point is nil, the current buffer location is used." 285 | (cond 286 | ((looking-at ".+=") 287 | '(variable type)) 288 | ((looking-back "\\(get\\|set\\)([a-zA-Z_0-9]*") 289 | '(variable type)) 290 | ((looking-back "\\(get\\|set\\)([a-zA-Z_0-9]+,'[a-zA-Z_0-9]*") 291 | '(variable)) 292 | ((looking-back "\\.[a-zA-Z_0-9]*") 293 | '(variable)) 294 | ((looking-at "\\s-*([a-zA-Z_0-9]+,") 295 | '(function)) 296 | (t 297 | '(function variable type)))) 298 | 299 | ;; Search functions 300 | 301 | (defmethod semanticdb-find-tags-by-name-method 302 | ((table semanticdb-table-matlab) name &optional tags) 303 | "Find all tags named NAME in TABLE. 304 | Return a list of tags." 305 | ;; If we have tags, go up. 306 | (if tags (call-next-method) 307 | (let (where) 308 | ;; If MATLAB shell is active, use it. 309 | (when (and (matlab-shell-active-p) 310 | (setq where (matlab-shell-which-fcn name))) 311 | (when (and (not (file-exists-p (car where))) 312 | ;; Sometimes MATLAB builtin functions lie. 313 | (string-match "@" (car where))) 314 | (setq where 315 | (list 316 | (concat 317 | (substring (car where) 0 (match-beginning 0)) 318 | name ".m"))))) 319 | (unless (car where) 320 | ;; Fall back to home-made database. 321 | (setq where 322 | (list (car (semanticdb-matlab-find-name name))))) 323 | (if (car where) 324 | (list (car (semanticdb-file-stream (car where)))) 325 | nil)))) 326 | 327 | (defmethod semanticdb-find-tags-by-name-regexp-method 328 | ((table semanticdb-table-matlab) regex &optional tags) 329 | "Find all tags with name matching REGEX in TABLE. 330 | Optional argument TAGS is a list of tags to search. 331 | Return a list of tags." 332 | (if tags (call-next-method) 333 | (let ((files (semanticdb-matlab-find-name regex 'regex))) 334 | (delq nil 335 | (mapcar '(lambda (x) 336 | (let ((matlab-vers-on-startup nil)) 337 | (car (semanticdb-file-stream x)))) 338 | files))))) 339 | 340 | (defmethod semanticdb-find-tags-for-completion-method 341 | ((table semanticdb-table-matlab) prefix &optional tags) 342 | "In TABLE, find all occurances of tags matching PREFIX. 343 | Optional argument TAGS is a list of tags to search. 344 | Returns a table of all matching tags." 345 | ;; If we have tags, go up. 346 | (if tags (call-next-method) 347 | ;; first, get completions from home-made database... 348 | (let ((compdb (semanticdb-matlab-find-name prefix 'prefix)) 349 | compshell) 350 | ;; ...and from MATLAB shell, if available 351 | (when (matlab-shell-active-p) 352 | (setq compshell 353 | (mapcar 354 | (lambda (x) 355 | (let ((where (matlab-shell-which-fcn (car x)))) 356 | ;; correct name for builtin functions 357 | (when (and (cdr where) 358 | (string-match 359 | "\\(.*\\)/@.*\\(/[A-Za-z_0-9]+\\.m\\)" 360 | (car where))) 361 | (setq where 362 | (list 363 | (concat (match-string 1 (car where)) 364 | (match-string 2 (car where)))))) 365 | (list (car where)))) 366 | (matlab-shell-completion-list prefix))) 367 | ;; combine results 368 | (mapc 369 | (lambda (x) 370 | (unless (member x compdb) 371 | (setq compdb (append compdb x)))) 372 | compshell)) 373 | ;; generate tags 374 | (delq nil 375 | (mapcar '(lambda (x) 376 | (let ((matlab-vers-on-startup nil)) 377 | (car (semanticdb-file-stream x)))) 378 | compdb))))) 379 | 380 | (provide 'semanticdb-matlab) 381 | 382 | ;;; semanticdb-matlab.el ends here 383 | -------------------------------------------------------------------------------- /semantic-matlab.el: -------------------------------------------------------------------------------- 1 | ;;; semantic-matlab.el --- Semantic details for MATLAB files 2 | 3 | ;;; Copyright (C) 2004, 2005, 2008 Eric M. Ludlam: The Mathworks, Inc 4 | 5 | ;; Author: Eric M. Ludlam 6 | ;; X-RCS: $Id: semantic-matlab.el,v 1.14 2009/07/06 19:49:09 zappo Exp $ 7 | 8 | ;; This file is not part of GNU Emacs. 9 | 10 | ;; This is free software; you can redistribute it and/or modify 11 | ;; it under the terms of the GNU General Public License as published by 12 | ;; the Free Software Foundation; either version 2, or (at your option) 13 | ;; any later version. 14 | 15 | ;; This software is distributed in the hope that it will be useful, 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | ;; GNU General Public License for more details. 19 | 20 | ;; You should have received a copy of the GNU General Public License 21 | ;; along with GNU Emacs; see the file COPYING. If not, write to the 22 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 23 | ;; Boston, MA 02110-1301, USA. 24 | 25 | ;;; Commentary: 26 | ;; 27 | ;; Parse a MATLAB M file for use w/ CEDET/Semantic 28 | ;; 29 | ;; The MATLAB language is pretty simple from a functional standpoint in that 30 | ;; you can only declare functions. In addition, the language itself is not 31 | ;; expressable in a yacc style grammar. It is therefore more expedient 32 | ;; to scan for regular expressions. 33 | ;; 34 | ;; Caveat: MCOS classes have property declarations. @todo - support them 35 | 36 | (require 'mode-local) 37 | (require 'semantic) 38 | (require 'semantic-format) 39 | (require 'matlab) 40 | (require 'semanticdb-matlab) 41 | 42 | ;;; Code: 43 | (defvar semantic-matlab-system-paths-include '("toolbox/matlab/funfun" "toolbox/matlab/general") 44 | "List of include paths under `semantic-matlab-root-directory'. 45 | These paths will be parsed recursively by semantic. Class and 46 | private directories will be omitted here.") 47 | 48 | (defvar semantic-matlab-root-directory 49 | (let* ((mlab (locate-file "matlab" exec-path)) 50 | (mlint (and (boundp 'mlint-program) 51 | mlint-program)) 52 | (exe (or mlab mlint))) 53 | (if exe 54 | (let ((dir 55 | (or (file-symlink-p exe) 56 | exe))) 57 | ;; If we have a dir, take everything until /bin as root dir. 58 | (string-match "\\(.*\\)/bin.*" dir) 59 | (match-string 1 dir)) 60 | (message "semantic-matlab: Could not find MATLAB executable in path.") 61 | nil)) 62 | "Root directory of MATLAB installation. 63 | Will be automatically determined by MATLAB or mlint executable. 64 | Use `semantic-matlab-system-paths-include' to let semantic know 65 | which system directories you would like to include when doing 66 | completions.") 67 | 68 | (defun semantic-matlab-root-directory () 69 | "Calculate the current MATLAB root directory." 70 | (if (matlab-shell-active-p) 71 | (matlab-shell-matlabroot) 72 | semantic-matlab-root-directory)) 73 | 74 | ;; The version of this variable in MATLAB.el is not condusive to extracting 75 | ;; the information we need. 76 | (defvar semantic-matlab-match-function-re 77 | "\\(^\\s-*function\\b[ \t\n.]*\\)\\(\\[[^]]+\\]\\s-*=\\|\\w+\\s-*=\\|\\)\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\>" 78 | "Expression to match a function start line.") 79 | 80 | ;; This function may someday be a part of matlab.el. 81 | ;; It does the raw scan and split for function tags. 82 | (defun semantic-matlab-function-tags (&optional buffer) 83 | "Find all MATLAB function tags in BUFFER. 84 | Return argument is: 85 | (START END RETURNVARS NAME ARGUMENTS DOCSTRING). 86 | Note that builtin functions from MATLAB will always return 87 | START=END=0 and no arguments or return values." 88 | (save-excursion 89 | (if buffer (set-buffer buffer)) 90 | (let ((re semantic-matlab-match-function-re) 91 | start ret fn arg end doc 92 | (taglist nil) 93 | ) 94 | (goto-char (point-min)) 95 | (if (and (string-match (format "^%s" (semantic-matlab-root-directory)) 96 | (buffer-file-name)) 97 | (looking-at "%\\([A-Z0-9_]+\\)\\s-+\\(.*\\)\\s-*$")) 98 | ;; This is a builtin function, ie there's no function line. 99 | ;; Hence we must use function name from the doc string. 100 | ;; FIXME 101 | ;; How can we get function arguments/return vals for builtin func's? 102 | (setq taglist 103 | (cons (list 0 0 nil (downcase (match-string-no-properties 1)) 104 | nil (match-string-no-properties 2) t 105 | ) 106 | taglist)) 107 | ;; this is a either not builtin or a user function 108 | (while (re-search-forward re nil t) 109 | (setq start (match-beginning 0) 110 | ret (buffer-substring-no-properties 111 | (match-beginning 2) (match-end 2)) 112 | fn (buffer-substring-no-properties 113 | (match-beginning 3) (match-end 3)) 114 | arg (buffer-substring-no-properties 115 | (match-end 3) (save-excursion 116 | (matlab-end-of-command) 117 | (point))) 118 | doc (save-excursion 119 | (forward-line) 120 | (beginning-of-line) 121 | ;; snarf doc string 122 | (cond 123 | ;; Mathworks standard 124 | ((looking-at "%[A-Z0-9_]+\\s-+\\(.*\\)\\s-*$") 125 | (match-string-no-properties 1)) 126 | ;; lookfor string 127 | ((looking-at "%\\s-+\\(.*\\)\\s-*$") 128 | (match-string-no-properties 1)) 129 | ;; otherwise simply snarf first line of 130 | ;; comments under function declaration 131 | (t 132 | (re-search-forward "[^[:blank:][:cntrl:]]" nil t) 133 | (backward-char) 134 | (if (looking-at "%\\s-+\\(.*\\)") 135 | (match-string-no-properties 1) 136 | nil)))) 137 | end (save-excursion 138 | (goto-char start) 139 | (if matlab-functions-have-end 140 | (condition-case nil 141 | ;; If we get a failure, we should at least 142 | ;; return whatever we got so far. 143 | (matlab-forward-sexp) 144 | (error (point-max))) 145 | (matlab-end-of-defun)) 146 | (point))) 147 | (setq taglist 148 | (cons (list start end 149 | (split-string ret "[][,=. \t\n]+" t) 150 | fn 151 | (split-string arg "[(), \n\t.]+" t) 152 | doc 153 | nil 154 | ) 155 | taglist)))) 156 | (nreverse taglist)))) 157 | 158 | (defun semantic-matlab-parse-oldstyle-class (tags &optional buffer) 159 | "Check if BUFFER with current TAGS is the constructor of a class. 160 | If this is the case, retrieve attributes from the buffer and scan 161 | the whole directory for methods. The function returns a single tag 162 | describing the class. This means that in semantic-matlab, the 163 | old-style MATLAB classes are linked to the constructor file." 164 | (let* ((name (buffer-file-name buffer)) 165 | class methods retval attributes) 166 | (when (string-match ".*/@\\(.*?\\)/\\(.*?\\)\\.m" name) 167 | ;; this buffer is part of a class - check 168 | (setq class (match-string 1 name)) 169 | (setq method (match-string 2 name)) 170 | (when (string= class method) ; is this the constructor? 171 | ;; get attributes of the class 172 | ;; TODO - we blindly assume the constructor is correctly defined 173 | (setq retval (semantic-tag-get-attribute (car tags) :return)) 174 | (goto-char (point-min)) 175 | ;; search for attributes 176 | (while (re-search-forward 177 | (concat "^\\s-*" (car retval) 178 | "\\.\\([A-Za-z0-9_]+\\)\\s-*=\\s-*\\(.+\\);") 179 | nil t) 180 | (push (list (match-string-no-properties 1) ; name 181 | (match-string-no-properties 2)) ; default value 182 | attributes)) 183 | ;; now scan the methods 184 | (dolist (cur (delete class 185 | (nthcdr 2 186 | (assoc class semanticdb-matlab-user-class-cache)))) 187 | (push 188 | (semantic-tag-put-attribute 189 | (car (semanticdb-file-stream 190 | (concat 191 | (file-name-directory name) 192 | cur ".m"))) 193 | :typemodifiers '("public")) 194 | methods)) 195 | ;; generate tag 196 | (semantic-tag-new-type 197 | class 198 | "class" 199 | (append 200 | (mapcar (lambda (cur) 201 | (semantic-tag-new-variable 202 | (car cur) nil (cdr cur) 203 | :typemodifiers '("public"))) 204 | attributes) 205 | methods) 206 | nil 207 | :typemodifiers '("public")))))) 208 | 209 | (defun semantic-matlab-find-oldstyle-classes (files) 210 | "Scan FILES for old-style Matlab class system. 211 | Returns an alist with elements (CLASSNAME LOCATION METHODS)." 212 | (let (classes temp tags) 213 | (dolist (cur files) 214 | ;; scan file path for @-directory 215 | (when (string-match "\\(.*\\)/@\\(.*?\\)/\\(.*?\\)\\.m" cur) 216 | (if (setq temp 217 | (assoc (match-string 2 cur) classes)) 218 | (nconc temp `(,(match-string 3 cur))) 219 | (push `( ,(match-string 2 cur) ,(match-string 1 cur) 220 | ,(match-string 3 cur)) classes)))) 221 | classes)) 222 | 223 | ;;; BEGIN PARSER 224 | ;; 225 | (defun semantic-matlab-parse-region (&rest ignore) 226 | "Parse the current MATLAB buffer for function definitions. 227 | IGNORE any arguments which specify a subregion to parse. 228 | Each tag returned is a semantic FUNCTION tag. See 229 | `semantic-tag-new-function'." 230 | (semanticdb-matlab-cache-files) 231 | (let ((raw (condition-case nil 232 | ;; Errors from here ought not to be propagated. 233 | (semantic-matlab-parse-functions) 234 | (error nil))) 235 | tags ctags) 236 | (setq tags (mapcar 'semantic-matlab-expand-tag raw)) 237 | ;; check if this is a class constructor 238 | (setq ctags (list (semantic-matlab-parse-oldstyle-class tags))) 239 | (if (car ctags) 240 | ctags 241 | tags))) 242 | 243 | (defun semantic-matlab-parse-changes () 244 | "Parse all changes for the current MATLAB buffer." 245 | ;; NOTE: For now, just schedule a full reparse. 246 | ;; To be implemented later. 247 | (semantic-parse-tree-set-needs-rebuild)) 248 | 249 | (defun semantic-matlab-expand-tag (tag) 250 | "Expand the MATLAB function tag TAG." 251 | (let ((chil (semantic-tag-components-with-overlays tag))) 252 | (if chil 253 | (semantic-tag-put-attribute 254 | tag :members (mapcar 'semantic-matlab-expand-tag chil))) 255 | (car (semantic--tag-expand tag)))) 256 | 257 | (defun semantic-matlab-parse-functions () 258 | "Parse all functions from the current MATLAB buffer." 259 | (car 260 | (semantic-matlab-sort-raw-tags (semantic-matlab-function-tags) 261 | (point-max)) 262 | )) 263 | 264 | (defun semantic-matlab-sort-raw-tags (tag-list &optional end) 265 | "Return a split list of tags from TAG-LIST before END. 266 | Return list is: 267 | (TAGS-BEFORE-END REMAINING-TAGS)" 268 | (let ((newlist nil) 269 | (rest tag-list)) 270 | ;; Loop until there are no more tags, or no tags before END. 271 | (while (and tag-list (> end (car (car tag-list)))) 272 | (let* ((tag (car tag-list)) 273 | (start (car tag)) 274 | (end (nth 1 tag)) 275 | (ret (nth 2 tag)) 276 | (name (nth 3 tag)) 277 | (args (nth 4 tag)) 278 | (doc (nth 5 tag)) 279 | (builtin (nth 6 tag)) 280 | (parts (semantic-matlab-sort-raw-tags (cdr tag-list) end)) 281 | (chil (car parts))) 282 | (setq rest (car (cdr parts))) 283 | (setq newlist 284 | (cons (append 285 | (semantic-tag-new-function name nil args 286 | :return ret 287 | :subfunctions chil 288 | :documentation doc 289 | :builtin builtin) 290 | (list start end)) 291 | newlist)) 292 | (setq tag-list rest))) 293 | (list (nreverse newlist) tag-list))) 294 | 295 | ;; The following function tries to parse MATLAB variable 296 | ;; assignments. There are only three categories of types: doubles, 297 | ;; structs, and classes. It returns a list with elements 298 | ;; (NAME TYPE ATTRIBUTES), for example: 299 | ;; ("astruct" "struct" "field1" "field2" "field3") 300 | ;; ("aclass" "class" "exampleclass") 301 | ;; ("anumber" "double" "1356") 302 | ;; Of course we can't parse things we don't know, e.g. 303 | ;; if (a==5) variable=aclass; else variable=anotherclass; 304 | ;; In these cases, the latter assignment counts. 305 | ;; Also, we don't know return types of functions (yet...) - the parser 306 | ;; will always think it's "double". You can override the 307 | ;; parser with a special comment, like: %type% avariable = aclass 308 | 309 | ;; One day we might use a grammar for this...? 310 | 311 | (defconst semantic-matlab-type-hint-string "%type%" 312 | "Comment string which prefixes a type hint for the parser.") 313 | 314 | (defun semantic-matlab-parse-assignments () 315 | "Parse assignments in current buffer. 316 | This function starts at current point and goes backwards, until 317 | it reaches a function declaration or the beginning of the buffer. 318 | It returns a list of variable assignments (NAME TYPE ATTRIBUTES), 319 | where NAME is unique." 320 | (let ((limit (or (save-excursion 321 | (if (re-search-backward semantic-matlab-match-function-re nil t) 322 | (progn 323 | (forward-line 1) 324 | (point)) 325 | nil)) 326 | (point-min))) 327 | vars) 328 | ;; don't parse current line 329 | (beginning-of-line) 330 | (while (re-search-backward (concat "^\\(" (regexp-quote semantic-matlab-type-hint-string) 331 | "\\)?\\([^%]*[^=><~]\\)=\\([^=].*\\)$") limit t) 332 | (let ((left (match-string-no-properties 2)) 333 | (right (match-string-no-properties 3)) 334 | temp) 335 | ;; first we have to deal with elipsis... 336 | (save-excursion 337 | (while (string-match 338 | (concat "\\(.*\\)" 339 | (regexp-quote matlab-elipsis-string) "\\s-*$") 340 | right) 341 | (forward-line 1) 342 | (setq right 343 | (concat 344 | (match-string 1 right) 345 | (progn (looking-at "^.*$") 346 | (match-string-no-properties 0)))))) 347 | (save-excursion 348 | (while (and (not (bobp)) 349 | (progn 350 | (forward-line -1) 351 | (looking-at 352 | (concat "\\(.*\\)" 353 | (regexp-quote matlab-elipsis-string) "\\s-*$")))) 354 | (setq left 355 | (concat (match-string-no-properties 1) left)))) 356 | ;; remove bracket expressions and beginning/trailing whitespaces on left-hand side 357 | (while (or (string-match "\\((.*)\\|{.*}\\)" left) 358 | (string-match "^\\(\\s-+\\)" left) 359 | (string-match "\\(\\s-+\\)$" left)) 360 | (setq left (replace-match "" t t left))) 361 | ;; deal with right-hand side 362 | (cond 363 | ;; special case: a = set(class,attribute,value) 364 | ((string-match "\\s-*set(\\s-*\\([A-Za-z_0-9 ]+\\)\\s-*," right) 365 | (setq right (match-string 1 right))) 366 | ;; method call which returns same class: class=method(class [,args]) 367 | ((and (string-match "\\s-*[A-Za-z_0-9 ]+\\s-*(\\s-*\\([A-Za-z_0-9 ]+\\)\\s-*\\(,\\|)\\)" right) 368 | (string= left (match-string 1 right))) 369 | (setq right (match-string 1 right))) 370 | ;; otherwise reduce right-hand side to first symbol 371 | (t 372 | (string-match "[[({ ]*\\([A-Za-z_0-9]*\\)" right) 373 | (setq right (match-string 1 right)))) 374 | (cond 375 | ;; multiple assignment, e.g. [a,b]=size(A); 376 | ((string-match "\\[\\(.*\\)\\]" left) 377 | (dolist (cur (split-string (match-string 1 left) ",")) 378 | (string-match "\\s-*\\([A-Za-z_0-9]+\\)\\s-*" cur) 379 | (setq cur (match-string 1 cur)) 380 | (unless (assoc cur vars) 381 | ;; since we don't know any return types, we just say it's double 382 | (push (list cur "double" "") vars)))) 383 | ;; (nested) structure 384 | ((string-match "\\([A-Za-z_0-9.]+\\)\\.\\([A-Za-z_0-9]+\\)" left) 385 | (while (string-match "\\([A-Za-z_0-9.]+\\)\\.\\([A-Za-z_0-9]+\\)" left) 386 | (let ((name (match-string 1 left)) 387 | (field (match-string 2 left))) 388 | (if (setq temp (assoc name vars)) 389 | (unless (member field temp) 390 | (nconc temp (list field))) 391 | (push (list name "struct" field) 392 | vars)) 393 | (setq left name)))) 394 | ;; class 395 | ((assoc right semanticdb-matlab-user-class-cache) 396 | (string-match "\\([A-Za-z_0-9]+\\)\\s-*$" left) 397 | (setq left (match-string 1 left)) 398 | (if (and (setq temp (assoc left vars)) 399 | (string= (nth 1 temp) "struct")) 400 | ;; we first thought it's a structure, but it's probably a 401 | ;; new-style class 402 | (setcdr temp `("class" ,right)) 403 | (unless temp 404 | (push `(,left "class" ,right) vars)))) 405 | (t 406 | ;; default is double 407 | (string-match "\\([A-Za-z_0-9]+\\)\\s-*$" left) 408 | (setq left (match-string 1 left)) 409 | (unless (or (assoc left vars) 410 | (string= left right)) ; self assignment 411 | (push `(,left "double" ,right) vars))) 412 | ))) 413 | vars)) 414 | 415 | 416 | 417 | (define-mode-local-override semantic-get-local-variables 418 | matlab-mode (&optional point) 419 | "Return a list of local variables for POINT." 420 | (semanticdb-matlab-cache-files) 421 | (save-excursion 422 | (let ((vars (semantic-matlab-parse-assignments)) 423 | knowntypes tags) 424 | (dolist (cur vars) 425 | ;; check right-hand side for known types which might be 426 | ;; assigned this variable 427 | (if (string= (nth 1 cur) "double") 428 | (when (member (nth 2 cur) knowntypes) 429 | (setcdr cur (cdr (assoc (nth 2 cur) vars)))) 430 | (push (nth 0 cur) knowntypes)) 431 | ;; generate the tag 432 | (push 433 | (semantic-tag-new-variable 434 | (car cur) 435 | (cond 436 | ;; structures 437 | ((string= (cadr cur) "struct") 438 | (semantic-tag-new-type 439 | ;; this is just a placeholder 440 | (concat (car cur) "_struct") 441 | "struct" 442 | (mapcar 443 | (lambda (x) 444 | (semantic-tag-new-variable 445 | x 446 | nil nil :typemodifiers '("public") )) 447 | (nthcdr 2 cur)) 448 | nil)) 449 | ;; classes 450 | ((string= (cadr cur) "class") 451 | ;; include tags from class constructor 452 | ;; (contains whole class, including methods) 453 | (car (semanticdb-file-stream 454 | (concat 455 | (nth 1 (assoc (nth 2 cur) semanticdb-matlab-user-class-cache)) 456 | "/@" (nth 2 cur) "/" (nth 2 cur) ".m")))) 457 | (t 458 | nil))) 459 | tags)) 460 | tags))) 461 | 462 | 463 | (define-mode-local-override semantic-tag-components-with-overlays 464 | matlab-mode (tag) 465 | "Return the list of subfunctions in TAG." 466 | (semantic-tag-get-attribute tag :subfunctions)) 467 | 468 | (define-mode-local-override semantic-format-tag-prototype matlab-mode 469 | (tag &optional parent color) 470 | "Return a prototype string describing tag. 471 | For MATLAB, we have to mark builtin functions, since we currently 472 | cannot derive an argument list for them." 473 | (let ((class (semantic-tag-class tag)) 474 | (name (semantic-format-tag-name tag parent color)) 475 | str) 476 | (if (eq class 'function) 477 | (let* ((args (semantic-tag-function-arguments tag)) 478 | (argstr (semantic--format-tag-arguments args 479 | #'identity 480 | color)) 481 | (builtin (semantic-tag-get-attribute tag :builtin)) 482 | (doc (semantic-tag-docstring tag))) 483 | (if builtin 484 | (if color 485 | (setq builtin (semantic--format-colorize-text " [builtin] " 'keyword) 486 | argstr (semantic--format-colorize-text " arguments unavailable" 'label)) 487 | (setq builtin " [builtin] " 488 | argstr " arguments unavailable")) 489 | (setq builtin "")) 490 | (concat name builtin "(" (if args " " "") 491 | argstr 492 | " )")) 493 | (semantic-format-tag-prototype-default tag parent color)))) 494 | 495 | (defun semantic-idle-summary-format-matlab-mode (tag &optional parent color) 496 | "Describe TAG and display corresponding MATLAB 'lookfor' doc-string." 497 | (let* ((proto (semantic-format-tag-prototype-matlab-mode tag nil color)) 498 | (doc (semantic-tag-docstring tag))) 499 | (concat proto " (" doc ")"))) 500 | 501 | (defcustom-mode-local-semantic-dependency-system-include-path 502 | matlab-mode semantic-matlab-dependency-system-include-path 503 | (if semantic-matlab-root-directory 504 | (mapcar (lambda (cur) 505 | (concat (file-name-as-directory semantic-matlab-root-directory) 506 | cur)) 507 | semantic-matlab-system-paths-include) 508 | nil) 509 | "The system include paths from MATLAB.") 510 | 511 | (defvar-mode-local matlab-mode semantic-idle-summary-function 512 | 'semantic-idle-summary-format-matlab-mode 513 | "Function to use when displaying tag information during idle time.") 514 | 515 | (defvar semantic-matlab-display-docstring t 516 | "Flag if function documentation should be displayed after completion.") 517 | 518 | (define-mode-local-override semantic-ia-insert-tag 519 | matlab-mode (tag) 520 | "Insert TAG into the current buffer based on completion." 521 | (insert (semantic-tag-name tag)) 522 | (let ((name (semantic-tag-name tag)) 523 | (tt (semantic-tag-class tag)) 524 | (args (semantic-tag-function-arguments tag)) 525 | (doc (semantic-tag-docstring tag))) 526 | (when (and (eq tt 'function) 527 | args 528 | (not (looking-at "\\s-*("))) 529 | (insert "(")) 530 | ;; delete trailing whitespaces when completing class methods 531 | (when (looking-at "\\(\\s-+\\)(") 532 | (delete-char (length (match-string 1)))) 533 | (when semantic-matlab-display-docstring 534 | (fame-message-nolog 535 | (semantic-idle-summary-format-matlab-mode tag nil t))))) 536 | 537 | (define-mode-local-override semantic-ctxt-current-symbol 538 | matlab-mode (&optional point) 539 | "Return the current symbol the cursor is on at point in a list. 540 | This will include a list of type/field names when applicable." 541 | (let* ((case-fold-search semantic-case-fold) 542 | sym) 543 | (with-syntax-table semantic-lex-syntax-table 544 | (save-excursion 545 | (when point (goto-char point)) 546 | ;; go to beginning of symbol 547 | (skip-syntax-backward "w_") 548 | (setq sym (if (looking-at "[a-zA-Z_0-9]+") 549 | (match-string-no-properties 0) 550 | nil)) 551 | (if sym 552 | (cond 553 | ;; method call: var = method(class,args) 554 | ((progn 555 | (and (looking-back "[^=><~]=\\s-*") 556 | (looking-at "[a-zA-Z_0-9]*\\s-*(\\([a-zA-Z_0-9]+\\),?"))) 557 | (list (match-string-no-properties 1) sym)) 558 | ;; class properties: var = get(class,'attribute') 559 | ((looking-back "\\(get\\|set\\)(\\s-*\\([a-zA-Z_0-9]+\\),'") 560 | (list (match-string-no-properties 2) sym)) 561 | ;; (nested) structures or new-style classes 562 | ((looking-back "[^A-Za-z_0-9.]\\([A-Za-z_0-9.]+\\)\\.") 563 | (list (match-string-no-properties 1) sym)) 564 | (t 565 | (list sym))) 566 | nil))))) 567 | 568 | (define-mode-local-override semantic-ctxt-current-symbol-and-bounds 569 | matlab-mode (&optional point) 570 | "Return the current symbol and bounds the cursor is on at POINT. 571 | Uses `semantic-ctxt-current-symbol' to calculate the symbol. 572 | Return (PREFIX ENDSYM BOUNDS)." 573 | (let ((sym (semantic-ctxt-current-symbol-matlab-mode point)) 574 | bounds endsym) 575 | (save-excursion 576 | (when point (goto-char point)) 577 | (when sym 578 | ;; go to beginning of symbol 579 | (skip-syntax-backward "w_") 580 | (setq endsym (progn (looking-at "[a-zA-Z_0-9]+") 581 | (match-string-no-properties 0))) 582 | (setq bounds (cons 583 | (match-beginning 0) 584 | (match-end 0))) 585 | (list sym endsym bounds))))) 586 | 587 | 588 | ;;;###autoload 589 | (defun semantic-default-matlab-setup () 590 | "Set up a buffer for parsing of MATLAB files." 591 | ;; This will use our parser. 592 | (semantic-install-function-overrides 593 | '((parse-region . semantic-matlab-parse-region) 594 | (parse-changes . semantic-matlab-parse-changes))) 595 | (setq semantic-parser-name "MATLAB" 596 | ;; Setup a dummy parser table to enable parsing! 597 | semantic--parse-table t 598 | imenu-create-index-function 'semantic-create-imenu-index 599 | ;; semantic-command-separation-character "." 600 | semantic-type-relation-separator-character '(".") 601 | semantic-symbol->name-assoc-list '((function . "Function") 602 | ) 603 | semantic-imenu-expandable-tag-classes '(function) 604 | semantic-imenu-bucketize-file nil 605 | semantic-imenu-bucketize-type-members nil 606 | senator-step-at-start-end-tag-classes '(function) 607 | semantic-stickyfunc-sticky-classes '(function) 608 | ) 609 | ) 610 | 611 | (provide 'semantic-matlab) 612 | 613 | ;;; semantic-matlab.el ends here 614 | -------------------------------------------------------------------------------- /ChangeLog.old2: -------------------------------------------------------------------------------- 1 | This is the old ChangeLog from CVS @ MathWorks via checkin comments. 2 | 3 | --------------- 4 | 5 | ;;; $Log: ChangeLog.old2,v $ 6 | ;;; Revision 1.1 2005/12/01 18:37:46 zappo 7 | ;;; *** empty log message *** 8 | ;;; 9 | Revision 1.4.4.11.2.4.2.2 2005/11/16 13:53:36 eludlam 10 | Small completion patch. 11 | 12 | Revision 1.4.4.11.2.4.2.1 2005/11/16 13:52:20 eludlam 13 | Small completion patch. 14 | 15 | Revision 1.4.4.11.2.4 2005/07/11 20:14:13 batserve 16 | 2005/06/27 1.4.4.14 batserve 17 | 2005/06/21 1.4.4.13.2.1 padman 18 | Saved after merging from 1.4.8.2 (Akernel) to dev_padman_A (1.4.4.13.2.0) 19 | 2005/06/21 1.4.4.13.2.2 padman 20 | Code Reviewer: TBRB mkarr,eludlam,csiegal 21 | merged Akernel,A versions 22 | some of Akernel's changes already got into A 23 | please review the merges 24 | Accepted job 28303 in A 25 | Accepted job 15746a in Ami 26 | Revision 1.4.4.11.2.5 2005/09/20 04:53:59 batserve 27 | 2005/09/08 1.4.4.15 batserve 28 | 2005/08/01 1.4.10.1 batserve 29 | 2005/07/29 1.4.4.14.6.1 mkarr 30 | Related Records: 274559 31 | Code Reviewer: Eric Ludlam 32 | Introduced functions-have-end minor mode. 33 | Introduced special highlighting for nested function/end. 34 | Optimize matlab-backward-sexp by assuming that sexps to not cross 35 | "function" at the left margin. 36 | Handle documentation anchors (links). 37 | Fixed a bug in highlighting cross-function variables. 38 | Fixed infinite loop bug when matching "end" to "function", 39 | in the mode where functions are not expected to have "end". 40 | Accepted job 2313 in Alead 41 | Accepted job 28899 in A 42 | Accepted job 16896b in Ami 43 | 44 | Revision 1.4.4.15 2005/09/08 20:31:39 batserve 45 | 2005/08/01 1.4.10.1 batserve 46 | 2005/07/29 1.4.4.14.6.1 mkarr 47 | Related Records: 274559 48 | Code Reviewer: Eric Ludlam 49 | Introduced functions-have-end minor mode. 50 | Introduced special highlighting for nested function/end. 51 | Optimize matlab-backward-sexp by assuming that sexps to not cross 52 | "function" at the left margin. 53 | Handle documentation anchors (links). 54 | Fixed a bug in highlighting cross-function variables. 55 | Fixed infinite loop bug when matching "end" to "function", 56 | in the mode where functions are not expected to have "end". 57 | Accepted job 2313 in Alead 58 | Accepted job 28899 in A 59 | 60 | Revision 1.4.10.1 2005/08/01 15:13:19 batserve 61 | 2005/07/29 1.4.4.14.6.1 mkarr 62 | Related Records: 274559 63 | Code Reviewer: Eric Ludlam 64 | Introduced functions-have-end minor mode. 65 | Introduced special highlighting for nested function/end. 66 | Optimize matlab-backward-sexp by assuming that sexps to not cross 67 | "function" at the left margin. 68 | Handle documentation anchors (links). 69 | Fixed a bug in highlighting cross-function variables. 70 | Fixed infinite loop bug when matching "end" to "function", 71 | in the mode where functions are not expected to have "end". 72 | Accepted job 2313 in Alead 73 | 74 | Revision 1.4.4.14.6.1 2005/07/29 19:50:48 mkarr 75 | Related Records: 274559 76 | Code Reviewer: Eric Ludlam 77 | 78 | Introduced functions-have-end minor mode. 79 | Introduced special highlighting for nested function/end. 80 | Optimize matlab-backward-sexp by assuming that sexps to not cross 81 | "function" at the left margin. 82 | Handle documentation anchors (links). 83 | Fixed a bug in highlighting cross-function variables. 84 | Fixed infinite loop bug when matching "end" to "function", 85 | in the mode where functions are not expected to have "end". 86 | Revision 1.4.4.11.2.5 2005/09/20 04:53:59 batserve 87 | 2005/09/08 1.4.4.15 batserve 88 | 2005/08/01 1.4.10.1 batserve 89 | 2005/07/29 1.4.4.14.6.1 mkarr 90 | Related Records: 274559 91 | Code Reviewer: Eric Ludlam 92 | Introduced functions-have-end minor mode. 93 | Introduced special highlighting for nested function/end. 94 | Optimize matlab-backward-sexp by assuming that sexps to not cross 95 | "function" at the left margin. 96 | Handle documentation anchors (links). 97 | Fixed a bug in highlighting cross-function variables. 98 | Fixed infinite loop bug when matching "end" to "function", 99 | in the mode where functions are not expected to have "end". 100 | Accepted job 2313 in Alead 101 | Accepted job 28899 in A 102 | Accepted job 16896b in Ami 103 | 104 | Revision 1.4.4.15 2005/09/08 20:31:39 batserve 105 | 2005/08/01 1.4.10.1 batserve 106 | 2005/07/29 1.4.4.14.6.1 mkarr 107 | Related Records: 274559 108 | Code Reviewer: Eric Ludlam 109 | Introduced functions-have-end minor mode. 110 | Introduced special highlighting for nested function/end. 111 | Optimize matlab-backward-sexp by assuming that sexps to not cross 112 | "function" at the left margin. 113 | Handle documentation anchors (links). 114 | Fixed a bug in highlighting cross-function variables. 115 | Fixed infinite loop bug when matching "end" to "function", 116 | in the mode where functions are not expected to have "end". 117 | Accepted job 2313 in Alead 118 | Accepted job 28899 in A 119 | 120 | Revision 1.4.10.1 2005/08/01 15:13:19 batserve 121 | 2005/07/29 1.4.4.14.6.1 mkarr 122 | Related Records: 274559 123 | Code Reviewer: Eric Ludlam 124 | Introduced functions-have-end minor mode. 125 | Introduced special highlighting for nested function/end. 126 | Optimize matlab-backward-sexp by assuming that sexps to not cross 127 | "function" at the left margin. 128 | Handle documentation anchors (links). 129 | Fixed a bug in highlighting cross-function variables. 130 | Fixed infinite loop bug when matching "end" to "function", 131 | in the mode where functions are not expected to have "end". 132 | Accepted job 2313 in Alead 133 | 134 | Revision 1.4.4.14.6.1 2005/07/29 19:50:48 mkarr 135 | Related Records: 274559 136 | Code Reviewer: Eric Ludlam 137 | 138 | Introduced functions-have-end minor mode. 139 | Introduced special highlighting for nested function/end. 140 | Optimize matlab-backward-sexp by assuming that sexps to not cross 141 | "function" at the left margin. 142 | Handle documentation anchors (links). 143 | Fixed a bug in highlighting cross-function variables. 144 | Fixed infinite loop bug when matching "end" to "function", 145 | in the mode where functions are not expected to have "end". 146 | 147 | Revision 1.4.4.14 2005/06/27 20:27:59 batserve 148 | 2005/06/21 1.4.4.13.2.1 padman 149 | Saved after merging from 1.4.8.2 (Akernel) to dev_padman_A (1.4.4.13.2.0) 150 | 2005/06/21 1.4.4.13.2.2 padman 151 | Code Reviewer: TBRB mkarr,eludlam,csiegal 152 | merged Akernel,A versions 153 | some of Akernel's changes already got into A 154 | please review the merges 155 | Accepted job 28303 in A 156 | 157 | Revision 1.4.4.13.2.2 2005/06/21 22:38:35 padman 158 | Code Reviewer: TBRB mkarr,eludlam,csiegal 159 | merged Akernel,A versions 160 | some of Akernel's changes already got into A 161 | please review the merges 162 | 163 | Revision 1.4.4.13.2.1 2005/06/21 22:21:29 padman 164 | Saved after merging from 1.4.8.2 (Akernel) to dev_padman_A (1.4.4.13.2.0) 165 | 166 | Revision 1.4.4.13 2005/06/21 18:51:17 batserve 167 | 2005/05/25 1.4.4.11.2.2 batserve 168 | 2005/01/21 1.4.2.12.2.2 eludlam 169 | Update copyright 170 | 2005/05/17 1.4.2.12.2.3 eludlam 171 | tic/toc indent fix. User fix for auto-fill. 172 | 2005/05/24 1.4.2.12.2.4 eludlam 173 | Related Records: 257613 258664 174 | Code Reviewer: mkarr 175 | Fix indentation numbers. 176 | Fix tic/toc indentation w/ assignments. 177 | Integrate user patch for auto-fill of of strings. 178 | Accepted job 15048 in Ami 179 | 2005/06/04 1.4.4.11.2.3 batserve 180 | 2005/06/02 1.4.2.12.2.5 eludlam 181 | Related Records: 266250 182 | Code Reviewer: mkarr 183 | Allow H1 lines for nested functions to indent correctly. 184 | Make comment char insertion electric. 185 | Added a few completion words. 186 | Fixed byte compilation warnings. 187 | Accepted job 15385 in Ami 188 | Accepted job 28180 in A 189 | 190 | Revision 1.4.4.11.2.3 2005/06/04 23:41:36 batserve 191 | 2005/06/02 1.4.2.12.2.5 eludlam 192 | Related Records: 266250 193 | Code Reviewer: mkarr 194 | Allow H1 lines for nested functions to indent correctly. 195 | Make comment char insertion electric. 196 | Added a few completion words. 197 | Fixed byte compilation warnings. 198 | Accepted job 15385 in Ami 199 | 200 | Revision 1.4.2.12.2.5 2005/06/02 18:44:30 eludlam 201 | Related Records: 266250 202 | Code Reviewer: mkarr 203 | Allow H1 lines for nested functions to indent correctly. 204 | Make comment char insertion electric. 205 | Added a few completion words. 206 | Fixed byte compilation warnings. 207 | 208 | Revision 1.4.2.12.2.4 2005/05/24 18:26:06 eludlam 209 | Related Records: 257613 258664 210 | Code Reviewer: mkarr 211 | Fix indentation numbers. 212 | Fix tic/toc indentation w/ assignments. 213 | Integrate user patch for auto-fill of of strings. 214 | 215 | Revision 1.4.2.12.2.3 2005/05/17 14:59:06 eludlam 216 | tic/toc indent fix. User fix for auto-fill. 217 | 218 | Revision 1.4.2.12.2.2 2005/01/21 21:32:24 eludlam 219 | Update copyright 220 | 221 | Revision 1.4.2.12.2.1 2005/01/21 13:25:11 eludlam 222 | Related Records: 250151 223 | Code Reviewer: paulk 224 | Fix mlint dependency problem. 225 | Fix XEmacs compatibility problem. 226 | Add (behind option) experimental shell completion system. 227 | Add (behind comment) hideshow support. 228 | 229 | Revision 1.4.2.12 2004/06/16 03:10:04 batserve 230 | 2004/06/10 1.4.2.11.2.1 mkarr 231 | Related Records: 168455 232 | Code Reviewer: Ty Lightner, Eric Ludlam 233 | Changes to support nested functions. 234 | Accepted job 12607 in Amisc 235 | 236 | Revision 1.4.2.11.2.1 2004/06/10 13:47:15 mkarr 237 | Related Records: 168455 238 | Code Reviewer: Ty Lightner, Eric Ludlam 239 | 240 | Changes to support nested functions. 241 | 242 | Revision 1.4.2.11 2004/05/13 02:52:11 batserve 243 | 2004/03/11 1.4.6.12 eludlam 244 | Saved after merging with Amisc (1.4.2.9) 245 | 2004/03/19 1.4.6.13 eludlam 246 | Related Records: 210470 247 | Code Reviewer: Various 248 | Fix header comments. 249 | Fix XEmacs compatibility itimer start. 250 | Fix XEmacs overlay compatibility macros. 251 | Add if(false) next to if(0) special code. 252 | Add support for %{ %} block comments. 253 | Fix problem with Emacs Link when not in use, and add new config item. 254 | Add optional feature for automatically adding a semicolon when needed. 255 | Add variable for lines that don't need semicolons. 256 | Fix menu item for mlint to not require it. 257 | Add -nodesktop to the command line switches. 258 | Fix debugger overlay arrow. 259 | Add `matlab-shell-run-region-or-line' command. 260 | 2004/03/19 1.4.6.14 eludlam 261 | Saved after merging with Amisc (1.4.2.10) 262 | Accepted job 12462 in Amisc 263 | 264 | Revision 1.4.6.14 2004/03/19 21:02:02 eludlam 265 | Saved after merging with Amisc (1.4.2.10) 266 | 267 | Revision 1.4.6.13 2004/03/19 20:59:56 eludlam 268 | Related Records: 210470 269 | Code Reviewer: Various 270 | Fix header comments. 271 | Fix XEmacs compatibility itimer start. 272 | Fix XEmacs overlay compatibility macros. 273 | Add if(false) next to if(0) special code. 274 | Add support for %{ %} block comments. 275 | Fix problem with Emacs Link when not in use, and add new config item. 276 | Add optional feature for automatically adding a semicolon when needed. 277 | Add variable for lines that don't need semicolons. 278 | Fix menu item for mlint to not require it. 279 | Add -nodesktop to the command line switches. 280 | Fix debugger overlay arrow. 281 | Add `matlab-shell-run-region-or-line' command. 282 | 283 | Revision 1.4.6.12 2004/03/11 13:42:54 eludlam 284 | Saved after merging with Amisc (1.4.2.9) 285 | 286 | Revision 1.4.6.11 2004/03/10 18:40:26 eludlam 287 | Related Records: 208705 288 | Code Reviewer: ciolfi 289 | Version number change to 2.3.2 290 | Fix comment for installatin. 291 | Fix matlab-end-of-command (patch from user.) 292 | Add mlint enable/disable to matlab menu. 293 | 294 | Revision 1.4.6.10 2003/07/15 16:49:31 eludlam 295 | Version number change. 296 | Added continue to keyword list. 297 | Added use contributed matlab-generate-latex command. 298 | Revision 1.4.2.9 2004/01/30 22:44:48 batserve 299 | 2004/01/28 1.4.4.9 batserve 300 | 2004/01/23 1.4.8.1 batserve 301 | 2004/01/13 1.4.2.8.2.1 mkarr 302 | Code Reviewer: elijah 303 | merged in changes 304 | 2004/01/20 1.4.2.8.2.2 mkarr 305 | Code Reviewer: Eric Ludlam 306 | Make filter buffer-local. 307 | Put in html "rendering" and other changes for 308 | new handling of source locations. 309 | 2004/01/22 1.4.2.8.2.3 mkarr 310 | Code Reviewer: Eric Ludlam 311 | Adapt to column positions in matlab-url. 312 | Accepted job 7543 in Akernel 313 | Accepted job 13127 in A 314 | Accepted job 11551 in Amisc 315 | Revision 1.4.2.10 2004/03/18 21:17:17 batserve 316 | 2004/03/14 1.4.4.10 batserve 317 | 2004/03/10 1.4.4.9.2.1 padman 318 | Saved after merging with 1.4.6.11 (dev_eludlam) 319 | Accepted job 14370 in A 320 | Accepted job 11967a in Amisc 321 | 322 | Revision 1.4.4.10 2004/03/14 15:30:34 batserve 323 | 2004/03/10 1.4.4.9.2.1 padman 324 | Saved after merging with 1.4.6.11 (dev_eludlam) 325 | Accepted job 14370 in A 326 | 327 | Revision 1.4.4.9.2.1 2004/03/10 20:30:27 padman 328 | Saved after merging with 1.4.6.11 (dev_eludlam) 329 | 330 | Revision 1.4.4.9 2004/01/28 23:06:13 batserve 331 | 2004/01/23 1.4.8.1 batserve 332 | 2004/01/13 1.4.2.8.2.1 mkarr 333 | Code Reviewer: elijah 334 | merged in changes 335 | 2004/01/20 1.4.2.8.2.2 mkarr 336 | Code Reviewer: Eric Ludlam 337 | Make filter buffer-local. 338 | Put in html "rendering" and other changes for 339 | new handling of source locations. 340 | 2004/01/22 1.4.2.8.2.3 mkarr 341 | Code Reviewer: Eric Ludlam 342 | Adapt to column positions in matlab-url. 343 | Accepted job 7543 in Akernel 344 | Accepted job 13127 in A 345 | 346 | Revision 1.4.8.2 2005/05/18 19:25:28 batserve 347 | 2005/05/02 1.4.4.11.2.1.2.1 mkarr 348 | Related Records: 231734 349 | Code Reviewer: Eric Ludlam 350 | Allow for html anchors when matching for debugger output. 351 | Indent line beginning with end according to beginning of block, 352 | not according to the indentation of the previous line. 353 | Respond to "matlab:" anchors (evaluate an M expression). 354 | Accepted job 12245 in Akernel 355 | 356 | Revision 1.4.4.11.2.1.2.1 2005/05/02 23:35:19 mkarr 357 | Related Records: 231734 358 | Code Reviewer: Eric Ludlam 359 | 360 | Allow for html anchors when matching for debugger output. 361 | Indent line beginning with end according to beginning of block, 362 | not according to the indentation of the previous line. 363 | Respond to "matlab:" anchors (evaluate an M expression). 364 | 365 | Revision 1.4.4.11.2.1 2005/01/23 18:39:17 batserve 366 | 2005/01/21 1.4.2.12.2.1 eludlam 367 | Related Records: 250151 368 | Code Reviewer: paulk 369 | Fix mlint dependency problem. 370 | Fix XEmacs compatibility problem. 371 | Add (behind option) experimental shell completion system. 372 | Add (behind comment) hideshow support. 373 | Accepted job 13342 in Ami 374 | 375 | Revision 1.4.2.12.2.1 2005/01/21 13:25:11 eludlam 376 | Related Records: 250151 377 | Code Reviewer: paulk 378 | Fix mlint dependency problem. 379 | Fix XEmacs compatibility problem. 380 | Add (behind option) experimental shell completion system. 381 | Add (behind comment) hideshow support. 382 | 383 | Revision 1.4.2.12 2004/06/16 03:10:04 batserve 384 | 2004/06/10 1.4.2.11.2.1 mkarr 385 | Related Records: 168455 386 | Code Reviewer: Ty Lightner, Eric Ludlam 387 | Changes to support nested functions. 388 | Accepted job 12607 in Amisc 389 | 390 | Revision 1.4.2.11.2.1 2004/06/10 13:47:15 mkarr 391 | Related Records: 168455 392 | Code Reviewer: Ty Lightner, Eric Ludlam 393 | 394 | Changes to support nested functions. 395 | 396 | Revision 1.4.2.11 2004/05/13 02:52:11 batserve 397 | 2004/03/11 1.4.6.12 eludlam 398 | Saved after merging with Amisc (1.4.2.9) 399 | 2004/03/19 1.4.6.13 eludlam 400 | Related Records: 210470 401 | Code Reviewer: Various 402 | Fix header comments. 403 | Fix XEmacs compatibility itimer start. 404 | Fix XEmacs overlay compatibility macros. 405 | Add if(false) next to if(0) special code. 406 | Add support for %{ %} block comments. 407 | Fix problem with Emacs Link when not in use, and add new config item. 408 | Add optional feature for automatically adding a semicolon when needed. 409 | Add variable for lines that don't need semicolons. 410 | Fix menu item for mlint to not require it. 411 | Add -nodesktop to the command line switches. 412 | Fix debugger overlay arrow. 413 | Add `matlab-shell-run-region-or-line' command. 414 | 2004/03/19 1.4.6.14 eludlam 415 | Saved after merging with Amisc (1.4.2.10) 416 | Accepted job 12462 in Amisc 417 | 418 | Revision 1.4.6.14 2004/03/19 21:02:02 eludlam 419 | Saved after merging with Amisc (1.4.2.10) 420 | 421 | Revision 1.4.6.13 2004/03/19 20:59:56 eludlam 422 | Related Records: 210470 423 | Code Reviewer: Various 424 | Fix header comments. 425 | Fix XEmacs compatibility itimer start. 426 | Fix XEmacs overlay compatibility macros. 427 | Add if(false) next to if(0) special code. 428 | Add support for %{ %} block comments. 429 | Fix problem with Emacs Link when not in use, and add new config item. 430 | Add optional feature for automatically adding a semicolon when needed. 431 | Add variable for lines that don't need semicolons. 432 | Fix menu item for mlint to not require it. 433 | Add -nodesktop to the command line switches. 434 | Fix debugger overlay arrow. 435 | Add `matlab-shell-run-region-or-line' command. 436 | 437 | Revision 1.4.6.12 2004/03/11 13:42:54 eludlam 438 | Saved after merging with Amisc (1.4.2.9) 439 | 440 | Revision 1.4.6.11 2004/03/10 18:40:26 eludlam 441 | Related Records: 208705 442 | Code Reviewer: ciolfi 443 | Version number change to 2.3.2 444 | Fix comment for installatin. 445 | Fix matlab-end-of-command (patch from user.) 446 | Add mlint enable/disable to matlab menu. 447 | 448 | Revision 1.4.6.10 2003/07/15 16:49:31 eludlam 449 | Version number change. 450 | Added continue to keyword list. 451 | Added use contributed matlab-generate-latex command. 452 | Revision 1.4.2.9 2004/01/30 22:44:48 batserve 453 | 2004/01/28 1.4.4.9 batserve 454 | 2004/01/23 1.4.8.1 batserve 455 | 2004/01/13 1.4.2.8.2.1 mkarr 456 | Code Reviewer: elijah 457 | merged in changes 458 | 2004/01/20 1.4.2.8.2.2 mkarr 459 | Code Reviewer: Eric Ludlam 460 | Make filter buffer-local. 461 | Put in html "rendering" and other changes for 462 | new handling of source locations. 463 | 2004/01/22 1.4.2.8.2.3 mkarr 464 | Code Reviewer: Eric Ludlam 465 | Adapt to column positions in matlab-url. 466 | Accepted job 7543 in Akernel 467 | Accepted job 13127 in A 468 | Accepted job 11551 in Amisc 469 | Revision 1.4.2.10 2004/03/18 21:17:17 batserve 470 | 2004/03/14 1.4.4.10 batserve 471 | 2004/03/10 1.4.4.9.2.1 padman 472 | Saved after merging with 1.4.6.11 (dev_eludlam) 473 | Accepted job 14370 in A 474 | Accepted job 11967a in Amisc 475 | 476 | Revision 1.4.4.10 2004/03/14 15:30:34 batserve 477 | 2004/03/10 1.4.4.9.2.1 padman 478 | Saved after merging with 1.4.6.11 (dev_eludlam) 479 | Accepted job 14370 in A 480 | 481 | Revision 1.4.4.9.2.1 2004/03/10 20:30:27 padman 482 | Saved after merging with 1.4.6.11 (dev_eludlam) 483 | 484 | Revision 1.4.4.9 2004/01/28 23:06:13 batserve 485 | 2004/01/23 1.4.8.1 batserve 486 | 2004/01/13 1.4.2.8.2.1 mkarr 487 | Code Reviewer: elijah 488 | merged in changes 489 | 2004/01/20 1.4.2.8.2.2 mkarr 490 | Code Reviewer: Eric Ludlam 491 | Make filter buffer-local. 492 | Put in html "rendering" and other changes for 493 | new handling of source locations. 494 | 2004/01/22 1.4.2.8.2.3 mkarr 495 | Code Reviewer: Eric Ludlam 496 | Adapt to column positions in matlab-url. 497 | Accepted job 7543 in Akernel 498 | Accepted job 13127 in A 499 | 500 | Revision 1.4.8.1 2004/01/23 20:35:05 batserve 501 | 2004/01/13 1.4.2.8.2.1 mkarr 502 | Code Reviewer: elijah 503 | merged in changes 504 | 2004/01/20 1.4.2.8.2.2 mkarr 505 | Code Reviewer: Eric Ludlam 506 | Make filter buffer-local. 507 | Put in html "rendering" and other changes for 508 | new handling of source locations. 509 | 2004/01/22 1.4.2.8.2.3 mkarr 510 | Code Reviewer: Eric Ludlam 511 | Adapt to column positions in matlab-url. 512 | Accepted job 7543 in Akernel 513 | 514 | Revision 1.4.2.8.2.3 2004/01/22 16:42:39 mkarr 515 | Code Reviewer: Eric Ludlam 516 | Adapt to column positions in matlab-url. 517 | 518 | Revision 1.4.2.8.2.2 2004/01/20 22:31:16 mkarr 519 | Code Reviewer: Eric Ludlam 520 | Make filter buffer-local. 521 | Put in html "rendering" and other changes for 522 | new handling of source locations. 523 | 524 | Revision 1.4.4.8 2003/05/08 19:45:08 batserve 525 | 2003/04/29 1.4.2.8 batserve 526 | 2003/04/28 1.4.6.9 eludlam 527 | Doc comment update (New file exchange link, matlab shell switches) 528 | Font lock of pragmas 529 | Whitespace mode support. 530 | Accepted job 7691 in Amisc 531 | Accepted job 6970 in A 532 | 533 | Revision 1.4.2.8 2003/04/29 22:45:52 batserve 534 | 2003/04/28 1.4.6.9 eludlam 535 | Doc comment update (New file exchange link, matlab shell switches) 536 | Font lock of pragmas 537 | Whitespace mode support. 538 | Accepted job 7691 in Amisc 539 | 540 | Revision 1.4.6.11 2004/03/10 18:40:26 eludlam 541 | Related Records: 208705 542 | Code Reviewer: ciolfi 543 | Version number change to 2.3.2 544 | Fix comment for installatin. 545 | Fix matlab-end-of-command (patch from user.) 546 | Add mlint enable/disable to matlab menu. 547 | 548 | Revision 1.4.6.10 2003/07/15 16:49:31 eludlam 549 | Version number change. 550 | Added continue to keyword list. 551 | Added use contributed matlab-generate-latex command. 552 | 553 | Revision 1.4.6.9 2003/04/28 13:38:38 eludlam 554 | Doc comment update (New file exchange link, matlab shell switches) 555 | Font lock of pragmas 556 | Whitespace mode support. 557 | 558 | Revision 1.4.6.8 2003/02/19 19:52:11 eludlam 559 | Exclude block verify from save hooks. 560 | Fixed if statement regexp for unreachable code. 561 | Add persistent as a keyword. 562 | 563 | Revision 1.4.6.7 2003/01/06 16:04:51 eludlam 564 | Fill paragraph: Fix to handle comment at end of buffer. 565 | matlab-shell: Fix where kill-local-variables is called. 566 | 567 | Revision 1.4.6.6 2002/10/23 14:56:42 eludlam 568 | Code Reviewer: eludlam 569 | User patch for finding the symbol at point. 570 | 571 | Revision 1.4.6.5 2002/10/03 18:55:27 eludlam 572 | Fix XEmacs itimer issue with block highlighting. 573 | Yoni Wexler contributed patch for indented tic/toc. 574 | Block highlighting tic/toc. 575 | font lock for tic toc. 576 | 577 | Revision 1.4.6.4 2002/09/27 13:31:22 eludlam 578 | Release Version 2.3. 579 | Removed LCD archive entry. 580 | 581 | Revision 1.4.6.3 2002/09/12 13:01:36 eludlam 582 | Added support for matlab-shell reading matlab's history. 583 | Patch originally posted to cssm. 584 | 585 | Revision 1.4.6.2 2002/08/08 18:23:24 eludlam 586 | User patch converts `matlab-shell-command-switches' to a list. 587 | 588 | Revision 1.4.6.1 2002/06/11 18:59:17 eludlam 589 | Fix block highlight matching for timer buffer switch case. 590 | 591 | Revision 1.4 2002/05/08 03:29:39 batserve 592 | Correct docstring to say that future versions of MATLAB may 593 | not require ellipses. 594 | Related Records: 131353 595 | Code Reviewer: eludlam 596 | 597 | Revision 1.4 2002/05/07 20:39:36 paulk 598 | Correct docstring to say that future versions of MATLAB may 599 | not require ellipses. 600 | Related Records: 131353 601 | Code Reviewer: eludlam 602 | 603 | Revision 1.3 2002/05/07 16:44:18 paulk 604 | - Support implied continuation (off by default) 605 | - Add a key binding for find-file-on-path to matlab-shell-mode 606 | - fix banner 607 | - Fix save-and-go to work in unsaved new buffers 608 | Related Records: 131353 609 | Code Reviewer: eludlam 610 | 611 | Revision 1.2 2002/03/20 18:35:20 paulk 612 | Add a patch to matlab-mode from Eric Ludlam to support student edition. 613 | Related Records: 124543 614 | Code Reviewer: eludlam 615 | 616 | Revision 1.1 2002/02/06 20:43:50 paulk 617 | Initial revision 618 | 619 | Revision 1.3 2001/09/07 16:44:38 paulk 620 | Changed "Mathworks" to "MathWorks" and "Matlab" to "MATLAB"? 621 | Related Records: 107855 622 | 623 | Revision 1.2 2001/09/06 16:41:39 paulk 624 | save-and-go and run-region now invoke their eei 625 | equivalents when eei is active. 626 | Related Records: 99176 627 | Code Reviewer: eludlam 628 | 629 | Revision 1.1 2001/08/31 20:45:51 paulk 630 | Initial revision 631 | -------------------------------------------------------------------------------- /mlint.el: -------------------------------------------------------------------------------- 1 | ;;; mlint.el --- run mlint in a MATLAB buffer 2 | 3 | ;; Author: Eric M. Ludlam 4 | ;; Maintainer: Eric M. Ludlam 5 | ;; Created: June 25, 2002 6 | ;; Version: 7 | 8 | (defvar mlint-version "1.3.1" 9 | "The current version of mlint minor mode.") 10 | 11 | ;; Copyright (C) 2002-2005 The MathWorks Inc. 12 | ;; 13 | ;; This program is free software; you can redistribute it and/or modify 14 | ;; it under the terms of the GNU General Public License as published by 15 | ;; the Free Software Foundation; either version 2, or (at your option) 16 | ;; any later version. 17 | ;; 18 | ;; This program is distributed in the hope that it will be useful, 19 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | ;; GNU General Public License for more details. 22 | ;; 23 | ;; You should have received a copy of the GNU General Public License 24 | ;; along with GNU Emacs; see the file COPYING. If not, write to 25 | ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 26 | 27 | ;;; Commentary: 28 | ;; 29 | ;; Run mlint, and highlight the problems in the buffer. 30 | ;; 31 | 32 | (require 'matlab) 33 | (require 'linemark) 34 | 35 | ;;; Code: 36 | (defvar mlint-platform 37 | ;; xxx which matlab 38 | ;; MATLABROOT/bin/util/arch.sh (or arch.bat) 39 | (cond ((eq system-type 'darwin) 40 | (if (string-match "i386" system-configuration) 41 | (let ((mt (getenv "MACHTYPE"))) 42 | (if (and (stringp mt) (string= "x86_32" mt)) 43 | ;; This hack is bad since an Emacs started from 44 | ;; the doc doesn't have this variable, thus by defaulting 45 | ;; to checking the 32 bit (not common anymore) version, 46 | ;; we'll get the right answer most of the time. 47 | "maci" "maci64")) 48 | "mac")) 49 | ((eq system-type 'gnu/linux) 50 | (cond ((string-match "64\\|i686" system-configuration) 51 | "glnxa64") 52 | (t "glnx86"))) 53 | ((eq system-type 'solaris) 54 | "sol2") 55 | ((eq system-type 'hpux) 56 | "hpux") 57 | ((eq system-type 'windows-nt) 58 | ;; Thought about checking the env PROCESSOR_ARCHITEW6432, 59 | ;; but this said AMD on my Intel, which seemed suspicious. 60 | (let ((proc (getenv "PROCESSOR_IDENTIFIER"))) 61 | (if (and (stringp proc) (string-match "64" proc)) 62 | "win64" 63 | "win32"))) 64 | (t "unknown")) 65 | "Platform we are running mlint on.") 66 | 67 | (defcustom mlint-calculate-cyclic-complexity-flag nil 68 | "*Non-nil means to collect cyclic complexity values." 69 | :group 'mlint 70 | :type 'boolean) 71 | 72 | (defvar mlint-symtab-info nil 73 | "Symbol Table collected from highlighting cross function variables. 74 | Each entry in the symtab is at an index indicating the line it occurs on. 75 | Each entry is of the form: 76 | ( \"FUNCTION-NAME\" PARENT-IDX ( LINENO . COLNO ) ...) 77 | and ... is a list of cross-function variable usages.") 78 | (make-variable-buffer-local 'mlint-symtab-info) 79 | 80 | (defun mlint-programs-set-fcn (&optional symbol value) 81 | "The :set function for `matlab-programs'. 82 | SYMBOL is the variable being set. VALUE is the new value." 83 | (condition-case nil 84 | (custom-set-default symbol value) 85 | (error (set symbol value))) 86 | (mlint-reset-program)) 87 | 88 | (defvar mlint-program-selection-fcn nil 89 | "Function use to specify the `mlint-program' for the current buffer.") 90 | 91 | (defvar mlint-program nil 92 | "Program to run for MLint. 93 | This value can be automatically set by `mlint-programs'.") 94 | 95 | (defun mlint-reset-program () 96 | "Reset `mlint-program'." 97 | (setq mlint-program 98 | (let ((mlp mlint-programs) 99 | (ans nil)) 100 | (while (and mlp (not ans)) 101 | (cond ((null (car mlp)) 102 | nil) 103 | ((file-executable-p (car mlp)) 104 | (setq ans (car mlp))) 105 | ((executable-find (car mlp)) 106 | (setq ans (executable-find (car mlp)))) 107 | (t nil)) 108 | (setq mlp (cdr mlp))) 109 | ans))) 110 | 111 | (defcustom mlint-programs (list 112 | "mlint" 113 | (concat mlint-platform "/mlint")) 114 | "*List of possible locations of the mlint program." 115 | :group 'mlint 116 | :type '(repeat (file :tag "MLint Program: ")) 117 | :set 'mlint-programs-set-fcn) 118 | 119 | (defcustom mlint-flags '("-all" "-id") ; "-fix") % Need to support this output 120 | "*List of flags passed to mlint." 121 | :group 'mlint 122 | :type '(repeat (string :tag "Option: "))) 123 | 124 | (defconst mlint-output-regex 125 | "^L \\([0-9]+\\) (C \\([-0-9]+\\)): \\(\\w+\\): \\([^\n]+\\)" 126 | "Regular expression for collecting mlint output.") 127 | 128 | (defconst mlint-symtab-line-regex 129 | ;; serial number name parent 130 | (concat "^ *\\([0-9]+\\) +\\([a-zA-Z0-9_]+\\) +\\([0-9]+\\)" 131 | ;; cross-function variable function-line function-column 132 | " +\\(V +CH\\(Set\\|Used\\).*\\|F.* \\([0-9]+\\)/\\([0-9]+\\)\\)$") 133 | "Regular expression for mlint symbol table line.") 134 | 135 | (defcustom mlint-verbose nil 136 | "*Non nil if command `mlint-minor-mode' should display messages while running." 137 | :group 'mlint 138 | :type 'boolean) 139 | 140 | (defcustom mlint-scan-for-fixes-flag t 141 | "Non-nil means that we should scan mlint output for things to fix. 142 | Scanning using `mlint-error-fix-alist' can slow things down, and may 143 | be cause for being turned off in a buffer." 144 | :group 'mlint 145 | :type 'boolean) 146 | (make-variable-buffer-local 'mlint-scan-for-fixes-flag) 147 | 148 | (defvar mlint-error-id-fix-alist 149 | '( 150 | ( AND2 . mlint-lm-entry-logicals) 151 | ( OR2 . mlint-lm-entry-logicals) 152 | ( INUSD . mlint-lm-entry-unused-argument ) 153 | ( NOPRT . mlint-lm-quiet ) 154 | ( NOSEM . mlint-lm-delete-focus ) 155 | ( NOCOM . mlint-lm-delete-focus ) 156 | ( ST2NM . mlint-lm-str2num ) 157 | ( FDEPR . mlint-lm-entry-depricated ) 158 | ) 159 | "List of warning IDs and auto-fix functions. 160 | If the CAR of an association matches an error id then the linemark entry 161 | created is of the class in CDR.") 162 | 163 | (defun mlint-column-output (string) 164 | "Convert the mlint column output to a cons pair. 165 | \(COLSTART . COLEND). 166 | Argument STRING is the text to interpret." 167 | (save-match-data 168 | (if (string-match "\\([0-9]+\\)-\\([0-9]+\\)" string) 169 | (cons (string-to-int (match-string 1 string)) 170 | (string-to-int (match-string 2 string))) 171 | (let ((i (string-to-int string))) 172 | (cons i i))))) 173 | 174 | (defun mlint-run (&optional buffer) 175 | "Run mlint on BUFFER and return a list of issues. 176 | If BUFFER is nil, use the current buffer." 177 | (when (and (file-exists-p (buffer-file-name)) mlint-program) 178 | (let* ((fn (buffer-file-name (current-buffer))) 179 | (buffer-mlint-program mlint-program) 180 | (dd default-directory) 181 | (show-mlint-warnings matlab-show-mlint-warnings) 182 | (highlight-cross-function-variables 183 | (and matlab-functions-have-end 184 | matlab-highlight-cross-function-variables)) 185 | (flags (let ((tmp (if matlab-show-mlint-warnings mlint-flags nil))) 186 | (setq tmp 187 | (if highlight-cross-function-variables 188 | (cons "-edit" tmp) 189 | tmp)) 190 | (setq tmp 191 | (if mlint-calculate-cyclic-complexity-flag 192 | (cons "-cyc" tmp) 193 | tmp)) 194 | tmp)) 195 | (errors nil) 196 | (n nil) 197 | (symtab nil)) 198 | (save-excursion 199 | (set-buffer (get-buffer-create "*M-Lint*")) 200 | (erase-buffer) 201 | (when mlint-verbose (message "Running mlint...")) 202 | 203 | (apply 'call-process buffer-mlint-program nil (current-buffer) nil 204 | (append flags (list fn))) 205 | 206 | (when mlint-verbose (message "Running mlint...done")) 207 | (goto-char (point-min)) 208 | (when highlight-cross-function-variables 209 | (when (not (re-search-forward mlint-output-regex nil t)) 210 | (goto-char (point-max))) 211 | (when (re-search-backward "^ *\\([0-9]+\\)" nil t) 212 | (goto-char (point-min)) 213 | (setq n (1+ (string-to-int (match-string 1)))) 214 | (setq symtab (make-vector n nil)) 215 | (while (re-search-forward mlint-symtab-line-regex nil t) 216 | (let ((name (match-string 2)) 217 | (parent-index (string-to-int (match-string 3))) 218 | (column (match-string 7))) 219 | (if column ;; line defines a function 220 | (aset symtab (string-to-int (match-string 1)) 221 | (list name 222 | (when (/= parent-index 0) parent-index) 223 | (cons (string-to-int (match-string 6)) 224 | (string-to-int column)))) 225 | (let ((parent (cddr (aref symtab parent-index)))) 226 | (if parent 227 | (rplacd parent (cons name (cdr parent)))))))))) 228 | (when show-mlint-warnings 229 | (while (re-search-forward mlint-output-regex nil t) 230 | (setq errors (cons 231 | (list (string-to-int (match-string 1)) 232 | (mlint-column-output (match-string 2)) 233 | (match-string 4) 234 | "" ; this was the warning code (level) 235 | (match-string 3) 236 | ) 237 | errors)))) 238 | ) 239 | (mlint-clear-nested-function-info-overlays) 240 | (setq mlint-symtab-info symtab) 241 | (when (and highlight-cross-function-variables (integerp n)) 242 | ;; Then set up new overlays for cross-function variables 243 | ;; and nested functions. 244 | (save-excursion 245 | (while (> n 0) 246 | (setq n (1- n)) 247 | (let ((entry (aref mlint-symtab-info n))) 248 | (if entry 249 | (let ((where (caddr entry))) 250 | (goto-line (car where)) 251 | (forward-char (1- (cdr where))) 252 | (re-search-backward "function\\b") 253 | (setq where (point)) 254 | (matlab-forward-sexp) 255 | (if (cadr entry) ; nested 256 | (linemark-overlay-put 257 | (linemark-make-overlay where (point)) 258 | 'nested-function t)) 259 | (if (cdddr entry) 260 | (linemark-overlay-put 261 | (linemark-make-overlay where (point)) 262 | 'cross-function-variables 263 | (concat 264 | "\\b\\(" 265 | (mapconcat '(lambda (x) x) (cdddr entry) "\\|") 266 | "\\)\\b"))))))))) 267 | errors 268 | ))) 269 | 270 | (defclass mlint-lm-group (linemark-group) 271 | () 272 | "Group of linemarks for mlint.") 273 | 274 | (defclass mlint-lm-entry (linemark-entry) 275 | ((column :initarg :column 276 | :type integer 277 | :documentation 278 | "The column on which the warning occurs.") 279 | (column-end :initarg :column-end 280 | :type integer 281 | :documentation 282 | "The column on which the warning ends.") 283 | (coverlay :type linemark-overlay 284 | :documentation 285 | "Overlay used for the specific part of the line at issue.") 286 | (warning :initarg :warning 287 | :type string 288 | :documentation 289 | "The error message created by mlint on this line.") 290 | (warningid :initarg :warningid 291 | :type symbol 292 | :documentation 293 | "The error id provided by mlint. 294 | Warning ID's won't change between releases, unlike the warning messages.") 295 | (warningcode :initarg :warningcode 296 | :type symbol 297 | :initform 'minor 298 | :documentation 299 | "mlint return code for this type of warning.") 300 | (fixable-p :initform nil 301 | :allocation :class 302 | :type boolean 303 | :documentation 304 | "Can this class auto-fix the problem?") 305 | (fix-description :initform nil 306 | :allocation :class 307 | :type (or string null) 308 | :documentation 309 | "Description of how the fix will effect the buffer.") 310 | ) 311 | "A linemark entry.") 312 | 313 | (defun mlint-linemark-create-group () 314 | "Create a group object for tracking linemark entries. 315 | Do not permit multiple groups with the same name." 316 | (let* ((name "mlint") 317 | (newgroup (mlint-lm-group name :face 'linemark-go-face)) 318 | (foundgroup nil) 319 | (lmg linemark-groups)) 320 | (while (and (not foundgroup) lmg) 321 | (if (string= name (object-name-string (car lmg))) 322 | (setq foundgroup (car lmg))) 323 | (setq lmg (cdr lmg))) 324 | (if foundgroup 325 | (setq newgroup foundgroup) 326 | (setq linemark-groups (cons newgroup linemark-groups)) 327 | newgroup))) 328 | 329 | (defvar mlint-mark-group (mlint-linemark-create-group) 330 | "Group of marked lines for mlint.") 331 | 332 | (defun mlint-warningid->class (warningid) 333 | "For a given WARNINGID, return a class for that warning. 334 | Different warnings are handled by different classes." 335 | (if mlint-scan-for-fixes-flag 336 | (let ((al mlint-error-id-fix-alist)) 337 | (while (and al 338 | (not (eq (car (car al)) warningid)) 339 | ) 340 | (setq al (cdr al))) 341 | (or (cdr (car al)) 'mlint-lm-entry)) 342 | 'mlint-lm-entry)) 343 | 344 | (defmethod linemark-new-entry ((g mlint-lm-group) &rest args) 345 | "Add a `linemark-entry' to G. 346 | It will be at location FILE and LINE, and use optional FACE. 347 | Call the new entrie's activate method." 348 | (let* ((f (plist-get args :filename)) 349 | (l (plist-get args :line)) 350 | (wc (plist-get args :warningcode)) 351 | (c (mlint-warningid->class (plist-get args :warningid))) 352 | ) 353 | (when (stringp f) (setq f (file-name-nondirectory f))) 354 | (apply c (format "%s %d" f l) args) 355 | )) 356 | 357 | (defun mlint-end-of-something () 358 | "Move cursor to the end of whatever the cursor is on." 359 | (cond ((looking-at "\\w\\|\\s(") 360 | (forward-sexp 1)) 361 | ((looking-at "\\s.") 362 | (skip-syntax-forward ".")) 363 | (t (error nil)))) 364 | 365 | (defmethod linemark-display ((e mlint-lm-entry) active-p) 366 | "Set object E to be active." 367 | ;; A bug in linemark prevents individual entry colors. 368 | ;; Fix the color here. 369 | (let ((wc (oref e warningcode))) 370 | (oset e :face 371 | (cond ((eq wc 'major) 'linemark-stop-face) 372 | ((eq wc 'medium) 'linemark-caution-face) 373 | (t 'linemark-go-face)))) 374 | ;; Call our parent method 375 | (call-next-method) 376 | ;; Add highlight area 377 | (if active-p 378 | (when (and (not (slot-boundp e 'coverlay)) 379 | (slot-boundp e 'overlay) 380 | (oref e overlay)) 381 | (with-slots (overlay column column-end warning) e 382 | (let ((warntxt 383 | (if (mlint-is-fixable e) 384 | (concat warning "\nC-c , f to " 385 | (oref e fix-description)) 386 | warning))) 387 | ;; We called super first, so this should be an active overlay. 388 | (linemark-overlay-put overlay 'local-map mlint-overlay-map) 389 | (linemark-overlay-put overlay 'help-echo warntxt) 390 | ;; Now, if we have some column data, lets put more highlighting on. 391 | (save-excursion 392 | (set-buffer (linemark-overlay-buffer overlay)) 393 | (goto-char (linemark-overlay-start overlay)) 394 | (condition-case nil 395 | (forward-char (1- column)) 396 | ;;(move-to-column (1- column)) 397 | (error nil)) 398 | (oset e coverlay (linemark-make-overlay 399 | (point) 400 | (progn 401 | (beginning-of-line) 402 | (forward-char column-end) 403 | ;(move-to-column column-end) 404 | (point)) 405 | (current-buffer))) 406 | (with-slots (coverlay) e 407 | (linemark-overlay-put coverlay 'face 'linemark-funny-face) 408 | (linemark-overlay-put coverlay 'obj e) 409 | (linemark-overlay-put coverlay 'tag 'mlint) 410 | (linemark-overlay-put coverlay 'help-echo warntxt) 411 | ) 412 | )))) 413 | ;; Delete our spare overlay 414 | (when (slot-boundp e 'coverlay) 415 | (with-slots (coverlay) e 416 | (when coverlay 417 | (condition-case nil 418 | (linemark-delete-overlay coverlay) 419 | (error nil)) 420 | (slot-makeunbound e 'coverlay))) 421 | ))) 422 | 423 | (defmethod mlint-is-fixable ((e mlint-lm-entry)) 424 | "Return non-nil if this entry can be automatically fixed." 425 | (oref-default e fixable-p)) 426 | 427 | (defmethod mlint-fix-entry :AFTER ((e mlint-lm-entry)) 428 | "Stuff to do after a warning is considered fixed. 429 | Subclasses fulfill the duty of actually fixing the code." 430 | (linemark-display e nil) 431 | (linemark-delete e)) 432 | 433 | (defmethod mlint-fix-entry ((e mlint-lm-entry)) 434 | "This entry cannot fix warnings, so throw an error. 435 | Subclasses fulfill the duty of actually fixing the code." 436 | (error "Don't know how to fix warning")) 437 | 438 | ;;; Specialized classes 439 | ;; 440 | 441 | (defclass mlint-lm-delete-focus (mlint-lm-entry) 442 | ((fixable-p :initform t) 443 | (fix-description :initform "Delete the offending characters.") 444 | ) 445 | "Specialized entry for deleting the higlighted entry.") 446 | 447 | (defmethod mlint-fix-entry ((ent mlint-lm-delete-focus)) 448 | "Add semi-colon to end of this line." 449 | (save-excursion 450 | (goto-line (oref ent line)) 451 | (let* ((s (progn (move-to-column (1- (oref ent column))) (point))) 452 | (e (progn (move-to-column (oref ent column-end)) (point))) 453 | ) 454 | (goto-char s) 455 | (delete-region (point) e) 456 | (point) 457 | )) 458 | ) 459 | 460 | (defclass mlint-lm-replace-focus (mlint-lm-delete-focus) 461 | ((fix-description :initform "Replace the offending symbol with ") 462 | (new-text :initform "") 463 | ) 464 | "Class which can replace the focus area." 465 | :abstract t) 466 | 467 | (defmethod initialize-instance :AFTER ((this mlint-lm-replace-focus) 468 | &rest fields) 469 | "Calculate the new fix description for THIS. 470 | Optional argument FIELDS are the initialization arguments." 471 | ;; After basic initialization, update the fix description. 472 | (oset this fix-description (concat (oref mlint-lm-replace-focus fix-description) 473 | (oref this new-text)))) 474 | 475 | (defmethod mlint-fix-entry ((ent mlint-lm-replace-focus)) 476 | "Replace the focus area with :new-text" 477 | (let ((pos (call-next-method))) 478 | (save-excursion 479 | (goto-char (point)) 480 | (insert (oref ent new-text))))) 481 | 482 | (defclass mlint-lm-str2num (mlint-lm-replace-focus) 483 | ((new-text :initform "str2double")) 484 | "Replace str2num with str2double") 485 | 486 | (defclass mlint-lm-entry-depricated (mlint-lm-replace-focus) 487 | () 488 | "Entry for anything that is depricated. 489 | Extracts the replacement for the depricated symbol from the warning message.") 490 | 491 | (defmethod initialize-instance :AFTER ((this mlint-lm-entry-depricated) 492 | &rest fields) 493 | "Calculate the 'new text' for THIS instance. 494 | Optional argument FIELDS are the initialization arguments." 495 | ;; After basic initialization, update the new text field. 496 | (let* ((warn (oref this warning)) 497 | (junk (string-match "Use \\(\\w+\\) instead" warn)) 498 | (newfcn (when junk (downcase (substring warn (match-beginning 1) (match-end 1)))))) 499 | (oset this new-text newfcn) 500 | ;; After basic initialization, update the fix description. 501 | (oset this fix-description (concat (oref mlint-lm-replace-focus fix-description) 502 | newfcn)) 503 | )) 504 | 505 | (defclass mlint-lm-entry-logicals (mlint-lm-entry) 506 | ((fixable-p :initform t) 507 | (fix-description :initform "perform a replacement.") 508 | ) 509 | "Specialized logical and/or class.") 510 | 511 | (defmethod mlint-fix-entry ((ent mlint-lm-entry-logicals)) 512 | "Replace the single logical with double logical." 513 | (save-excursion 514 | (goto-line (oref ent line)) 515 | (let* ((s (progn (move-to-column (1- (oref ent column))) (point))) 516 | (e (progn (move-to-column (oref ent column-end)) (point))) 517 | (txt (buffer-substring-no-properties s e))) 518 | (goto-char s) 519 | ;; All of these are replacing single logicals with double. 520 | (insert txt))) 521 | ) 522 | 523 | (defclass mlint-lm-entry-unused-argument (mlint-lm-entry) 524 | ((fixable-p :initform t) 525 | (fix-description :initform "remove this argument.") 526 | ) 527 | "Specialized logical and/or class.") 528 | 529 | (defmethod mlint-fix-entry ((ent mlint-lm-entry-unused-argument)) 530 | "Remove the arguments." 531 | (save-excursion 532 | (goto-line (oref ent line)) 533 | (let* ((s (progn (move-to-column (1- (oref ent column))) (point))) 534 | (e (progn (move-to-column (oref ent column-end)) (point))) 535 | ) 536 | (goto-char s) 537 | (if (not (looking-at "(\\|,")) 538 | (forward-char -1)) 539 | (delete-region (point) e) 540 | )) 541 | ) 542 | 543 | (defclass mlint-lm-quiet (mlint-lm-entry) 544 | ((fixable-p :initform t) 545 | (fix-description :initform "Make sure this line prints no values.") 546 | ) 547 | "Specialized logical and/or class.") 548 | 549 | 550 | (defmethod mlint-fix-entry ((ent mlint-lm-quiet)) 551 | "Add semi-colon to end of this line." 552 | (save-excursion 553 | (matlab-end-of-command) 554 | (insert ";")) 555 | ) 556 | 557 | ;;; User functions 558 | ;; 559 | (defun mlint-highlight (err) 560 | "Setup ERR, an mlint message to be marked." 561 | (linemark-add-entry mlint-mark-group 562 | :line (nth 0 err) 563 | :column (car (nth 1 err)) 564 | :column-end (cdr (nth 1 err)) 565 | :warning (nth 2 err) 566 | ;; Old style did this lookup, but new versins of 567 | ;; MLint replace the warning code with a warning 568 | ;; ID which can instead be used for auto-fix. In addition, 569 | ;; just use the default warning code. 570 | 571 | ;;:warningcode 'minor 572 | ;; (cdr (assoc (nth 3 err) mlint-warningcode-alist)) 573 | :warningid (intern (nth 4 err)) 574 | )) 575 | 576 | (defun mlint-clear-warnings () 577 | "Unhighlight all existing mlint warnings." 578 | (interactive) 579 | (mapcar (lambda (e) 580 | (if (string= (oref e filename) (buffer-file-name)) 581 | (linemark-delete e))) 582 | (oref mlint-mark-group marks)) 583 | (if (and (boundp 'global-font-lock-mode) global-font-lock-mode 584 | (not font-lock-mode)) 585 | (font-lock-fontify-buffer))) 586 | 587 | (defun mlint-clear-nested-function-info-overlays () 588 | "Clear out any previous overlays with nested function information. 589 | This includes nested-function and cross-function-variables." 590 | (let ((overlays (linemark-overlays-in (point-min) (point-max)))) 591 | (while overlays 592 | (let* ((overlay (car overlays))) 593 | (if (or (linemark-overlay-get overlay 'cross-function-variables) 594 | (linemark-overlay-get overlay 'nested-function)) 595 | (linemark-delete-overlay overlay))) 596 | (setq overlays (cdr overlays))))) 597 | 598 | (defun mlint-clear-cross-function-variable-highlighting () 599 | "Remove cross-function-variable overalys and re-fontify buffer." 600 | (mlint-clear-nested-function-info-overlays) 601 | (if (and (boundp 'global-font-lock-mode) global-font-lock-mode 602 | (not font-lock-mode)) 603 | (font-lock-fontify-buffer))) 604 | 605 | (defun mlint-buffer () 606 | "Run mlint on the current buffer. 607 | Highlight problems and/or cross-function variables." 608 | (interactive) 609 | (when (and (buffer-file-name) mlint-program) 610 | (if (and (buffer-modified-p) 611 | (y-or-n-p (format "Save %s before linting? " 612 | (file-name-nondirectory (buffer-file-name))))) 613 | (save-buffer)) 614 | (let ((errs (mlint-run)) 615 | ) 616 | (mlint-clear-warnings) 617 | (while errs 618 | (mlint-highlight (car errs)) 619 | (setq errs (cdr errs)))))) 620 | 621 | (defun mlint-next-buffer () 622 | "Move to the next warning in this buffer." 623 | (interactive) 624 | (let ((n (linemark-next-in-buffer mlint-mark-group 1 t))) 625 | (if n 626 | (progn (goto-line (oref n line)) 627 | (message (oref n warning))) 628 | (ding)))) 629 | 630 | (defun mlint-prev-buffer () 631 | "Move to the prev warning in this buffer." 632 | (interactive) 633 | (let ((n (linemark-next-in-buffer mlint-mark-group -1 t))) 634 | (if n 635 | (progn (goto-line (oref n line)) 636 | (message (oref n warning))) 637 | (ding)))) 638 | 639 | (defun mlint-next-buffer-new () 640 | "Move to the next new warning in this buffer." 641 | (interactive) 642 | (let ((p (linemark-at-point (point) mlint-mark-group)) 643 | (n (linemark-next-in-buffer mlint-mark-group 1 t))) 644 | ;; Skip over messages that are the same as the one under point. 645 | (save-excursion 646 | (while (and n p (not (eq n p)) 647 | (string= (oref p warning) (oref n warning))) 648 | (goto-line (oref n line)) 649 | (setq n (linemark-next-in-buffer mlint-mark-group 1 t)))) 650 | (if n 651 | (progn (goto-line (oref n line)) 652 | (message (oref n warning))) 653 | (ding)))) 654 | 655 | (defun mlint-prev-buffer-new () 656 | "Move to the prev new warning in this buffer." 657 | (interactive) 658 | (let ((p (linemark-at-point (point) mlint-mark-group)) 659 | (n (linemark-next-in-buffer mlint-mark-group -1 t))) 660 | ;; Skip over messages that are the same as the one under point. 661 | (save-excursion 662 | (while (and n p (not (eq n p)) 663 | (string= (oref p warning) (oref n warning))) 664 | (goto-line (oref n line)) 665 | (setq n (linemark-next-in-buffer mlint-mark-group -1 t)))) 666 | (if n 667 | (progn (goto-line (oref n line)) 668 | (message (oref n warning))) 669 | (ding)))) 670 | 671 | (defun mlint-show-warning () 672 | "Show the warning for the current mark." 673 | (interactive) 674 | (let ((n (linemark-at-point (point) mlint-mark-group))) 675 | (if (not n) 676 | (message "No warning at point.") 677 | (message (oref n warning))))) 678 | 679 | (defun mlint-fix-warning () 680 | "Show the warning for the current mark." 681 | (interactive) 682 | (let ((n (linemark-at-point (point) mlint-mark-group))) 683 | (if (not n) 684 | (message "No warning at point.") 685 | (if (not (mlint-is-fixable n)) 686 | (message "No method for fixing this warning.") 687 | (mlint-fix-entry n))))) 688 | 689 | (defun mlint-mark-ok () 690 | "Mark this line as M-Lint Ok." 691 | (interactive) 692 | (let ((n (linemark-at-point (point) mlint-mark-group))) 693 | (if (not n) 694 | (message "No warning at point.") 695 | (let ((col (matlab-comment-on-line))) 696 | (or col (end-of-line)) 697 | (insert " %#ok") 698 | ;; Add spaces if there was a comment. 699 | (when col (insert " "))) 700 | ;; This causes inconsistencies. 701 | ;; (linemark-delete n) 702 | )) 703 | ) 704 | 705 | 706 | ;;; Define an mlinting minor mode 707 | ;; 708 | (defvar mlint-minor-mode-map 709 | (let ((map (make-sparse-keymap))) 710 | (define-key map "\C-c,n" 'mlint-next-buffer) 711 | (define-key map "\C-c,p" 'mlint-prev-buffer) 712 | (define-key map "\C-c,N" 'mlint-next-buffer-new) 713 | (define-key map "\C-c,P" 'mlint-prev-buffer-new) 714 | (define-key map "\C-c,g" 'mlint-buffer) 715 | (define-key map "\C-c,c" 'mlint-clear-warnings) 716 | (define-key map "\C-c, " 'mlint-show-warning) 717 | (define-key map "\C-c,f" 'mlint-fix-warning) 718 | (define-key map "\C-c,o" 'mlint-mark-ok) 719 | map) 720 | "Minor mode keymap used when mlinting a buffer.") 721 | 722 | (easy-menu-define 723 | mlint-minor-menu mlint-minor-mode-map "M-Lint Minor Mode Menu" 724 | '("M-Lint" 725 | ["Get M-Lint Warnings" mlint-buffer t] 726 | ["Clear M-Lint Warnings" mlint-clear-warnings t] 727 | ["Show Warning" mlint-show-warning (linemark-at-point (point) mlint-mark-group)] 728 | ["Auto Fix Warning" mlint-fix-warning 729 | (let ((w (linemark-at-point (point) mlint-mark-group))) 730 | (and mlint-scan-for-fixes-flag w (mlint-is-fixable w))) ] 731 | ["Enable Auto-fix scanning" 732 | (setq mlint-scan-for-fixes-flag (not mlint-scan-for-fixes-flag)) 733 | :style toggle :selected mlint-scan-for-fixes-flag ] 734 | ["This is Ok" mlint-mark-ok 735 | (linemark-at-point (point) mlint-mark-group) ] 736 | "--" 737 | ["Next Warning" mlint-next-buffer t] 738 | ["Previous Warning" mlint-prev-buffer t] 739 | ["Next New Warning" mlint-next-buffer-new t] 740 | ["Previous New Warning" mlint-prev-buffer-new t] 741 | )) 742 | 743 | (defvar mlint-overlay-map 744 | (let ((map (make-sparse-keymap ))) 745 | (define-key map [down-mouse-3] 'mlint-emacs-popup-kludge) 746 | (define-key map [(meta n)] 'mlint-next-buffer) 747 | (define-key map [(meta p)] 'mlint-prev-buffer) 748 | (define-key map [(control meta n)] 'mlint-next-buffer-new) 749 | (define-key map [(control meta p)] 'mlint-prev-buffer-new) 750 | (set-keymap-parent map matlab-mode-map) 751 | map) 752 | "Map used in overlays marking mlint warnings.") 753 | 754 | (defun mlint-emacs-popup-kludge (e) 755 | "Pop up a menu related to the clicked on item. 756 | Must be bound to event E." 757 | (interactive "e") 758 | (let ((repos nil) 759 | (ipos nil) 760 | (startpos (point)) 761 | ) 762 | (save-excursion 763 | (mouse-set-point e) 764 | (setq ipos (point)) 765 | (popup-menu mlint-minor-menu) 766 | (if (/= (point) ipos) (setq repos (point))) 767 | ) 768 | (when repos (goto-char repos)))) 769 | 770 | ;;;###autoload 771 | (easy-mmode-define-minor-mode mlint-minor-mode 772 | "Toggle mlint minor mode, a mode for showing mlint errors. 773 | With prefix ARG, turn mlint minor mode on iff ARG is positive. 774 | \\{mlint-minor-mode-map\\}" 775 | nil " mlint" mlint-minor-mode-map 776 | (if (and mlint-minor-mode (not (eq major-mode 'matlab-mode))) 777 | (progn 778 | (mlint-minor-mode -1) 779 | (error "M-Lint minor mode is only for MATLAB Major mode"))) 780 | (if (not mlint-minor-mode) 781 | (progn 782 | (mlint-clear-nested-function-info-overlays) 783 | (mlint-clear-warnings) 784 | (remove-hook 'after-save-hook 'mlint-buffer t) 785 | (easy-menu-remove mlint-minor-menu) 786 | ) 787 | (when mlint-program-selection-fcn 788 | (let ((ans (funcall mlint-program-selection-fcn)) 789 | ) 790 | (when ans 791 | (make-local-variable 'mlint-program) 792 | (setq mlint-program ans) 793 | ) 794 | ) 795 | ) 796 | (if (not mlint-program) 797 | (if (y-or-n-p "No MLINT program available. Configure it?") 798 | (customize-variable 'mlint-programs)) 799 | 800 | (make-local-hook 'after-save-hook) 801 | (add-hook 'after-save-hook 'mlint-buffer nil t) 802 | (easy-menu-add mlint-minor-menu mlint-minor-mode-map) 803 | (mlint-buffer)) 804 | )) 805 | 806 | (defvar mlint-minor-mode-was-enabled-before nil 807 | "Non nil if mlint is off, and it was auto-disabled.") 808 | (make-variable-buffer-local 'mlint-minor-mode-was-enabled-before) 809 | 810 | (defun mlint-ediff-metabuffer-setup-hook () 811 | "Hook run when EDiff is about to do stuff to a buffer. 812 | That buffer will be current." 813 | (when (and (eq major-mode 'matlab-mode) 814 | mlint-minor-mode) 815 | (setq mlint-minor-mode-was-enabled-before mlint-minor-mode) 816 | (mlint-minor-mode -1) 817 | )) 818 | 819 | (add-hook 'ediff-prepare-buffer-hook 'mlint-ediff-metabuffer-setup-hook) 820 | 821 | (defun mlint-ediff-cleanup-hook () 822 | "Re-enable mlint for buffers being ediffed. 823 | The buffer that was originally \"setup\" is not current, so we need to 824 | find it." 825 | (mapcar (lambda (b) 826 | (when (save-excursion 827 | (set-buffer b) 828 | (and (eq major-mode 'matlab-mode) 829 | mlint-minor-mode-was-enabled-before)) 830 | (save-excursion 831 | (set-buffer b) 832 | (mlint-minor-mode 1) 833 | (setq mlint-minor-mode-was-enabled-before nil)))) 834 | (buffer-list))) 835 | 836 | (add-hook 'ediff-cleanup-hook 'mlint-ediff-cleanup-hook) 837 | 838 | (provide 'mlint) 839 | 840 | ;;; mlint.el ends here 841 | -------------------------------------------------------------------------------- /ChangeLog.old1: -------------------------------------------------------------------------------- 1 | This is the old-style ChangeLog before integration into CVS @ The MathWorks 2 | 3 | ------- 4 | 30Jul01 by Eric Ludlam 5 | Better doc for matlab-mode & stringify. 6 | Fix `matlab-fill-paragraph' so comments do not bleed into 7 | the previous line. 8 | 9 | 04Jun01 by Eric Ludlam 10 | Version change to 2.2.4.alpha 11 | 12 | 07May01 by Eric Ludlam 13 | Set `indent-tabs-mode' to nil for M files. Tabs are not allowed for V6. 14 | 15 | 05Apr01 by Eric Ludlam 16 | Fixed auto-fill for code to add end brackets after a string if the string is already complete. 17 | 18 | 16Feb01 by Stefan Holst 19 | Add ./ to list of highlighted math operators. 20 | 21 | 15Dec00 by Peter Boettcher 22 | hacked by Eric Ludlam 23 | Add local binding to `matlab-mode' for `add-log-current-defun-function'. 24 | New function `matlab-match-function-re' to match functions. 25 | New function `matlab-current-defun' gets the name of the current fn. 26 | In `matlab-mode-vf-functionname' use `matlab-match-function-re'. 27 | Added @ for file names to regexp `gud-matlab-error-regexp'. 28 | 29 | 27Oct00 by Volker Franz 30 | Add text to `comint-input-ring' in `matlab-shell-save-and-go'. 31 | 32 | 10Oct00 by Eric Ludlam 33 | When using a value from `matlab-maximum-indents', enable the maximum to be offset by the current 34 | indentation level. 35 | 36 | 08Sep00 by Eric Ludlam 37 | Fixed numeric ij highlighting. 38 | Fixed `matlab-comment-on-line' for case when only % is inside a 39 | string. 40 | 41 | 08Jun00 by Eric Ludlam 42 | Added menu item for `matlab-uncomment-region'. 43 | 44 | 06Jun00 by Eric Ludlam 45 | Added `matlab-shell-input-ring-size' as a variable. 46 | 47 | 30May00 by Eric Ludlam 48 | `matlab-beginning-of-command' now skips past comments which 49 | are continuations from the previous line. 50 | Fixed `matlab-defun-regex' to require real whitespace after the 51 | function keyword. 52 | 53 | 18Apr00 by Eric Ludlam 54 | Finally: Version 2.2.3. 55 | 56 | 13Apr00 by Eric Ludlam with original 57 | from Hubert Selhofer 58 | Added `matlab-find-unreachable-code' to detect if (0) 59 | situations. Use this in font lock to turn that code 60 | into comment colors. 61 | Update `matlab-forward-sexp' to take universal argument. 62 | When set, stop on else/case/catch blocks. Used by above 63 | fn to not highlight ELSE clause. 64 | Version 2.2.3.b4 65 | 66 | 06Apr00 by Eric Ludlam 67 | Updated `matlab-mode-vf-quietafy-buffer' to remove trailing 68 | whitespace too. 69 | Make sure the `fume' vairables exist before modifying them. 70 | 71 | 08Mar00 by Adrie Dane 72 | tweeked by Eric M. Ludlam 73 | Added support for XEmacs' func-menu program. 74 | 75 | 19Jan00 by Eric M. Ludlam 76 | Fixed typo in C-c: binding to uncomment region. 77 | 78 | 19Jan00 by Hubert Selhofer 79 | Font-lock complex numbers (i,j). 80 | 81 | 12Jan00 by Eric M. Ludlam idea by 82 | Jinwei Shen 83 | Added `matlab-show-matlab-shell-buffer' to display the shell 84 | from a matlab buffer. 85 | I moved commands that affect the shell from a text buffer into 86 | their own section. 87 | 88 | 29Oct99 by Eric M. Ludlam 89 | `matlab-shell-command-switches' is now a custom string type. 90 | Version 2.2.3.b2 91 | 92 | 04Aug99 by Eric M. Ludlam 93 | Customize new font lock keyword list variables. 94 | Fixed `matlab-lattr-middle-block-cont' to return 0 if there IS 95 | a middle block that also contains an END on the same line. 96 | 97 | 03Aug99 by Hubert Selhofer augmented by 98 | Eric M. Ludlam 99 | Use Emacs 20's `line-end-position' and `line-beginning-position'. 100 | Use Emacs 20's `regexp-opt' when generating font-lock keywords. 101 | Version 2.2.3.b1 102 | 103 | 23July99 by Peter J. Acklam 104 | Font Lock keywords for function defs w/ special EOL. 105 | 106 | 02July99 by Eric Ludlam 107 | Added `matlab-uncomment-region' command bound to C-c : 108 | 109 | 04June99 by Ian Wells 110 | Updated `gud-matlab-error-regexp' to work w/ windows filenames. 111 | 112 | 20May99 by Eric Ludlam 113 | Updateded the ftp site where you can get matlab.el 114 | 115 | 21Apr99 by Eric Ludlam 116 | Added menu items to toggle code-filling, and periodic details. 117 | Update version to 2.2.2. 118 | 119 | 14Apr99 by Eric Ludlam 120 | Added `matlab-comment-line-break-function' on M-j for compatibility. 121 | 122 | 12Apr99 by Eric Ludlam 123 | In `matlab-valid-end-construct-p' do not use end-of-command. 124 | The end of line command seems to work just fine. 125 | 126 | 31Mar99 by Eric Ludlam 127 | Fixed `matlab-end-of-command' to have a better short-cicuit for 128 | long buffers. (depends on block commands not appearing in matrix) 129 | 130 | 04Mar99 by Eric Ludlam 131 | Fixed `matlab-end-of-command' to be savvy of eob. 132 | Fixed `matlab-indent-end-before-ret' to correctly use the 133 | regex functions that need re-indenting backwards. Use of 134 | `matlab-block-beg-re' was just wrong. 135 | 136 | 01Mar99 by Eric Ludlam 137 | Removed ' from menu bindings toggling variables. 138 | 139 | 10Feb99 by Eric Ludlam 140 | `matlab-navigation-syntax' will ALSO set `case-fold-search' to nil. 141 | 142 | 09Feb99 by Eric Ludlam 143 | Fixed `matlab-beginning-of-command' to not stall inside a 144 | matrix inside a continuation. 145 | 146 | 29Jan99 by Eric Ludlam 147 | Added try/catch to hilit19 keywords. 148 | 149 | 28Jan99 by Eric Ludlam 150 | Fixed `matlab-indent-end-before-ret' to use `matlab-block-beg-re' 151 | instead of a home-grown regular expression. 152 | 153 | 17Dec98 by Eric Ludlam 154 | Updated some documentation. 155 | Post 2.2.1 156 | 157 | 16Dec98 by Eric Ludlam 158 | Do not require font lock. Set up font-lock hooks to generate our 159 | special faces when font lock is loaded (if it isn't already) 160 | Add require 'gud on compile. 161 | Added `matlab-handle-simulink'. When set to nil, font lock keywords 162 | are modified to remove simulink special stuff. 163 | Fixed `matlab-cursor-in-string' so that the `incomplete' param 164 | works with strings w/ '' in them. 165 | Added celeron to `matlab-mode-vf-quietafy-buffer', and also added 166 | a speed optimization when calling `matlab-end-of-command'. 167 | 168 | 07Dec98 by Eric Ludlam 169 | Added `matlab-maximum-indents' to hold indentation maximum data. 170 | Update `matlab-calculate-indentation' to use the maximums 171 | variable to allow custom indentation levels. Also fixed so 172 | that if a given paren is immediatly followed by EOL, or if 173 | an indent past arg1's 1st arg is followed by and EOL, then 174 | backup one indentation type. 175 | 176 | 04Dec98 by Eric Ludlam 177 | In `gud-matlab-find-file', don't use replace-match on a string. 178 | Fixed nasty bug when a paren appears in a string in an array. 179 | Added `matlab-up-list' which only works backwards at the moment. 180 | Added `array-cont' and `array-end' indentation types. Array-end types 181 | will line up with the opening bracket, not the array elements. 182 | Hacked several fns to use `array-cont's restrict parameter 183 | to speed things up. 184 | 185 | 03Dec98 by Eric Ludlam 186 | Moved simulink keywords into a guadier level. Added require font-lock. 187 | Fixed `matlab-ltype-help-comm' to not loop endlessly @ bob. 188 | Added `matlab-ispell-strings-region', `matlab-ispell-strings', and 189 | `matlab-ispell-comments'. Added to menu & keymap. 190 | 191 | 02Dec98 by Eric Ludlam 192 | Fixed `matlab-show-line-info' to not use old indent functions. 193 | Fixed "proc" ref in `matlab-shell-send-string' which only 194 | worked incidentally. 195 | Release 2.2 196 | 197 | 15Nov98 by Eric Ludlam 198 | When auto-filling comments at the end of a line, use 199 | auto-fill, and not fill-paragraph. 200 | `matlab-set-comm-fill-prefix' no longer grabs preceding spaces. 201 | 202 | 12Nov98 by Eric Ludlam 203 | When a regular matlab prompt appears, turn off the overlay arrow. 204 | 205 | 11Nov98 by Eric Ludlam 206 | Attempted to make `matlab-shell-echos' disply the string about 207 | to be run for save-and-go, and run-region in the fn 208 | `matlab-shell-send-string' 209 | 210 | 10Nov98 by Eric Ludlam 211 | Fixed bug in `gud-matlab-marker-filter' so that instead of 212 | checking for specific prompts, we check specifically for the 213 | error prefix, and display everything else (which includes 214 | the prompt of the INPUT command. 215 | 216 | 04Nov98 by Eric Ludlam 217 | Fixed `matlab-shell-echos' -> `matlab-shell-echoes'. 218 | 219 | 04Nov98 by Eric Ludlam 220 | Post 2.1.4d. 221 | 222 | 03Nov98 by Eric Ludlam 223 | Added `matlab-shell-echos' for NT engine program. 224 | 225 | 02Nov98 by Eric Ludlam 226 | Due to new engine program for NT, be careful w/ error message in 227 | `matlab-shell'. 228 | 229 | 31Oct98 by Matt Wette 230 | changed local variable `comment-column' to value of 231 | `matlab-comment-column' (not the symbol) 232 | changed reference of `matlab-comment-column' to `comment-column'. 233 | Fixed matlab-comment on lines w/ comment. 234 | 235 | 26Oct98 by Eric Ludlam 236 | Added help for `matlab-shell' on Windows platform. 237 | 238 | 23Oct98 by Eric Ludlam 239 | Fixed font locking for statement vars for an embedded fn call. 240 | Fixed font locking non-simulink commands starting w/ `sim' 241 | 242 | 19Oct98 by Eric Ludlam 243 | When auto-filling, ignore lines which are commented regions. 244 | 245 | 16Oct98 by Eric Ludlam 246 | In `matlab-set-comm-fill-prefix', account for the $$$ of a 247 | region comment. 248 | 249 | 14Oct98 by Eric Ludlam 250 | When debugging source, convert .p files into .m files before loading. 251 | 252 | 07Oct98 by Eric Ludlam 253 | A bunch of changes to enable GUD usage under XEmacs 20.4. 254 | Updated some documentation. Switched to 2.1.4 due to changes. 255 | 256 | 06Oct98 by Eric Ludlam 257 | Added binding for `backspace' symbol to not delete prompt. 258 | 259 | 02Oct98 by Eric Ludlam 260 | Fixed matlab shell to beep shell to beep when filtering C-g 261 | Added a command to prevent simple deletion of the prompt in shell mode. 262 | 263 | 30Sept98 by Eric Ludlam 264 | Post 2.1.3i to mailing list. 265 | 266 | 25Sept98 by Eric Ludlam 267 | Fixed a region bug for Emacs 20.2. Apparently `region-face' 268 | is important, and I shouldn't have used it as a local 269 | variable. 270 | 271 | 24Sept98 by Eric Ludlam 272 | Fixed bug for arg1 functions when 1st arg is a function call, 273 | and the lineup code matches past arg1 of this fn. 274 | Added `matlab-arg1-max-indent-length' to control how long the 275 | first argument must be before we stop indenting. 276 | 277 | 23Sept98 by Eric Ludlam 278 | Made sure region was correctly found for XEmacs users w/ custom. 279 | 280 | 22Sept98 by Eric Ludlam 281 | Added optional arg REINDENT to `matlab-insert-end-block' to reindent 282 | the code affected by the new block. 283 | 284 | 10Sept98 by Eric Ludlam 285 | Fixed use of `matlab-indent-past-arg1-functions' so that the `_' char 286 | is also skipped over when backing up. 287 | The font lock keywords for 1st arg is var functions now uses 288 | `matlab-indent-past-arg1-functions' as the default reference. 289 | Added a bunch of simulink keywords to font lock, included a simulink 290 | keyword face, and to `matlab-indent-past-arg1-functions'. 291 | 292 | 09Sept98 by Eric Ludlam 293 | Added waitfor in with set/get as a handle/property pair acceptor. 294 | Fixed defcustom rules for for `matlab-unterminated-string-face' 295 | to take the same properties as `font-lock-string-face'. 296 | Added some really gaudy keywords for highlighting interesting 297 | things in a file's help comment. 298 | 299 | 31Aug98 by Eric Ludlam 300 | Post 2.1.3f to mailing list. 301 | Fixed typo in `matlab-shell' relating to keymaps for older emacsen. 302 | 303 | 21Aug98 by Eric Ludlam 304 | Fixed `matlab-ltype-help-comm' to not hang at beginning of buffer. 305 | Add `matlab-ltype-comm-ignore' returns t on lines which were 306 | hit with `matlab-comment-region'. `matlab-prev-line' 307 | ignores these when scanning backwards, and 308 | `matlab-calculate-indentation' forces these lines to indent 309 | to column 0. 310 | 311 | 20Aug98 by Eric Ludlam 312 | Update doc for `matlab-case-level' to include cons cell 313 | Update `matlab-calc-indent' and `matlab-next-line-indentation' 314 | to handle cons cell for `matlab-case-level'. 315 | 316 | 19Aug98 by Eric Ludlam 317 | Removed docs about 'nohelpcomment. This is the default now. 318 | 319 | 18Aug98 by Eric Ludlam 320 | Fixed `matlab-find-convenient-line-break' to break before a function 321 | name, not instead of at it's opening parenthisis. 322 | 323 | 14Aug98 by Eric Ludlam 324 | Fixed `matlab-auto-fill' so that when filling many parameters 325 | of strings, the small confusion of string continues doesn't 326 | mess things up (by inserting brackets and things like that.) 327 | Added `matlab-indent-past-arg1-functions' regex which permits 328 | indentation of continuations after certain classes of 329 | functions to occur with the second argument. 330 | Updated `matlab-set-comm-fill-prefix' to be smaller, and smarter. 331 | This eliminated `matlab-set-comm-fill-prefix-post-code' 332 | Removed the unused `matlab-set-code-fill-prefix'. 333 | Fixed `matlab-auto-fill' to fill post code comments first when 334 | applicable. 335 | Fixed `matlab-fill-paragraph' so that if the cursor is AFTER 336 | the ..., it will fill in code mode, not comment mode. 337 | Also, trailing comments are correctly decommented. 338 | 339 | 12Aug98 by Eric Ludlam 340 | Rewrote `matlab-fill-region' to go through the region on a 341 | command by command basis calling `matlab-fill-paragraph' 342 | Fixed `matlab-fill-paragraph' to justify code lines, and 343 | insert spaces wher the line breaks were. 344 | Deleted `matlab-justify-comment-line' since we can get that 345 | behavior built in. 346 | Added `matlab-fill-fudge-hard-maximum' to be the hard maximum 347 | limit when filling code. 348 | Fixed `matlab-beginning-of-command' to correctly handle 349 | continued lines at the beginning of a buffer. 350 | Fixed `matlab-calc-indent' to be better about indentation at 351 | the beginning of a buffer. 352 | Fixed `matlab-find-convenient-line-break' to be smarter about 353 | varios potential problems including double-fudge parens, 354 | and before/after space search short-circuiting. 355 | 356 | 31Jul98 by Eric Ludlam 357 | Added `matlab-fill-fudge' which is a fuzzy fill zone. Also added 358 | `matlab-find-convenient-line-break' which calculates a fuzzy 359 | column to break a line on. Updated `matlab-do-autofill' to 360 | use the above function. 361 | Updated `matlab-fill-paragraph' to use the new fuzzy line-break 362 | calculation on code. 363 | Added `matlab-ltype-continued-comm' to identify the column on 364 | a previous line where the comment column is. 365 | Updated indentor to indent comments indentically to the previous 366 | line's comment column even if it follows code. 367 | Updated `matlab-beginning-of-command' and `matlab-end-of-command' 368 | to correctly trace to the end of a command's comments. 369 | 370 | 29Jul98 by Eric Ludlam 371 | Fixed `matlab-auto-fill' to prevent filling if typing a space 372 | while the cursor is on the first . or the elipsis. 373 | Fixed `matlab-ltype-endfunction-comm' so it won't barf on end-of- 374 | file conditions. 375 | 376 | 27Jul98 by Eric Ludlam 377 | Fixed first code line in a function indenting problem. The 378 | variable `matlab-indent-function' was ignored, where code 379 | after a help comment was always indented, and code after 380 | the first function decl, but w/ no help was always not 381 | indented. 382 | Fixed `matlab-beginning-of-command' to correctly handle the 383 | first line in a file containing continuation marks. 384 | Fixed auto fill to not fill lines with elipses on them already. 385 | Fixed `matlab-valid-end-construct-p' to handle unterminated lists 386 | or matrixes. If a list is unterminated, then all ends are 387 | assumed to be invalid. 388 | 389 | 20Jul98 by Eric Ludlam 390 | Check to make sure `set-keymap-parent' exists before using it. 391 | 392 | 07Jul98 by Eric Ludlam 393 | Moved `matlab-mode-verify-fix-functions' to custom variable section, 394 | and turned it into a defcustom declaration. 395 | Added `matlab-lattr-array-cont' function to identify lines that 396 | have unstarted/ended arrays in them. 397 | `matlab-beginning-of-command' and `matlab-end-of-command' now track 398 | across unbounded array constants. 399 | 400 | 06Jul98 by Eric Ludlam 401 | Put `matlab-indent-function' back to nil. 402 | `matlab-mode-vf-quietafy-buffer' can take optional ignored FAST arg. 403 | Release 2.1.2. 404 | 405 | 02Jul98 by Eric Ludlam 406 | Added `matlab-mode-vf-quietafy-buffer' which finds lines which may 407 | produce ANS style output. 408 | When `matlab-indent-function' is 'nohelpcomment, then the first 409 | comment in a function is unindented while the function body 410 | is indented. 411 | 412 | 22Jun98 by Eric Ludlam 413 | Even more string highlighting fixes for spaces in strings. 414 | 415 | 17Jun98 by Eric Ludlam 416 | Re-worked the string/comment font locking to use functions instead 417 | of string matching. The functions are now much more accurate. 418 | 419 | 16Jun98 by Eric Ludlam 420 | Fixed auto-fill prefix for comments to not require a space. 421 | 422 | 15Jun98 by Eric Ludlam 423 | More string font lock fixing comments directly after a string. 424 | 425 | 10Jun98 by Eric Ludlam 426 | Fixed unterminated strings that contain comment characters, 427 | and don't highlight the comments in unterminated strings. 428 | Discovered why XEmacs 20 wouldn't highlight some items, and 429 | fixed it. Required lots of 'appends, plus the removal 430 | of 'prepend for comments which allowed other keywords to show 431 | through. 432 | 433 | 10Jun98 by Peter J. Acklam 434 | Fixed unterminated strings with quoted quotes. 435 | 436 | 05Jun98 by Stelios Kyriacou 437 | Update `gud-matlab-error-regexp' to handle warnings. 438 | Update `matlab-shell-last-error' to find errors the cursor is in. 439 | 440 | 04Jun98 by Eric Ludlam 441 | Attempt to make `matlab-unterminated-string-face' do the defface thing. 442 | 443 | 04Jun98 by Stelios Kyriacou 444 | Fixed `matlab-find-file-on-path' to correctly search the list of paths. 445 | Added check that a path is a directory before fetching it's files. 446 | Fixed a bug when I merged a change in from jacklam which I seem to 447 | have forgotten to put into this history. 448 | 449 | 03Jun98 by Eric Ludlam 450 | `matlab-unterminated-string-face' is now a self-referencing variable. 451 | Post version 2.1.1 452 | 453 | 02Jun98 by Eric Ludlam 454 | Fixed the function `matlab-mode-determine-mfile-path' to not fail. 455 | Updated `matlab-find-file-on-path' to handle nil's in the list 456 | and provide helpful errors 457 | 458 | 01Jun98 by Eric Ludlam 459 | Post version 2.1 460 | 461 | 27May98 by Eric Ludlam 462 | Enabled `matlab-mode-determine-mfile-path' and used it to 463 | define the variable `matlab-mode-install-path'. This is 464 | then used by the new commands `matlab-find-file-on-path' and 465 | `matlab-find-file-click' Added these to the keymap and meny. 466 | 467 | 22May98 by Dan Nicolaescu 468 | Fixed derived modes to correctly font lock upon creation. 469 | 470 | 19May98 by Peter J. Acklam 471 | New function highlighting regexps which are more accurate. 472 | 473 | 11May98 by Eric M. Ludlam 474 | Ran new checkdoc on the file and fixed all calls to `error' 475 | 476 | 11May98 by Peter J. Acklam 477 | Fixed a string highlighting bug. 478 | 479 | 11May98 Michael Granzow 480 | Found bug in `matlab-keywords-boolean'. 481 | 482 | 08May98 by Eric M. Ludlam 483 | CR after unterminated END will error, but still insert the CR. 484 | 485 | 08May98 by Hubert Selhofer 486 | CR when (point) == (point-min) no longer errors 487 | 488 | 05May98 by Hubert Selhofer 489 | Many spelling fixes in comments, and doc strings. 490 | Adjusted some font-lock keywords to be more compact/effecient. 491 | 492 | 30Apr98 by Eric M. Ludlam 493 | %endfunction unindenting can now have arbitrary text after it. 494 | 495 | 24Apr98 by Peter J. Acklam 496 | Fixed highlighting of for statements w/ traling comments. 497 | 498 | 23Apr98 by Eric M. Ludlam 499 | Fixed -vf-block functions to have more restrictive before-keyword 500 | so we don't accidentally match keywords at the end of symbols. 501 | 502 | 22Apr98 by Eric M. Ludlam 503 | Release 2.0 to web site and newsgroups. 504 | Ran checkdoc/ispell on entire file. 505 | Cleaned up some compile-time warnings. 506 | Verified XEmacs compatibility. 507 | 508 | 13Apr98 by Eric M. Ludlam 509 | Fixed bug in `matlab-mode-vf-functionname' to prevent infinite loop 510 | on empty files. 511 | 512 | 10Apr98 by Eric M. Ludlam 513 | Added break to highlighted keywords. 514 | Case variable highlighting now stops at comment endings. 515 | 516 | 07Apr98 by Eric M. Ludlam 517 | `matlab-ltype-comm' no longer demands a space after the %. 518 | Indentor now unindents the comment %endfunction. 519 | Removed transposing transpose part. It broke quoted quotes. 520 | 521 | 02Apr98 by Eric M. Ludlam 522 | Comments appearing at the end of a function, and just before a new 523 | subfunction, are now unintented if `matlab-indent-function' is 524 | non-nil. This lets matlab users use %endfunction at the end 525 | of a function, and get the indentation right. 526 | 527 | 01Apr98 by Eric M. Ludlam 528 | Smarter font lock for case (jacklam@math.uio.no) 529 | Auto fill accounts for chars inserted based on the variable 530 | `matlab-fill-count-ellipsis-flag'. 531 | Auto fill will now fill a string by putting it into brackets 532 | controlled by `matlab-fill-strings-flag'. 533 | 534 | 18Mar98 by Peter J. Acklam 535 | Enabled multi-line function definitions in font-lock and imenu. 536 | 537 | 16Mar98 by Eric M. Ludlam 538 | Fixed potential error in comment searching around ... 539 | Fixed many function regexp's as per Peter J. Acklam's 540 | suggestion. 541 | 542 | 09Mar98 by Eric M. Ludlam 543 | Fixed `tempo-template-matlab-function' to work correctly. 544 | Fixed indentation for many other templates. 545 | Made sure the verifier uses navigation syntax. 546 | 547 | 23Feb98 by Eric M. Ludlam 548 | Fixed problem with x='%' % ' this shouldn't work 549 | Fixed a problem w/ strung up brackets messing up valid 550 | end identification. 551 | 552 | 17Feb98 by Aki Vehtari 553 | Fixed prompt regexp to include the debugging K. 554 | 555 | 11Feb98 by Eric M. Ludlam 556 | Made `matlab-mode-vf-functionname' more robust to arbitrary 557 | versions of a function definition. This includes allowing 558 | comments and blank lines before the first fn definition. 559 | Fixed up the font lock keywords for functions some 560 | 561 | 10Feb98 by Eric M. Ludlam 562 | Fixed problem with derived view mode. 563 | Fixed font locking of globals to allow a ; at the end. 564 | Fixed function name verifier to not allow = on next line. 565 | It used to match invalid expressions. 566 | `matlab-shell-collect-command-output' now uses a different prompt 567 | detector when waiting for output. This prevents early exit. 568 | 569 | 09Feb98 by Eric M. Ludlam 570 | Updated `matlab-indent-line' to not edit the buffer if no changes 571 | are needed, and to make after cursor position smarter. 572 | 573 | 05Feb98 by Eric M. Ludlam 574 | Added completion semantics and lists for HandleGraphics property lists 575 | Added `matlab-completion-technique' and made it's default value 576 | 'completion. This shows a buffer of completions instead of 577 | cycling through them as the hippie-expand command does. 578 | 579 | 26Jan98 by Aki Vehtari 580 | The Matlab logo variable now uses XEmacs 20.4 locate function. 581 | Small cleanups 582 | 583 | 26Jan98 by Eric M. Ludlam 584 | Updated `matlab-fill-paragraph' to use a better fill prefix. 585 | Moved code sections around, and added page breaks for navigation. 586 | 587 | 23Jan98 by Aki Vehtari 588 | (matlab-frame-init): Fix typo in menu. 589 | (matlab-output-to-temp-buffer): Use matlab-shell-help-mode. 590 | (matlab-shell-run-region): New function. 591 | (matlab-shell-collect-command-output): Remove (goto-char (point-max)). 592 | (matlab-shell-topic-mode-hook): Name change. 593 | (matlab-shell-topic-browser): Use matlab-shell-topic-mode. 594 | (matlab-shell-help-mode): New mode. Derive from view-major-mode. 595 | (matlab-shell-help-mode-menu): Define. 596 | (matlab-shell-topic-mode): Name change and derive from 597 | matlab-shell-help-mode. 598 | (matlab-shell-topic-mode-menu): Name change. 599 | 600 | 22Jan98 by Eric M. Ludlam 601 | Make `matlab-comment' insert `matlab-comment-s' on lines with 602 | no text when there there is no previous comment line to mimic. 603 | 604 | 21Jan98 by Eric M. Ludlam 605 | Fixed a few templates. Added `matlab-if-else'. 606 | `matlab-insert-end-block' will now add a comment consisting of 607 | the text starting the block being ended. 608 | Added colors to variables defined with the global command. 609 | Added `matlab-complete-symbol' which uses `matlab-find-recent-variable' 610 | which searches backwards for variables names, and 611 | `matlab-find-user-functions' which finds user functions. 612 | There are also `matlab-*-completions' for solo commands 613 | (if, else, etc), value commands, and boolean commands. 614 | The current semantic state is found w/ `matlab-lattr-semantics' 615 | 616 | 20Jan98 by Eric M. Ludlam 617 | Changed `matlab-block-scan-re' to have a limiting expression at 618 | the beginning. This makes sexp scanning faster by skipping 619 | more semantically bad matches. 620 | Forward/backward sexp now watch `matlab-scan-on-screen-only', which 621 | make them stop when the scan falls off the screen. Useful for 622 | making the block highlighter *much* faster for large constructs, 623 | and is logical since we can't see the highlight anyway. 624 | Added `matlab-block-verify-max-buffer-size' to turn off long checks 625 | on big buffers during save only. Requesting a verify will do 626 | the checks anyway. 627 | Fixed block verifiers to check that found end keywords are also 628 | valid block terminators. 629 | 630 | 19Jan98 by Eric M. Ludlam 631 | Fixed `gud-matlab-marker-filter' and `matlab-join-comment-lines' 632 | to not use `replace-match's fifth argument. 633 | Replaced `matlab-insert-' with tempo templates where appropriate. 634 | 635 | 19Jan98 by Aki Vehtari 636 | Fixed `matlab-mode-vf-functionname' to use a correct form 637 | of `replace-match' for XEmacs. 638 | Suggested form of `matlab-navigation-syntax'. 639 | 640 | 14Jan98 by Eric M. Ludlam 641 | Added manu `matlab-insert-' functions, including: 642 | `switch-block', `next-case', `end-block', `if-block', 643 | `for-block', `try-block', `while-block'. 644 | Added `matlab-stringify-region' which takes a region, and 645 | converts it to a string by adding ' around it, and quoting 646 | all the quotes in the region. 647 | Added an insertion prefix C-c C-c for all insert commands, and 648 | the stringify function. 649 | `matlab-auto-fill' is now assigned to `normal-auto-fill-function', 650 | which is an Emacs 20 thing for auto-fill minor mode. 651 | Added `matlab-beginning-of-command' and `end-of-command' which 652 | moves across lines w/ continuation. 653 | Changed `matlab-lattr-cont' to allow continuation on lines 654 | ending in semicolon. Is this correct? 655 | Changed the main menu to have submenues for navigation, 656 | formatting, and the new insert functions. 657 | Fixed `matlab-forward-sexp' to not skip over brackets which 658 | was appeared to be a missunderstanding. 659 | Block highlighter and block verifiers no longer treat function 660 | as requiring an "end" keyword. 661 | 662 | 09Jan98 by Eric M. Ludlam 663 | Based on code donated by Driscoll Tobin A 664 | `matlab-fill-paragraph' designed for M file help text, which 665 | will fill/justify comment text, and uses paragraph rules. 666 | `matlab-fill-comment-line' does not know about paragraphs. 667 | `matlab-cursor-in-string' can now take an optional argument 668 | which will identify an unterminated string. 669 | `matlab-auto-fill' will not fill strings, and if the string is 670 | not yet terminated, will also not fill it. When the string 671 | is terminated, the split will happen after the string, even 672 | if it occurs after the `fill-column'. 673 | 674 | 08Jan98 by Aki Vehtari 675 | XEmacs compatibility associated with timers. 676 | XEmacs optimizations associated with point-at-[eb]ol. 677 | Turned key sequences from strings to Emacs/XEmacs wide [()] form 678 | Documentation string fixes. 679 | Customizable hooks. Also update other custom vars. 680 | Remove `matlab-reset-vars' and turn variables controlled by 681 | `matlab-indent-function' into functions. 682 | Some menu re-arrangements & topic-browser menu. 683 | Use matlab-region-face instead of 'region when highlighting stuff. 684 | `matlab-shell-exit' now deletes the buffer when it's done. 685 | `write-contents-hooks' is forced buffer local. 686 | Fixed `matlab-output-to-temp-buffer'. 687 | Made matlab-shell group. 688 | 689 | 07Jan98 by Eric Ludlam 690 | Fixed indenting problem when end is first used as matrix index 691 | and is also the first word on a line. 692 | 693 | 07Jan98 by Aki Vehtari 694 | Fixed comments to use add-hook instead of setq. 695 | Variable name cleanup. Added ###autoload tags to -mode and -shell. 696 | Removed some unused variables. 697 | 698 | 24Dec97 by Eric Ludlam 699 | Added `matlab-shell-enable-gud-flag' to control if the GUD features 700 | are used in shell mode or not. This is automatically set to nil 701 | when certain GUD features are not present 702 | Added stop/clear if error to menu to help people out w/ the debugger. 703 | Added block highlighting of if/for/etc/end constructs. 704 | Fixed up cursor-in-string even more to handle bol better. 705 | Fixed problem w/ syntax table installing itself in funny places 706 | and fixed the fact that tab was now treated as whitespace. 707 | 708 | 22Dec97 by Eric Ludlam 709 | Added verify/fix mode when saving. Added function name check. 710 | Added unterminated block check. Added unmatched end check. 711 | Fixed `matlab-backward-sexp' to error on mismatched end/begin blocks. 712 | 713 | 15Dec97 by Eric Ludlam 714 | Fixed some string stuff, and added checks when starting the shell. 715 | 716 | 10Dec97 by Eric Ludlam 717 | Fixed string font-locking based on suggestions from: 718 | Hubert Selhofer 719 | Peter John Acklam 720 | Tim Toolan 721 | Fixed comment with ... indenting next line. 722 | Made command output collecting much faster. 723 | 724 | 10Dec97 merged the following: 725 | 21May97 by Alf-Ivar Holm 726 | Added smart initial values of matlab help commands. 727 | Running commands in matlab-shell remembers old cmd line 728 | Commands can be run when a parial command line is waiting 729 | Changed apropo to apropos where applicable. 730 | 731 | 9Dec98 merged the following: 732 | 30May97 by Hubert Selhofer 733 | Added 'endfunction' to keyword patterns (octave), slightly 734 | changed regexp for better performance. 735 | Added 'endfunction' to `matlab-block-end-pre-no-if' for compliance 736 | with octave. 737 | Fixed `matlab-clear-vars' (symbol names were incorrectly 738 | spelled matlab-matlab-*). 739 | Fixed typo in `matlab-really-gaudy-font-lock-keywords'. 740 | 741 | 26Nov97 by Eric Ludlam 742 | Added support for cell array indenting/continuation. 743 | Begin re-enumeration to V 2.0 744 | 745 | 11Nov97 by Eric Ludlam 746 | Added custom support for [X]emacs 20. 747 | 748 | 11Nov97 by Eric Ludlam 749 | Added beginning/end-defun navigation functions. 750 | Ran through latest version of checkdoc for good doc strings. 751 | 752 | 04Sep97 by Eric Ludlam 753 | Added try/catch blocks which are new Matlab 5.2 keywords. 754 | 755 | 02Sep97 by Eric Ludlam 756 | Made auto-fill mode more robust with regard to comments 757 | at the end of source lines 758 | 759 | 13Aug97 by Eric Ludlam 760 | Fixed indentation bugs regarding the beginning of buffer. 761 | Added GUD support into matlab-shell. Debugger commands will 762 | now automatically check the stack and post the files being 763 | examined via this facility. 764 | 765 | 26Jun97 by Eric Ludlam 766 | Help/Apropo buffers are now in Topic mode, and are highlighted. 767 | This allows navigation via key-clicks through the help. 768 | Describe-command can find a default in the current M file. 769 | Mouse-face set to make clickable items mouse-sensitive in topic buffers 770 | 771 | 25Jun97 by Anders Stenman 772 | Some XEmacs hacks. Implemented highlighting of subtopics and 773 | commands under mouse in topic-browser mode. Added a nice Matlab 774 | logo in matlab-shell mode. 775 | See: http://www.control.isy.liu.se/~stenman/matlab 776 | 777 | 13Jun97 by Anders Stenman 778 | Use the easymenu package for menus. Works both in XEmacs and 779 | FSF Emacs. Bound TAB to comint-dynamic-complete-filename in 780 | matlab-shell mode. Added a function matlab-shell-process-filter 781 | to filter out some escape character rubbish from Matlab output. 782 | 783 | 20May97 by Matt Wette 784 | Released as version 1.10.0. 785 | 786 | 16May97 by Eric Ludlam 787 | Ran through checkdoc to fix documentation strings. 788 | 789 | 15May97 by Matt Wette 790 | Added shell-mode-map bindings; run matlab-shell-mode-hook, not 791 | matlab-shell-mode-hooks (PMiller). Changed keymaps for \C-, 792 | which conflicted w/ emacs style guidelines. 793 | 794 | 08May97 by Eric Ludlam 795 | Fixed forward/backward sexp error when end keyword appears as 796 | word component such as the symbol the_end 797 | 798 | 22Apr97 by Eric Ludlam 799 | Fixed comment where `indent-function' was incorrectly spelled 800 | Fixed indentation when strings contained [] characters. 801 | Fixed indentation for multi-function files 802 | Added Imenu keywords. Permits use w/ imenu and emacs/speedbar 803 | The actual version of matlab file is not in a variable 804 | Keybinding for forward/backward sexp 805 | New function finds the mfile path. Not used for anything useful yet. 806 | Added matlab-shell/emacs io scripting functions. Used this in 807 | a topic/help/apropo browser. Could be used w/ other 808 | functions quite easily. 809 | 810 | 12Mar97 by Eric Ludlam 811 | Added new `matlab-shell-collect-command-output' to use for running 812 | matlab commands and getting strings back. Used this function 813 | to create `-describe-function', `-describe-variable', and 814 | `-apropo'. Should be useful for other things too. 815 | Added some XEmacs specific stuff. 816 | 817 | 07Mar97 by Matt Wette 818 | Fixed a few xemacs problems. Released as 1.09.0. 819 | 820 | 03Mar97 by Eric Ludlam 821 | Added expressions to handle blocks which are not terminated with 822 | the 'end' command 823 | Added `matlab-shell-save-and-go' function to automatically run 824 | a function after saving it. 825 | Bug fixes to `matlab-forward-sexp' 826 | Improved font lock interface to take advantage of the user 827 | variable `font-lock-use-maximal-decoration' 828 | 829 | 24Feb97 by Eric Ludlam 830 | Added more font locking, plus font locking of `matlab-shell' 831 | Added `matlab-backward-sexp',`matlab-cursor-in-string-or-comment' 832 | Added ability to indent switch/case/case/otherwise/end blocks 833 | as per manual specifications for matlab v5.0 834 | Added command for matlab-shell to goto the last reported error 835 | Modified matlab-shell to use comint features instead of hand 836 | crafted workarounds of the defaults 837 | 838 | 07Dec96 by Matt Wette 839 | incorporated many fixes from Mats Bengtsson ; 840 | font-lock comment/string fixes, Eric Ludlam ; 841 | added support for switch construct; 842 | 843 | 01Aug96 by Matt Wette 844 | fixed to jive w/ emacs lib conventions: changed name of file from 845 | matlab-mode.el to matlab.el (14 char limit); released as 1.08.0 846 | 847 | 28Apr96 by Matt Wette 848 | comments lines w/ just % are now hilighted; syntax table: "-2" changed 849 | to " 2"; released 1.07.6 850 | 851 | 30Jan96 by Matt Wette 852 | fixed problem w/ emacs-19.30 filling and auto-fill problem thanks to 853 | Mats Bengtsson ; started implementation of matlab- 854 | shell, based on comint and shell-mode; released 1.07.5 855 | 856 | 25Jan96 by Matt Wette 857 | added "global" to font-lock, hilit keywords; fixed indenting of 2nd 858 | line if first ends in ...; filling is broken for FSF19.30 (works for 859 | FSF19.28); torkel fixes to matlab-reset-vars; fixed indent bug 860 | reported by Trevor Cooper; 861 | 862 | 20Jan96 by Matt Wette 863 | cleaned up commenting; added preliminary `matlab-shell' mode, 864 | rel 1.07.4 865 | 866 | 19Jan96 by Matt Wette 867 | commented out `debug-on-error'; got hilit to work for sam 868 | 869 | 18Jan96 by Matt Wette 870 | fixed problem int `matlab-prev-line' which caused fatal `matlab-mode'; 871 | crash fixed problem with indenting when keywords in comments; still 872 | haven't cleaned up comment formatting ... 873 | 874 | 21Jul95 by Matt Wette 875 | fixes by Bjorn Torkelsson : replaced 876 | lattr-comment w/ lattr-comm to fix inconsistency; added 877 | function to font-lock keywords, added function name to 878 | `font-lock-function-name-face'. He had also added function as 879 | a block begin keyword. This should be an option since it will 880 | cause the body of a function to be indented. Worked on 881 | filling. More work on filling. fixed many bugs reported by 882 | Rob Cunningham. Pulled cadr. 883 | 884 | 13Jul95 by Matt Wette 885 | changed indenting for continuation lines in calc-deltas to use 886 | cont-level; changed syntax-table; changed the way the return key is 887 | mapped; released version 1.07.1 888 | 889 | 08Jul95 by Matt Wette 890 | This is a fairly major rewrite of the indenting functions to 891 | fix long- startednding problems arising from keywords and 892 | percents in strings. We may have to add more heuristics later 893 | but this may work better. Changed comment region string. 894 | Released version 1.07.0. 895 | 896 | 10Oct94 by Matt Wette 897 | changed 'auto-fill-mode' to `auto-fill-function'; changed 898 | `comment-indent-' to `comment-indent-function'; fixed percents 899 | in strings being interpreted as comments, but a % for comment 900 | should not be followed by [disx%] 901 | 902 | 23Nov93 by Matt Wette 903 | added Lucid emacs, GNU emacs font-lock and lhilit support; repaired 904 | mtlb-block-{beg,end}-kw (Thanks to Dave Mellinger ) 905 | removed string delim entry from matlab-mode-syntax-table (MATLAB lang 906 | sucks here -- why not use " for strings?). Released vers 1.06.0 907 | 908 | 10Aug93 by Matt Wette 909 | added `matlab-indent-end-before-return'; indent may be fixed now 910 | still not working for emacs 19 911 | 912 | 02Aug93 by Matt Wette 913 | fixed error in `mtlb-calc-indent'; bumped version to 1.05.1; 914 | added `mtlb-prev-line'; bumped version to 1.05.3; added 915 | `mtlb-calc-block-indent' 916 | 917 | 01Aug93 by Matt Wette 918 | Fixed bug which treated form as block-begin keyword. Reworked 919 | `mtlb-calc-indent' -- seems to work better w/ redundant cont 920 | lines now. Bumbed version to 1.05. 921 | 922 | 13Jun93 by Matt Wette 923 | Changed `linea' to `lattr', `linet' to `ltype', fixed 924 | Bumped version number from 1.03bb to 1.04. 925 | 926 | 02May91 by Matt Wette, mwette@csi.jpl.nasa.gov 927 | Added `matlab-auto-fill' for `auto-fill-hook' so that this 928 | mode doesn't try to fill matlab code, just comments. 929 | 930 | 22Apr91 by Matt Wette, mwette@csi.jpl.nasa.gov 931 | Changed `mtlb-ltype-cont' to `mtlb-lattr-cont', 932 | `mtlb-ltype-comment-on-line' to `mtlb-lattr-comment' and 933 | `mtlb-ltype-unbal-mexp' to `mtlb- attr-unbal-mext' to 934 | emphasize that these are line attributes and not line types. 935 | Modified `matlab-line-type' to reflect the change ini logic. 936 | 937 | 18Apr91 by Matt Wette, mwette@csi.jpl.nasa.gov 938 | Modified `matlab-comment-return' so that when hit on a line with a 939 | comment at the end it will go to the comment column. To get the 940 | comment indented with the code, just hit TAB. 941 | 942 | 17Apr91 by Matt Wette, mwette@csi.jpl.nasa.gov 943 | Received critique from gray@scr.slb.com. Changed ml- to mtlb- 944 | due to possible conflict with mlsupport.el routines. Added 945 | `matlab-comment' -line-s and -on-line-s. Fixed bug in 946 | `matlab-comment' (set-fill-prefix). `matlab-comment-return' 947 | now works if called on a non-comment line. 948 | 949 | 04Mar91 by Matt Wette, mwette@csi.jpl.nasa.gov 950 | Added const `matlab-indent-before-return'. Released Version 1.02. 951 | 952 | 02Feb91 by Matt Wette, mwette@csi.jpl.nasa.gov 953 | Changed names of `ml-*-line' to `ml-ltype-*'. Cleaned up a 954 | lot. Added `ml-format-comment-line', fixed `ml-format-region'. 955 | Changed added "-s" on end of `matlab-comment-region' string. 956 | Justify needs to be cleaned up. 957 | 958 | Fri Feb 1 09:03:09 1991; gray@scr.slb.com 959 | Add function `matlab-comment-region', which inserts the string 960 | contained in the variable matlab-comment-region at the start 961 | of every line in the region. With an argument the region is 962 | uncommented. [Straight copy from fortran.el] 963 | 964 | 25Jan91 by Matt Wette, mwette@csi.jpl.nasa.gov 965 | Got indentation of matrix expression to work, I think. Also, 966 | added tabs to comment start regular-expression. 967 | 968 | 14Jan91 by Matt Wette, mwette@csi.jpl.nasa.gov 969 | Added functions `ml-unbal-matexp' `ml-matexp-indent' for matrix 970 | expressions. 971 | 972 | 07Jan91 by Matt Wette, mwette@csi.jpl.nasa.gov 973 | Many changes. Seems to work reasonably well. Still would like 974 | to add some support for filling in comments and handle continued 975 | matrix expressions. Released as Version 1.0. 976 | 977 | 04Jan91 by Matt Wette, mwette@csi.jpl.nasa.gov 978 | Created. Used eiffel.el as a guide. 979 | 980 | --------------------------------------------------------------------------------