├── Makefile ├── README.org ├── company-matlab-shell.el ├── doc ├── ChangeLog ├── ChangeLog.old1 └── ChangeLog.old2 ├── matlab-debug.el ├── matlab.el ├── semantic-matlab.el ├── semanticdb-matlab.el └── toolbox ├── Makefile ├── dbhotlink.m ├── dl_emacs_support.m ├── em_who.m ├── emacs_dbstack.m ├── emacsdocomplete.m ├── emacsinit.m └── opentoline.m /Makefile: -------------------------------------------------------------------------------- 1 | # Automatically Generated Makefile by EDE. 2 | # For use with: make 3 | # Relative File Name: Makefile 4 | # 5 | # DO NOT MODIFY THIS FILE OR YOUR CHANGES MAY BE LOST. 6 | # EDE is the Emacs Development Environment. 7 | # http://cedet.sourceforge.net/ede.shtml 8 | # 9 | 10 | top="$(CURDIR)"/ 11 | ede_FILES=Project.ede Makefile 12 | 13 | CEDET_PATH:=~/cedet/trunk/lisp 14 | 15 | EMACS=emacs 16 | EMACSFLAGS=-batch --no-site-file --eval '(setq debug-on-error t)' 17 | LOADPATH= ./ $(CEDET_PATH)/cedet/ 18 | require=$(foreach r,$(1),(require (quote $(r)))) 19 | LOADDEFS=matlab-load.el 20 | LOADDIRS=. 21 | misc_MISC=ChangeLog ChangeLog.old1 ChangeLog.old2 INSTALL README dl_emacs_support.m 22 | lisp_LISP=matlab.el mlint.el tlc.el matlab-publish.el linemark.el 23 | cedet_LISP=semantic-matlab.el semanticdb-matlab.el srecode-matlab.el cedet-matlab.el company-matlab-shell.el 24 | VERSION=3.3.2 25 | DISTDIR=$(top)matlab-emacs-$(VERSION) 26 | 27 | 28 | 29 | all: autoloads misc lisp cedet toolbox Templates 30 | 31 | .PHONY: clean-autoloads 32 | clean-autoloads: 33 | rm -f $(LOADDEFS) 34 | 35 | .PHONY: autoloads 36 | autoloads: 37 | $(EMACS) $(EMACSFLAGS) $(AUTOGENFLAGS) $(addprefix -L ,$(LOADPATH)) --eval '(progn $(call require, $(PRELOADS)) (setq generated-autoload-file "$(abspath $(LOADDEFS))"))' -f batch-update-autoloads $(abspath $(LOADDIRS)) 38 | 39 | 40 | misc: 41 | @ 42 | 43 | %.elc: %.el 44 | $(EMACS) $(EMACSFLAGS) $(addprefix -L ,$(LOADPATH)) --eval '(progn $(call require, $(PRELOADS)))' -f batch-byte-compile $^ 45 | 46 | .PHONY: lisp 47 | lisp: $(addsuffix c, $(lisp_LISP)) 48 | 49 | .PHONY: cedet 50 | cedet: $(addsuffix c, $(cedet_LISP)) 51 | 52 | .PHONY:toolbox 53 | toolbox: 54 | $(MAKE) -C toolbox 55 | 56 | .PHONY:Templates 57 | Templates: 58 | $(MAKE) -C templates 59 | 60 | tags: 61 | $(MAKE) -C toolbox/ $(MFLAGS) $@ 62 | $(MAKE) -C templates/ $(MFLAGS) $@ 63 | 64 | 65 | clean: 66 | rm -f *.elc 67 | 68 | .PHONY: dist 69 | 70 | dist: autoloads 71 | rm -rf $(DISTDIR) 72 | mkdir $(DISTDIR) 73 | cp matlab-load.el $(misc_MISC) $(lisp_LISP) $(cedet_LISP) $(ede_FILES) $(DISTDIR) 74 | $(MAKE) -C toolbox $(MFLAGS) DISTDIR=$(DISTDIR)/toolbox dist 75 | $(MAKE) -C templates $(MFLAGS) DISTDIR=$(DISTDIR)/templates dist 76 | tar -cvzf $(DISTDIR).tar.gz $(DISTDIR) 77 | rm -rf $(DISTDIR) 78 | 79 | Makefile: Project.ede 80 | @echo Makefile is out of date! It needs to be regenerated by EDE. 81 | @echo If you have not modified Project.ede, you can use 'touch' to update the Makefile time stamp. 82 | @false 83 | 84 | 85 | 86 | # End of Makefile 87 | -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | * Matlab-emacs Project: 2 | MATLAB and Emacs integration 3 | ** INSTALL 4 | Add the following to your .emacs file: 5 | 6 | #+begin_src elisp 7 | ;; Replace path below to be where your matlab.el file is. 8 | (add-to-list 'load-path "~/path/to/matlab-emacs") 9 | (load-library "matlab-load") 10 | 11 | ;; Enable CEDET feature support for MATLAB code. (Optional) 12 | ;; (matlab-cedet-setup) 13 | #+end_src 14 | 15 | ** MELPA 16 | 17 | GNU emacs (sorry Xemacs folks) users (version >=24) can use the 18 | package as provided by MELPA. 19 | Set 20 | 21 | #+begin_src elisp 22 | (add-to-list 'package-archives 23 | '("melpa" . "http://melpa.org/packages/") t) 24 | #+end_src 25 | And then run 26 | M-x 27 | package-list-packages 28 | 29 | 30 | 31 | ** Releases 32 | 33 | The most recent version of matlab.el is always in GIT. 34 | 35 | You can get an old downloader for matlab-emacs from MATLAB File Exchange. 36 | 37 | Category: 38 | http://www.mathworks.com/matlabcentral/fileexchange/loadCategory.do?objectId=19&objectType=Category 39 | This File 40 | http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=104&objectType=file 41 | 42 | Older versions of matlab.el can be found as matlab.el.1.10.1 43 | for emacsen that do not have the latest additional utilities such 44 | as tempo and derived. 45 | 46 | matlab.el and mlint.el has shipped on MATLAB CDs starting with 6.5 47 | (R13). Updates after a release of MATLAB will be made to MATLAB 48 | Central and announced on the mailing list. 49 | 50 | matlab.el and mlint.el will no longer ship on MATLAB CDs starting 51 | with MATLAB release R2008b. If you are using a version of MATLAB 52 | from before R2008a, you will want to use the version of mlint from 53 | that CD. 54 | 55 | ** GIT 56 | 57 | matlab-emacs is *now* available via GIT from SourceForge. The CVS 58 | repository is still at SourceForge but it is *no* longer updated. 59 | 60 | Homepage: 61 | http://matlab-emacs.sf.net 62 | 63 | Project Page: 64 | http://sourceforge.net/projects/matlab-emacs 65 | 66 | GIT Repository: 67 | 68 | https://sourceforge.net/p/matlab-emacs/src/ci/master/tree/ 69 | 70 | You need a git client on your machine. Then just run 71 | 72 | #+begin_src shell 73 | git clone git://git.code.sf.net/p/matlab-emacs/src matlab-emacs-src 74 | #+end_src 75 | 76 | If you do not have a GIT client on your machine, you can use the 77 | MATLAB script dl_emacs_support.m to download a fresh copy of the 78 | matlab.el sources. 79 | https://sourceforge.net/p/matlab-emacs/src/ci/master/tree/dl_emacs_support.m 80 | 81 | 82 | ** Dependencies 83 | 84 | MATLAB-Emacs can use the CEDET suite for the following items: 85 | - Modifying the build system (Makefiles, etc) 86 | - mlint (uses EIEIO object system) 87 | - parsing/completion (uses semantic parsing system) 88 | - some template insertion features 89 | 90 | As of Emacs 23.2, CEDET is included in Emacs, and nothing extra 91 | is needed to satisfy that dependency. 92 | 93 | For older versions of Emacs: 94 | 95 | See http://cedet.sf.net for downloading CEDET. 96 | 97 | If you only want to use matlab.el for editing code or running the 98 | MATLAB shell, you DO NOT need to install CEDET. 99 | 100 | If you do want to use CEDET, add the following to your .emacs file: 101 | #+begin_src elisp 102 | (matlab-cedet-setup) 103 | #+end_src 104 | 105 | ** New Mailing List 106 | 107 | A new matlab-emacs-discuss mailing lisit has been created at 108 | SourceForge. Use this list to get updates on new releases and 109 | discuss topics relivant to the matlab-emacs project. 110 | 111 | http://lists.sourceforge.net/mailman/listinfo/matlab-emacs-discuss 112 | 113 | ** Old Mailing List 114 | 115 | The original mailing list where beta versions of matlab.el were 116 | posted, and where comments, questions, bug reports, and answers to 117 | questions could be sent. If you were subscribed to this list, 118 | please unsubscribe, and subscribe to the new list above. 119 | 120 | to unsubscribe, send email with the body of: "unsubscribe matlab-emacs" 121 | 122 | ** Known problems 123 | 124 | *** Unable to open .m files in matlab with Emacs 125 | 126 | From: Xu He wrote: 127 | 128 | Dear all, 129 | 130 | Following the install guide, I setup the matlab-emacs on my ubuntu 12.04 131 | system, and I can edit and run the m file with emacs. 132 | 133 | But I can not open nor edit m file with matlab. When I open the file in the matlab window, 134 | nothing happens. 135 | 136 | I tried to eliminate the lines about matlab-emacs in ~/.emacs file, but the 137 | problem can not be solved. 138 | 139 | I need to edit and run the file in matlab. Thanks for any help. 140 | 141 | Best regards, 142 | Xu He 143 | 144 | *** Solution 145 | 146 | From: Hunter McClelland [mailto:hunter.mcclelland@gmail.com] 147 | Till we discovered that Matlab-emacs changes the "Editor" matlab uses. 148 | Go to Preferences->Editor/debugger and change the Editor back to 149 | "MATLAB Editor". 150 | -------------------------------------------------------------------------------- /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) (line-end-position))) 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) (line-end-position)) 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) (line-end-position))) 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 | -------------------------------------------------------------------------------- /doc/ChangeLog: -------------------------------------------------------------------------------- 1 | 2016-03-17 Uwe Brauer 2 | 3 | * toolbox/dbhotlink.m (dbhotlink): new file 4 | 5 | 2016-03-17 Uwe Brauer 6 | 7 | * matlab.el (matlab-shell-mode): Applied patch from Odd Andersen 8 | . 9 | 10 | 2016-03-16 Uwe Brauer 11 | 12 | * dl_emacs_support.m (getfiles): update the url and README-->README.org 13 | 14 | 2016-02-09 Uwe Brauer 15 | 16 | * matlab.el (matlab-mode-version): Change version number to 17 | 3.3.3 18 | 19 | * matlab-publish.el (matlab-select-publish-form): Cleanup file 20 | 21 | * matlab.el (matlab-change-current-directory): Applied patch, 22 | from an unknown source found in http://sourceforge.net/p/matlab-emacs/patches/2/ 23 | Purpose: add the possibility to switch the matlab directory to the 24 | current one. 25 | 26 | * matlab.el (matlab-shell): Applied patch 27 | from http://sourceforge.net/p/matlab-emacs/patches/2/ 28 | which results in 29 | (define-key km (kbd "TAB") 'matlab-shell-tab) 30 | 31 | 2016-02-09 Uwe Brauer 32 | 33 | Imported from CVS to git. 34 | 35 | 2014-11-05 zappo 36 | 37 | * Makefile: (VERSION) Updated. 38 | (all, tags, dist): Add toolbox 39 | (toolbox): New rule 40 | 41 | * Project.ede (:version): Updated 42 | 43 | * templates/Makefile (VERSION): Update to minor rev. 44 | 45 | * toolbox/Makefile: Makefile for toolbox. 46 | 47 | * toolbox/Project.ede: Project file for toolbox. 48 | 49 | * INSTALL (tlc.el): Fix typo. 50 | 51 | * matlab.el (matlab-shell-completion-list): 52 | remove custom call to MCR with call to emacsdocomplete.m in the matlab-emacs toolbox directlry. 53 | 54 | * toolbox/emacsdocomplete.m: 55 | Command for getting completions from MATLAB for matlab-shell. 56 | 57 | 2014-11-05 zappo 58 | 59 | * matlab.el (matlab-shell-completion-list): 60 | remove custom call to MCR with call to emacsdocomplete.m in the matlab-emacs toolbox directlry. 61 | 62 | * toolbox/emacsdocomplete.m: 63 | Command for getting completions from MATLAB for matlab-shell. 64 | 65 | 2014-09-24 zappo 66 | 67 | * .cvsignore: First checkin. 68 | 69 | 2014-09-23 zappo 70 | 71 | * matlab.el (matlab-shell-font-lock-keywords): 72 | Tweak to support some changes in error output. 73 | (matlab-comment): For comment on same line. If we run out of space (fill-column) 74 | pull the comment closer to the code. 75 | (matlab-auto-fill): When filling a string, improve checking of when to add brackets 76 | around the string. 77 | (matlab-shell-mode): Disable html rendering trickery. 78 | (gud-matlab-error-regexp): Add a new variant (off by default) as reminder to 79 | go back and get the current ones to handle newer MATLAB error format. 80 | 81 | 2014-03-07 zappo 82 | 83 | * mlint.el (mlint-minor-mode): Remove make-local-hook for Emacs 24. 84 | 85 | 2013-08-29 zappo 86 | 87 | * semantic-matlab.el (semantic/dep): New dependency (Emacs 24) 88 | (semantic-matlab-parse-oldstyle-class): Add 'method' local var to tidy 89 | compile warnings. 90 | 91 | 2013-08-26 zappo 92 | 93 | * matlab.el (matlab-mode-version): Bump very-minor versin. 94 | (matlab-ltype-comm): Add support for block comment detection. 95 | (matlab-ltype-block-comm): New fcn. 96 | (matlab-shell): Add TAB binding for TAB for when (tab) doesn't work. 97 | Add support for setting WINDOWID environment variable so that MATLAB 98 | will bring Emacs forward when typing in a figure. 99 | 100 | 2013-04-02 zappo 101 | 102 | * README: Update to discuss CEDET that comes with Emacs. 103 | 104 | * INSTALL: Update to note latest build notes. 105 | 106 | * Makefile: Regenerated 107 | Added CEDET_PATH variable if someone wants to download the latest from bzr. 108 | 109 | * Project.ede (:version): Updated 110 | (lisp): Add linemark.el 111 | 112 | * matlab-load.el: Regenerated. 113 | 114 | * dl_emacs_support.m (coreFiles): Add linemark.el to download list. 115 | 116 | * linemark.el: 117 | Add linemark to matlab-emacs dist so that mlint will work 118 | with the version of CEDET integrated with Emacs. 119 | 120 | * cedet-matlab.el (matlab-cedet-setup): 121 | Update srecode require to work w/ CEDET 122 | integrated w/ Emacs. 123 | 124 | * semantic-matlab.el (misc require statements): 125 | Updated to work w/ CEDET integrated w/ Emacs. 126 | 127 | * semanticdb-matlab.el (misc require statements): 128 | Updated to work w/ CEDET integrated w/ Emacs. 129 | (semanticdb-matlab-scan-directories): Remove references to `working'. 130 | (semanticdb-matlab-cache-files): Remove references to `working'. 131 | 132 | * templates/Makefile (VERSION): Updated. 133 | 134 | 2012-02-23 zappo 135 | 136 | * matlab.el (matlab-mode): 137 | Change page-delimeter to allow any whitespace or \n after a %%. 138 | 139 | 2011-10-05 zappo 140 | 141 | * matlab.el (matlab-ltype-endfunction-comm): 142 | If the endfunction comment occurs on 143 | a line, but the next bit of code isn't part of an enclosing fcn, then no. 144 | (matlab-shell-mode): Patch from Eli Merriam; 145 | make comint-input-filter-functions buffer local. 146 | Add matlab-shell-render-html-txt-format hook to comint. 147 | (matlab-txt-format-beg, matlab-txt-format-end): New 148 | (matlab-shell-render-html-txt-format): New. 149 | (matlab-shell-last-anchor-as-frame): New. 150 | (matlab-shell-render-errors-as-anchor): Use last anchor var above. 151 | Note: Not used for any logic yet. ;( 152 | (matlab-shell-previous-matching-input-from-input): patch; Mark Histed 153 | Force cursor to eol. 154 | (matlab-shell-run-region): Force displayed buffer to recycled visible buffers. 155 | 156 | 2011-08-10 davenar 157 | 158 | * matlab.el (matlab-shell-mode): 159 | Add `comint-postoutput-scroll-to-bottom' to 160 | `comint-output-filter-functions' (suggested by Mark Histed). 161 | 162 | 2011-08-09 davenar 163 | 164 | * matlab.el (matlab-shell-run-region): 165 | Fix last commit and correctly use 166 | `buffer-substring' again. 167 | 168 | * matlab.el (matlab-shell-run-region): 169 | When removing comments, do not touch matlab 170 | strings or we might remove format specifiers. 171 | 172 | 2011-07-17 davenar 173 | 174 | * matlab.el (matlab-shell-run-region): 175 | Remove all comments before running a 176 | region, otherwise `matlab-shell-run-cell' will break. 177 | 178 | * matlab.el (matlab-shell-run-region): 179 | Remove comment lines. If NOSHOW, also 180 | remove continuations. 181 | 182 | * matlab.el (matlab-shell-run-region): 183 | New optional argument NOSHOW to replace 184 | newlines with commas, so that by default this will not be done. 185 | (matlab-shell-run-cell): Use it. 186 | 187 | 2011-06-16 zappo 188 | 189 | * matlab.el (matlab-shell-render-html-anchor): 190 | Add arbitrary reverse-search limit 191 | to improve performance when the output buffer gets large. 192 | 193 | 2011-03-23 zappo 194 | 195 | * matlab.el (matlab-shell-use-emacs-toolbox): Fix to use let* 196 | 197 | * matlab.el (matlab-shell-running-matlab-release): 198 | Make more robust if matlab.el 199 | is not on the path. 200 | (matlab-shell-window-exists-for-display-completion-flag): New flag 201 | (matlab-shell-tab): Update to set window exists flag (above) when 202 | showing completions, and call hide-completions (below) when done 203 | completing. 204 | (matlab-shell-tab-hide-completions): New. 205 | 206 | 2010-12-08 zappo 207 | 208 | * matlab.el (matlab-mode): 209 | Move line that moves point to end of buffer to just 210 | in front of where it is used, and inside a save-excursion. 211 | 212 | 2010-12-06 zappo 213 | 214 | * matlab.el: Patch from Rudiger Sonderfeld 215 | (matlab-frame-init): Add a "switch to" in addition to "start" matlab 216 | menu item to make it clear what will happen. 217 | 218 | 2010-10-20 zappo 219 | 220 | * mlint.el (mlint-platform): 221 | Get smarter about returning the kind of MAC and WIN supported. 222 | (mlint-minor-mode): Don't disable verify on save since there is still useful stuff there. 223 | 224 | 2010-10-14 zappo 225 | 226 | * dl_emacs_support.m: Patch from: Joe Vornehm 227 | (coreFiles): Add matlab-publish.el and company-matlab-shell.el 228 | (mktemplatedir,mktoolboxdir): Pay attention to destination argument. 229 | 230 | 2010-09-14 zappo 231 | 232 | * matlab.el (matlab-mode): 233 | Wrap guessing of indentation in a save-excursion. 234 | and running of hooks in a save excursion so point can be moved during 235 | checking for the indentation style. 236 | (matlab-toggle-show-mlint-warnings) 237 | (matlab-toggle-highlight-cross-function-variables): 238 | Always call mlint-minor-mode after a change, but pass in a numeric arg 239 | to force on or off dependent on the current state. 240 | 241 | 2010-07-29 zappo 242 | 243 | * mlint.el (mlint-run): Fix case where mlint-program was buffer local. 244 | 245 | 2010-07-28 zappo 246 | 247 | * matlab.el (gud-matlab-error-regexp): 248 | Patch from EricW: Fix for more error types. 249 | (matlab-shell-run-region): Add hack for replacing CR w/ ,. 250 | (matlab-shell-last-error): Fix call to find other window call so 0 is a str. 251 | 252 | * mlint.el (mlint-program-selection-fcn): New option. 253 | (mlint-minor-mode): Use above to select an mlint program. 254 | 255 | 2010-04-06 zappo 256 | 257 | * matlab.el (matlab-shell-html-map): Update how it is initialized. 258 | Add binding for return 259 | (matlab-anchor-beg): Add to expression to remove "matlab:" 260 | (matlab-shell-render-html-anchor): Add help-echo. 261 | (gud-matlab-error-regexp): Improve for newere MATLABs 262 | (matlab-shell-last-error-anchor): New 263 | (matlab-shell-render-errors-as-anchor): No longer depend on deleted 264 | stack start/end variables which seem to no longer be active. 265 | Add help-echo to overlay. 266 | Change how 'first' is calculated, apply after the fact. 267 | (gud-matlab-marker-filter):Don't collect if prompt hasn't been seen yet. 268 | (matlab-shell-html-click): Now use below 269 | (matlab-shell-html-go): New from above. 270 | 271 | 2010-01-21 zappo 272 | 273 | * INSTALL: Fix path to not say "matlab.el" 274 | 275 | 2010-01-13 zappo 276 | 277 | * matlab.el (gud-matlab-marker-filter): Don't filter out backspace. 278 | In section collecting whole error strings, wait for \n, not the prompt. 279 | 280 | 2010-01-05 zappo 281 | 282 | * matlab.el (matlab-mode-version): Update minor version number. 283 | (matlab-indent-function-body): Add 'MathWorks-Standard option. 284 | (matlab-functions-have-end-minor-mode): Add code to flip the 285 | `matlab-functions-have-end' variable. 286 | (matlab-do-functions-have-end-p): New. 287 | (matlab-indent-function-body-p): New function. 288 | (matlab-mode): First detect if fcns have end, save. 289 | Next detect indenting fcn bodies based on 'guess. 290 | (matlab-calculate-indentation-1, matlab-next-line-indentation) 291 | (matlab-frame-init): 292 | Use fcn form of indent-function-body. 293 | 294 | 2009-12-23 zappo 295 | 296 | * INSTALL: Fix typo about augmenting the load path. 297 | 298 | 2009-11-16 zappo 299 | 300 | * semanticdb-matlab.el (semanticdb-matlab-include-paths): 301 | Only set default to ~/matlab if it exists. 302 | 303 | 2009-09-23 zappo 304 | 305 | * matlab.el (matlab-shell-tab): 306 | Add '.' to list of chars that limit completion. 307 | This enables structure completion. 308 | 309 | 2009-09-15 zappo 310 | 311 | * README: Change load-path setup line. 312 | 313 | 2009-09-03 zappo 314 | 315 | * matlab.el (matlab-shell-mode): 316 | Add debugging next, and fix step to step in. 317 | 318 | * matlab.el (gud-matlab-marker-filter): Remove debug message. 319 | 320 | * matlab.el (matlab-shell-mode): 321 | Add matlab-shell-render-errors-as-anchor to 322 | comint-output-filter-functions. 323 | (matlab-anchor-beg,matlab-anchor-end) 324 | (gud-matlab-marker-regexp-1,gud-matlab-marker-regexp-2): Moved. 325 | (gud-matlab-marker-regexp-prefix): Updated. 326 | (gud-matlab-error-regexp): Updated. 327 | (matlab-last-frame-returned): Deleted. 328 | (gud-matlab-error-regexp): Updated. 329 | (matlab-shell-render-html-anchor): Remove debugger jumping code. 330 | (matlab-shell-error-stack-start, matlab-shell-error-stack-end): New 331 | (matlab-shell-render-errors-as-anchor): New. 332 | (gud-matlab-marker-filter): Remove support for MATLAB 5 debugging. 333 | I don't think it would have worked anyway. (matlab-one-db-request stuff). 334 | For frame calculations, query out of gud-marker-acc instead of scanning the buffer 335 | which was unreliable. 336 | When stripping individual lines from the return buffer, only do so if 337 | there is no telltale sign of debugger output. 338 | (matlab-url-stack-top-at): New. 339 | (matlab-shell-previus-matlab-url):Call above is new arg is t. 340 | (matlab-find-other-window-file-line-column): Be robust to more types 341 | of file names that might not have .m on the end. 342 | (matlab-shell-last-error): Specify there might be a stack, and choose the top. 343 | 344 | 2009-08-21 zappo 345 | 346 | * matlab-load.el: Regenerated. 347 | 348 | * mlint.el (mlint-minor-mode): Add autoload cookie. 349 | 350 | * matlab.el (mline): Remove require. 351 | (matlab-functions-have-end-minor-mode): Remove bogus doc string (copy paste bug). 352 | 353 | * dl_emacs_support.m: Add toolbox M files, and toolbox constructor. 354 | 355 | 2009-08-13 zappo 356 | 357 | * matlab.el (mlint): Add require. 358 | (defcustom, etc): Delete old backward compatable stuff for Emacs 19. 359 | (matlab-toggle-functions-have-end-minor-mode): Moved to supress 360 | byte compile warnings. 361 | (matlab-font-lock-nested-function-keyword-match) 362 | (matlab-font-lock-cross-function-variables-match): Make overlay a local variable. 363 | (matlab-mode): Comments about byte-comp warnings. 364 | (gud-matlab-marker-filter,matlab-find-other-window-file-line-column): 365 | Use string-to-number. 366 | (matlab-shell-run-region-or-line): New new mechanism w/ transient-mark-mode. 367 | (matlab-shell-topic-highlight-line): Add comment. 368 | 369 | * matlab.el: Misc: Add (R) to some occurances of MATLAB. 370 | OBSOLETE STUFF: 371 | (matlab-hilit19-patterns,fume-function-name-regexp-matlab) 372 | (fume-find-next-matlab-function-name,matlab-mode-hilit): Delete 373 | (matlab-imenu-generic-expression): Get rid of fume use. 374 | INDENT FIX: 375 | (matlab-valid-end-construct-p,matlab-lattr-block-close) 376 | (matlab-calc-indent,matlab-calculate-indentation) 377 | (matlab-calculate-indentation-1): Handle multiple ends on one line. 378 | MATLAB EDITOR UPDATE: 379 | (matlab-shell-history-file): Calculate from below. 380 | (matlab-shell-running-matlab-version, matlab-shell-running-matlab-release) 381 | (matlab-shell-use-emacs-toolbox, matlab-shell-emacsclient-command): 382 | New variables. 383 | (matlab-shell,matlab-shell-hack-logo,matlab-shell-mode) 384 | (gud-matlab-marker-filter): 385 | Calc version from output. 386 | (matlab-shell-version-scrape): New, for above. 387 | (matlab-shell-next-matching-input-from-input) 388 | (matlab-shell-prev-matching-input-from-input): New commands. 389 | (matlab-find-other-window-via-url): Support opentoline links. 390 | 391 | * toolbox/emacsinit.m, toolbox/opentoline.m: 392 | Support calling Emacs from MATLAB via edit commands. 393 | 394 | 2009-07-07 zappo 395 | 396 | * INSTALL: Fix LOADPATH discussion. 397 | 398 | * matlab-load.el: Rebuild using Emacs 23. 399 | Adds a provide statement. 400 | 401 | 2009-07-07 davenar 402 | 403 | * ChangeLog, semanticdb-matlab.el (semanticdb-matlab-scan-directories): 404 | Local bind for working-spinner-display. 405 | 406 | 2009-07-07 David Engster 407 | 408 | * semanticdb-matlab.el (semanticdb-matlab-scan-directories): Local 409 | bind for working-spinner-display. 410 | 411 | 2009-07-06 Eric Ludlam 412 | 413 | * company-matlab-shell.el: Company mode support for matlab-shell. 414 | 415 | * README: Added notes on CEDET use. 416 | Added notes on on the MATLAB download script. 417 | 418 | * matlab.el (matlab-mode-version): Update. 419 | 420 | * matlab-publish.el: Utilities for editing MATLAB files for publishing 421 | 422 | * templates/srecode-matlab.srt: SRecode templates for MATLAB Script. 423 | 424 | * semantic-matlab.el: Remove automatic init hook. See cedet-matlab.el 425 | 426 | * cedet-matlab.el: Initialization support for CEDET tools with MATLAB. 427 | 428 | * dl_emacs_support.m: Convenience download script. 429 | 430 | * matlab.el (matlab-indent-function-body): 431 | Allow a value of 'guess, meaning 432 | to guess the indentation style of a pre-existing file. 433 | (matlab-keyword-list,matlab-font-lock-keywords) 434 | (matlab-block-beg-pre-if,matlab-block-beg-pre-no-if) 435 | (matlab-keywords-solo,matlab-quiesce-nosemi-regexp): 436 | Add spmd. 437 | 438 | 2008-10-17 Eric Ludlam 439 | 440 | * matlab.el: Add enumeration support. 441 | 442 | 2008-09-18 David Engster 443 | 444 | * semanticdb-matlab.el (semanticdb-find-tags-by-name-method): 445 | Use our own database as 446 | fall-back method. 447 | (semanticdb-find-tags-for-completion-method): Combine results from 448 | MATLAB shell and our own database. 449 | 450 | 2008-09-08 David Engster 451 | 452 | * semantic-matlab.el: (semantic-ctxt-current-symbol) 453 | (semantic-ctxt-current-symbol-and-bounds): Return nil when no symbol 454 | at point. 455 | 456 | * semantic-matlab.el (semantic-matlab-parse-assignments): 457 | Deal with class methods which 458 | return same class and be more tolerant with whitespaces. 459 | 460 | * semantic-matlab.el (semantic-matlab-parse-assignments): 461 | Fix bug in parsing limit. Don't parse 462 | current line. Deal with class attribute assignments. 463 | 464 | 2008-09-07 David Engster 465 | 466 | * semanticdb-matlab.el (semanticdb-matlab-user-class-cache): 467 | New variable. 468 | (semanticdb-matlab-cache-files): New function for caching files and 469 | classes. 470 | (semanticdb-matlab-find-name): Use it. 471 | (semantic-ctxt-current-class-list): Deal with classes and structures. 472 | 473 | * semantic-matlab.el: (semantic-matlab-parse-oldstyle-class) 474 | (semantic-matlab-find-oldstyle-classes): New functions. 475 | (semantic-matlab-parse-region): Cache files. Use new functions for 476 | parsing classes. 477 | (semantic-matlab-type-hint-string): New variable. 478 | (semantic-matlab-parse-assignments): New function. 479 | (semantic-get-local-variables): New override. 480 | (semantic-ia-insert-tag): Deal with method completions. 481 | (semantic-ctxt-current-symbol) 482 | (semantic-ctxt-current-symbol-and-bounds): New overrides. 483 | 484 | * semantic-matlab.el (semantic-matlab-root-directory): Follow symlink. 485 | 486 | 2008-09-05 Eric Ludlam 487 | 488 | * semanticdb-matlab.el (semanticdb-find-tags-by-name-method): 489 | Fixed to handle case where 490 | matlab lies about the doc file location. 491 | (semanticdb-find-tags-for-completion-method): Adapt to use 492 | matlab-shell when available. 493 | 494 | * semanticdb-matlab.el (semanticdb-find-tags-by-name-method): 495 | Use matlab-shell if available. 496 | 497 | * semantic-matlab.el (semantic-matlab-root-directory): New Function. 498 | (semantic-matlab-function-tags): Update to use above. 499 | 500 | * matlab.el (matlab-shell-which-fcn): Append .m to builtin. 501 | (matlab-shell-matlabroot): New 502 | (matlab-shell-collect-command-output): Stop displaying status messages. 503 | 504 | * matlab.el: (matlab-shell-completion-list): 505 | Enabled to work in a non-shell buffer by switching over. 506 | (matlab-shell-which-fcn): New. 507 | 508 | * INSTALL: 509 | Revies to new matlab-load.el style. Discuss use w/out the Makefile. 510 | Remove semantic-matlab.el doc, it needs a re-write. 511 | 512 | * Makefile (LOADPATH): Add semantic/bovine 513 | 514 | * Project.ede (cedet): Add semantic-el dependency. 515 | 516 | * Makefile (LOADPATH): Now includes semantic. 517 | (cedet_LISP): New veriables. 518 | (cedet): New target. 519 | (dist): Add the cedet support files. 520 | 521 | * Project.ede ("lisp"): Added versionsource file. 522 | ("semantic"): New target 523 | 524 | * matlab.el (matlab-vers-on-startup): Set default to off. 525 | (auto-mode-alist): Add .m files. 526 | (matlab-block-end-pre-no-iff): Fix if/else order typo. 527 | 528 | * README: Update to latest information on installing matlab.el 529 | 530 | 2008-09-02 Eric Ludlam 531 | 532 | * mlint.el (mlint-platform): 533 | Use string-match to determine 64 bit linux-ness. 534 | (mlint-flags): Remove -fix until I get around to supporting it. 535 | 536 | 2008-09-01 David Engster 537 | 538 | * semanticdb-matlab.el: Fix doc-strings. 539 | 540 | * semantic-matlab.el (semantic-idle-summary-function): 541 | Use defvar-mode-local instead of 542 | make-local-variable. 543 | 544 | 2008-08-31 David Engster 545 | 546 | * semantic-matlab.el (semantic-format-tag-prototype): 547 | New overload for matlab-mode. 548 | (semantic-idle-summary-format-matlab-mode): New function, also 549 | displays doc-string. 550 | (semantic-ia-insert-tag): Use it. 551 | (semantic-default-matlab-setup): Bind `semantic-idle-summary-function'. 552 | 553 | * semantic-matlab.el: Unconditional require of semanticdb-matlab. 554 | (semantic-matlab-function-tags): Better parsing of doc strings. 555 | Return flag for builtin functions. 556 | (semantic-matlab-sort-raw-tags): Include new :builtin attribute. 557 | 558 | 2008-08-30 David Engster 559 | 560 | * INSTALL: Added section for semantic-matlab.el 561 | 562 | * semantic-matlab.el (semantic-matlab-system-paths-include): 563 | New variable. 564 | (semantic-matlab-dependency-system-include-path): Use it. 565 | (semantic-matlab-root-directory): Take everything until '/bin' as 566 | MATLAB root. 567 | 568 | * semanticdb-matlab.el: 569 | New file. Semantic database extensions for MATLAB. 570 | 571 | 2008-08-22 Eric Ludlam 572 | 573 | * semantic-matlab.el (semantic-matlab-dependency-system-include-path): 574 | Value should be a list. 575 | 576 | * semantic-matlab.el: Changes contributed by: David Engster 577 | (semanticdb-matlab): Conditional load. 578 | (semeantic-matlb-root-directory): New variable 579 | (semantic-matlab-match-function-re): Support _ 580 | (semantic-matlab-function-tags): Support loading doc strings. 581 | (semantic-matlab-sort-raw-tags): Support doc strings. 582 | (semantic-matlab-dependency-system-include-path) 583 | (semantic-matlab-display-docstring): New variables 584 | (semantic-ia-insert-tag): New overload function. 585 | 586 | 2008-08-05 Eric Ludlam 587 | 588 | * matlab.el (matlab-shell-ask-MATLAB-for-completions): 589 | Change default to t. 590 | Patch from David Engster: 591 | (matlab-shell-completion-list): Set scroll-show-maximum-output to nil. 592 | (matlab-shell-tab): Improve completion list extraction. 593 | 594 | 2008-08-01 Eric Ludlam 595 | 596 | * mlint.el (mlint-symtab-info): New variable. 597 | (mlint-run): Init symtab local var. 598 | Fixed symbol table parsing to work with newer mlint. 599 | 600 | * matlab.el (matlab-block-indent-toc-toc-flag): 601 | New variable. Default nil. 602 | (matlab-block-beg-pre-if, matlab-block-beg-pre-no-if) 603 | (matlab-block-end-pre-if, matlab-block-end-pre-no-if): 604 | If the tic-toc flag is nil, don't indent tic/tocs. 605 | 606 | 2008-05-19 Eric Ludlam 607 | 608 | * semantic-matlab.el: Copied from cedet repository. 609 | 610 | * matlab.el (matlab-keyword-list): Add mcos keywords 611 | (matlab-defun-regex, matlab-block-beg-pre-if, matlab-block-beg-pre-no-if): 612 | Updated w/ mcos keywords. 613 | 614 | * mlint.el (mlint-calculate-cyclic-complexity-flag): New flag. 615 | (mlint-flags): Add -fix 616 | (mlint-run): Use cyclic-complexity flag. 617 | 618 | * matlab.el (matlab-mode-version): Update 619 | (matlab-cellbreak-face): Fancy new face for cell-breaks. 620 | (matlab-font-lock-adjustments): Update cellbreak face. 621 | (matlab-font-lock-keywords): Add cellbreak highlighting. 622 | (matlab-mode): Fix spelling in indent-sexp keybinding to doc. 623 | 624 | 2007-03-06 Eric Ludlam 625 | 626 | * mlint.el: 627 | (mlint-clear-warnings, mlint-clear-cross-function-variable-highlighting): 628 | Make font-lock optional. 629 | 630 | 2007-01-08 Eric Ludlam 631 | 632 | * matlab.el: (matlab-block-end-pre-if, matlab-block-end-pre-no-if): 633 | Support assigning toc into a subs-assign. (Thanks Jim Van Zant) 634 | 635 | 2006-10-04 Eric Ludlam 636 | 637 | * mlint.el (mlint-output-regex): 638 | Support the changed mlint output syntax 639 | (mlint-symtab-line-regexp): Support changed mlint table output syntax 640 | (mlint-warning-code-alist): Obsolete 641 | (mlint-error-fix-alist): Obsolete 642 | (mlint-error-id-fix-alist): New version of the old error-fix-alist. 643 | (mlint-run): Add the "-edit" flag when highlighting crossfunction variables. 644 | Updated parsing of the mlint table for highlighting cross-function variables. 645 | Updated mechanism for highlighting the cross-function variables. 646 | (mlint-lm-entry): Update warningid doc. 647 | (mlint-warning->class, mlint-warningid->class): Name change. Use new table of warning ids 648 | instead of parsing warning strings. 649 | (linemark-new-entry): Use warning id, not warning string for class determination. 650 | (mlint-lm-replace-focus): new-text is no longer class allocated. 651 | (mlint-lm-entry-depricated): New class rule. 652 | (mlint-lm-entry-isstr, mlint-lm-entry-setstr): Deleted. 653 | (mlint-lm-eval->trycatch): Commented out. Not provided by mlint, but it 654 | is cool and could be resurrected. 655 | (mlint-highlight): Can't provide warningcode anymore. 656 | (mlint-clear-cross-function-variable-overlays): Renamed to 657 | (mlint-clear-nested-function-info-overlays): updated w/ more info. 658 | (mlint-clear-cross-function-variable-highlighting) 659 | (mlint-minor-mode): Use new clear function for nested function info. 660 | 661 | * matlab.el: Make fill-paragraph work around cell headings nicely. 662 | Add `matlab-shell-run-cell' for cell-mode style execution of code. 663 | Change the page delimiter to include cell breaks. 664 | 665 | Support "parfor", available in MATLAB 2006a. 666 | Treat cell start comments as the start of a comment block, even if comments preceed it. 667 | Make sure typing in comment chars moves cursor to the correct location. 668 | 669 | 2005-12-02 Eric Ludlam 670 | 671 | * ChangeLog: Build and dependancies changes. 672 | 673 | * INSTALL, README: Add info about CEDET dependancies. 674 | 675 | * Makefile, Project.ede, matlab-load.el: Build system. 676 | 677 | 2005-12-02 Eric Ludlam 678 | 679 | * README, INSTALL: Refer to CEDET project for dependancies. 680 | 681 | * Makefile, Project.ede: New build system. 682 | 683 | * matlab-load.el: autoloads file. 684 | 685 | 2005-12-01 Eric Ludlam 686 | 687 | * matlab.el: Removed ChangLog from end of file. 688 | -------------------------------------------------------------------------------- /doc/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 | -------------------------------------------------------------------------------- /doc/ChangeLog.old2: -------------------------------------------------------------------------------- 1 | This is the old ChangeLog from CVS @ MathWorks via checkin comments. 2 | 3 | --------------- 4 | 5 | ;;; $Log$ 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 | -------------------------------------------------------------------------------- /matlab-debug.el: -------------------------------------------------------------------------------- 1 | ;;; matlab-debug.el --- Debugger integration 2 | 3 | ;; Copyright (C) 2016 Oleh Krehel 4 | 5 | ;; This file is free software; you can redistribute it and/or modify 6 | ;; it under the terms of the GNU General Public License as published by 7 | ;; the Free Software Foundation; either version 3, or (at your option) 8 | ;; 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 | ;; For a full copy of the GNU General Public License 16 | ;; see . 17 | 18 | ;;; Code: 19 | 20 | ;;* dbstop if error 21 | (defconst matlab-dbstatus-header 22 | (propertize "dbstatus:" 'face 'font-lock-keyword-face)) 23 | 24 | (defun matlab-dbstatus () 25 | "Return pretty-printed \"dbstatus\"." 26 | (interactive) 27 | (let ((strs (cdr (split-string (matlab-eval "dbstatus") "\n" t)))) 28 | (unless strs 29 | (setq strs '("none"))) 30 | (mapconcat #'identity (cons matlab-dbstatus-header strs) 31 | "\n "))) 32 | 33 | (defun matlab-dbstop-if-error () 34 | "Toggle \"dbstop if error\"." 35 | (interactive) 36 | (let ((status (matlab-eval "dbstatus"))) 37 | (if (string-match-p "^Stop if error" status) 38 | (matlab-eval "dbclear if error") 39 | (matlab-eval "dbstop if error"))) 40 | (when (called-interactively-p 'any) 41 | (message 42 | (matlab-dbstatus)))) 43 | 44 | (defun matlab-dbstop-if-caught-error () 45 | "Toggle \"dbstop if caught error\"." 46 | (interactive) 47 | (let ((status (matlab-eval "dbstatus"))) 48 | (if (string-match-p "^Stop if caught error" status) 49 | (matlab-eval "dbclear if caught error") 50 | (matlab-eval "dbstop if caught error"))) 51 | (when (called-interactively-p 'any) 52 | (message 53 | (matlab-dbstatus)))) 54 | 55 | (defhydra hydra-matlab-dbstatus (:color pink 56 | :columns 1) 57 | " 58 | %s(matlab-dbstatus) 59 | " 60 | ("e" (matlab-dbstop-if-error) "dbstop if error") 61 | ("c" (matlab-dbstop-if-caught-error) "dbstop if caught error") 62 | ("q" nil "quit")) 63 | 64 | ;;* Breakpoint in fringe 65 | (defun matlab-dbg-breakpoint-add (point) 66 | (gdb-put-string nil point `(left-fringe breakpoint breakpoint-enabled)) 67 | (let ((file (buffer-file-name)) 68 | (line (line-number-at-pos))) 69 | (matlab-eval (format "dbstop in %s at %d" file line)))) 70 | 71 | (defun matlab-dbg-breakpoint-remove (posn) 72 | (with-selected-window (posn-window posn) 73 | (let ((pt (posn-point posn)) 74 | (file (buffer-file-name)) 75 | (line (line-number-at-pos))) 76 | (gdb-remove-strings pt (1+ pt)) 77 | (matlab-eval (format "dbclear in %s at %d" file line))))) 78 | 79 | (defun matlab-dbg-breakpoint-toggle (event) 80 | (interactive "e") 81 | (mouse-minibuffer-check event) 82 | (let ((posn (event-end event))) 83 | (with-selected-window (posn-window posn) 84 | (if (buffer-file-name) 85 | (if (numberp (posn-point posn)) 86 | (save-excursion 87 | (goto-char (posn-point posn)) 88 | (if (or (posn-object posn) 89 | (memq (car (fringe-bitmaps-at-pos (posn-point posn))) 90 | '(breakpoint))) 91 | (matlab-dbg-breakpoint-remove posn) 92 | (matlab-dbg-breakpoint-add (posn-point posn)))))) 93 | (posn-set-point posn)))) 94 | 95 | ;;* Misc debug 96 | (defun matlab-debug-goto () 97 | "When in debugger, to to the top of \"dbstack\"." 98 | (interactive) 99 | (let ((stack (matlab-eval "dbstack"))) 100 | (when (string-match "In \\(.*\\) (line \\([0-9]+\\))$" stack) 101 | (let* ((file (match-string 1 stack)) 102 | (line (match-string 2 stack)) 103 | (full-file (matlab-eval (format "which('%s')" file)))) 104 | (if (file-exists-p full-file) 105 | (progn 106 | (setq matlab-debug-current-file full-file) 107 | (find-file-other-window full-file) 108 | (goto-char (point-min)) 109 | (forward-line (string-to-number line))) 110 | (error "MATLAB requested file %s but it does not exist" full-file)))))) 111 | 112 | (defun matlab-debug-dbstep (arg) 113 | "When in debugger, to to the top of \"dbstack\"." 114 | (interactive "p") 115 | (let* ((res (matlab-eval (format "dbstep %d" arg))) 116 | (line-number (read res))) 117 | (with-current-buffer (find-file-noselect matlab-debug-current-file) 118 | (goto-char (point-min)) 119 | (forward-line (1- line-number))))) 120 | 121 | (defun matlab-dbstep-in () 122 | (interactive) 123 | (matlab-eval "dbstep in;dbhotlink(1);")) 124 | 125 | (defun matlab-dbcont () 126 | (interactive) 127 | (matlab-eval "dbcont")) 128 | 129 | (defun matlab-dbquit () 130 | (interactive) 131 | (matlab-eval "dbquit")) 132 | 133 | (defun matlab-dbup () 134 | (interactive) 135 | (matlab-eval "dbup")) 136 | 137 | (defun matlab-dbdown () 138 | (interactive) 139 | (matlab-eval "dbdown")) 140 | 141 | (defun matlab-eval-variable () 142 | (interactive) 143 | (let ((vars 144 | (delete 145 | "em_who" 146 | (split-string (matlab-eval "em_who") "\n" t)))) 147 | (ivy-read "var: " vars 148 | :action 149 | (lambda (x) 150 | (message (matlab-eval x)))))) 151 | 152 | (defhydra hydra-matlab (:color pink 153 | :exit t) 154 | "mat" 155 | ("e" hydra-matlab-dbstatus/body "on error") 156 | ("d" hydra-matlab-debug/body "debug") 157 | ("q" nil "quit")) 158 | 159 | (defhydra hydra-matlab-debug (:color pink) 160 | "db" 161 | ("S" matlab-dbstatus "status") 162 | ("l" matlab-debug-goto "goto line") 163 | ("j" matlab-debug-dbstep "dbstep") 164 | ("e" matlab-eval-variable "eval") 165 | ("g" (matlab-eval "dbcont") "dbcont" :exit t) 166 | ("Q" (matlab-eval "dbquit") "dbquit" :exit t) 167 | ("q" nil "quit")) 168 | 169 | (provide 'matlab-debug) 170 | -------------------------------------------------------------------------------- /semantic-matlab.el: -------------------------------------------------------------------------------- 1 | ;;; semantic-matlab.el --- Semantic details for MATLAB files 2 | 3 | ;;; Copyright (C) 2004, 2005, 2008, 2012, 2013 Eric M. Ludlam: The Mathworks, Inc 4 | 5 | ;; Author: Eric M. Ludlam 6 | ;; X-RCS: $Id$ 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 | (eval-and-compile 39 | (condition-case nil 40 | (require 'semantic-format) 41 | (error (require 'semantic/format))) 42 | (condition-case nil 43 | (require 'semantic-dep) 44 | (error (require 'semantic/dep)))) 45 | (require 'matlab) 46 | (require 'semanticdb-matlab) 47 | 48 | ;;; Code: 49 | (defvar semantic-matlab-system-paths-include '("toolbox/matlab/funfun" "toolbox/matlab/general") 50 | "List of include paths under `semantic-matlab-root-directory'. 51 | These paths will be parsed recursively by semantic. Class and 52 | private directories will be omitted here.") 53 | 54 | (defvar semantic-matlab-root-directory 55 | (let* ((mlab (locate-file "matlab" exec-path)) 56 | (mlint (and (boundp 'mlint-program) 57 | mlint-program)) 58 | (exe (or mlab mlint))) 59 | (if exe 60 | (let ((dir 61 | (or (file-symlink-p exe) 62 | exe))) 63 | ;; If we have a dir, take everything until /bin as root dir. 64 | (string-match "\\(.*\\)/bin.*" dir) 65 | (match-string 1 dir)) 66 | (message "semantic-matlab: Could not find MATLAB executable in path.") 67 | nil)) 68 | "Root directory of MATLAB installation. 69 | Will be automatically determined by MATLAB or mlint executable. 70 | Use `semantic-matlab-system-paths-include' to let semantic know 71 | which system directories you would like to include when doing 72 | completions.") 73 | 74 | (defun semantic-matlab-root-directory () 75 | "Calculate the current MATLAB root directory." 76 | (if (matlab-shell-active-p) 77 | (matlab-shell-matlabroot) 78 | semantic-matlab-root-directory)) 79 | 80 | ;; The version of this variable in MATLAB.el is not condusive to extracting 81 | ;; the information we need. 82 | (defvar semantic-matlab-match-function-re 83 | "\\(^\\s-*function\\b[ \t\n.]*\\)\\(\\[[^]]+\\]\\s-*=\\|\\w+\\s-*=\\|\\)\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\>" 84 | "Expression to match a function start line.") 85 | 86 | ;; This function may someday be a part of matlab.el. 87 | ;; It does the raw scan and split for function tags. 88 | (defun semantic-matlab-function-tags (&optional buffer) 89 | "Find all MATLAB function tags in BUFFER. 90 | Return argument is: 91 | (START END RETURNVARS NAME ARGUMENTS DOCSTRING). 92 | Note that builtin functions from MATLAB will always return 93 | START=END=0 and no arguments or return values." 94 | (save-excursion 95 | (if buffer (set-buffer buffer)) 96 | (let ((re semantic-matlab-match-function-re) 97 | start ret fn arg end doc 98 | (taglist nil)) 99 | (goto-char (point-min)) 100 | (if (and (string-match (format "^%s" (semantic-matlab-root-directory)) 101 | (buffer-file-name)) 102 | (looking-at "%\\([A-Z0-9_]+\\)\\s-+\\(.*\\)\\s-*$")) 103 | ;; This is a builtin function, ie there's no function line. 104 | ;; Hence we must use function name from the doc string. 105 | ;; FIXME 106 | ;; How can we get function arguments/return vals for builtin func's? 107 | (setq taglist 108 | (cons (list 0 0 nil (downcase (match-string-no-properties 1)) 109 | nil (match-string-no-properties 2) t) 110 | taglist)) 111 | ;; this is a either not builtin or a user function 112 | (while (re-search-forward re nil t) 113 | (setq start (match-beginning 0) 114 | ret (buffer-substring-no-properties 115 | (match-beginning 2) (match-end 2)) 116 | fn (buffer-substring-no-properties 117 | (match-beginning 3) (match-end 3)) 118 | arg (buffer-substring-no-properties 119 | (match-end 3) (save-excursion 120 | (matlab-end-of-command) 121 | (point))) 122 | doc (save-excursion 123 | (forward-line) 124 | (beginning-of-line) 125 | ;; snarf doc string 126 | (cond 127 | ;; Mathworks standard 128 | ((looking-at "%[A-Z0-9_]+\\s-+\\(.*\\)\\s-*$") 129 | (match-string-no-properties 1)) 130 | ;; lookfor string 131 | ((looking-at "%\\s-+\\(.*\\)\\s-*$") 132 | (match-string-no-properties 1)) 133 | ;; otherwise simply snarf first line of 134 | ;; comments under function declaration 135 | (t 136 | (re-search-forward "[^[:blank:][:cntrl:]]" nil t) 137 | (backward-char) 138 | (if (looking-at "%\\s-+\\(.*\\)") 139 | (match-string-no-properties 1) 140 | nil)))) 141 | end (save-excursion 142 | (goto-char start) 143 | (if matlab-functions-have-end 144 | (condition-case nil 145 | ;; If we get a failure, we should at least 146 | ;; return whatever we got so far. 147 | (matlab-forward-sexp) 148 | (error (point-max))) 149 | (matlab-end-of-defun)) 150 | (point))) 151 | (setq taglist 152 | (cons (list start end 153 | (split-string ret "[][,=. \t\n]+" t) 154 | fn 155 | (split-string arg "[(), \n\t.]+" t) 156 | doc 157 | nil) 158 | taglist)))) 159 | (nreverse taglist)))) 160 | 161 | (defun semantic-matlab-parse-oldstyle-class (tags &optional buffer) 162 | "Check if BUFFER with current TAGS is the constructor of a class. 163 | If this is the case, retrieve attributes from the buffer and scan 164 | the whole directory for methods. The function returns a single tag 165 | describing the class. This means that in semantic-matlab, the 166 | old-style MATLAB classes are linked to the constructor file." 167 | (let* ((name (buffer-file-name buffer)) 168 | class method methods retval attributes) 169 | (when (string-match ".*/@\\(.*?\\)/\\(.*?\\)\\.m" name) 170 | ;; this buffer is part of a class - check 171 | (setq class (match-string 1 name)) 172 | (setq method (match-string 2 name)) 173 | (when (string= class method) ; is this the constructor? 174 | ;; get attributes of the class 175 | ;; TODO - we blindly assume the constructor is correctly defined 176 | (setq retval (semantic-tag-get-attribute (car tags) :return)) 177 | (goto-char (point-min)) 178 | ;; search for attributes 179 | (while (re-search-forward 180 | (concat "^\\s-*" (car retval) 181 | "\\.\\([A-Za-z0-9_]+\\)\\s-*=\\s-*\\(.+\\);") 182 | nil t) 183 | (push (list (match-string-no-properties 1) ; name 184 | (match-string-no-properties 2)) ; default value 185 | attributes)) 186 | ;; now scan the methods 187 | (dolist (cur (delete class 188 | (nthcdr 2 189 | (assoc class semanticdb-matlab-user-class-cache)))) 190 | (push 191 | (semantic-tag-put-attribute 192 | (car (semanticdb-file-stream 193 | (concat 194 | (file-name-directory name) 195 | cur ".m"))) 196 | :typemodifiers '("public")) 197 | methods)) 198 | ;; generate tag 199 | (semantic-tag-new-type 200 | class 201 | "class" 202 | (append 203 | (mapcar (lambda (cur) 204 | (semantic-tag-new-variable 205 | (car cur) nil (cdr cur) 206 | :typemodifiers '("public"))) 207 | attributes) 208 | methods) 209 | nil 210 | :typemodifiers '("public")))))) 211 | 212 | (defun semantic-matlab-find-oldstyle-classes (files) 213 | "Scan FILES for old-style Matlab class system. 214 | Returns an alist with elements (CLASSNAME LOCATION METHODS)." 215 | (let (classes temp tags) 216 | (dolist (cur files) 217 | ;; scan file path for @-directory 218 | (when (string-match "\\(.*\\)/@\\(.*?\\)/\\(.*?\\)\\.m" cur) 219 | (if (setq temp 220 | (assoc (match-string 2 cur) classes)) 221 | (nconc temp `(,(match-string 3 cur))) 222 | (push `(,(match-string 2 cur) ,(match-string 1 cur) 223 | ,(match-string 3 cur)) classes)))) 224 | classes)) 225 | 226 | ;;; BEGIN PARSER 227 | ;; 228 | (defun semantic-matlab-parse-region (&rest ignore) 229 | "Parse the current MATLAB buffer for function definitions. 230 | IGNORE any arguments which specify a subregion to parse. 231 | Each tag returned is a semantic FUNCTION tag. See 232 | `semantic-tag-new-function'." 233 | (semanticdb-matlab-cache-files) 234 | (let ((raw (condition-case nil 235 | ;; Errors from here ought not to be propagated. 236 | (semantic-matlab-parse-functions) 237 | (error nil))) 238 | tags ctags) 239 | (setq tags (mapcar 'semantic-matlab-expand-tag raw)) 240 | ;; check if this is a class constructor 241 | (setq ctags (list (semantic-matlab-parse-oldstyle-class tags))) 242 | (if (car ctags) 243 | ctags 244 | tags))) 245 | 246 | (defun semantic-matlab-parse-changes () 247 | "Parse all changes for the current MATLAB buffer." 248 | ;; NOTE: For now, just schedule a full reparse. 249 | ;; To be implemented later. 250 | (semantic-parse-tree-set-needs-rebuild)) 251 | 252 | (defun semantic-matlab-expand-tag (tag) 253 | "Expand the MATLAB function tag TAG." 254 | (let ((chil (semantic-tag-components-with-overlays tag))) 255 | (if chil 256 | (semantic-tag-put-attribute 257 | tag :members (mapcar 'semantic-matlab-expand-tag chil))) 258 | (car (semantic--tag-expand tag)))) 259 | 260 | (defun semantic-matlab-parse-functions () 261 | "Parse all functions from the current MATLAB buffer." 262 | (car 263 | (semantic-matlab-sort-raw-tags (semantic-matlab-function-tags) 264 | (point-max)))) 265 | 266 | (defun semantic-matlab-sort-raw-tags (tag-list &optional end) 267 | "Return a split list of tags from TAG-LIST before END. 268 | Return list is: 269 | (TAGS-BEFORE-END REMAINING-TAGS)" 270 | (let ((newlist nil) 271 | (rest tag-list)) 272 | ;; Loop until there are no more tags, or no tags before END. 273 | (while (and tag-list (> end (car (car tag-list)))) 274 | (let* ((tag (car tag-list)) 275 | (start (car tag)) 276 | (end (nth 1 tag)) 277 | (ret (nth 2 tag)) 278 | (name (nth 3 tag)) 279 | (args (nth 4 tag)) 280 | (doc (nth 5 tag)) 281 | (builtin (nth 6 tag)) 282 | (parts (semantic-matlab-sort-raw-tags (cdr tag-list) end)) 283 | (chil (car parts))) 284 | (setq rest (car (cdr parts))) 285 | (setq newlist 286 | (cons (append 287 | (semantic-tag-new-function name nil args 288 | :return ret 289 | :subfunctions chil 290 | :documentation doc 291 | :builtin builtin) 292 | (list start end)) 293 | newlist)) 294 | (setq tag-list rest))) 295 | (list (nreverse newlist) tag-list))) 296 | 297 | ;; The following function tries to parse MATLAB variable 298 | ;; assignments. There are only three categories of types: doubles, 299 | ;; structs, and classes. It returns a list with elements 300 | ;; (NAME TYPE ATTRIBUTES), for example: 301 | ;; ("astruct" "struct" "field1" "field2" "field3") 302 | ;; ("aclass" "class" "exampleclass") 303 | ;; ("anumber" "double" "1356") 304 | ;; Of course we can't parse things we don't know, e.g. 305 | ;; if (a==5) variable=aclass; else variable=anotherclass; 306 | ;; In these cases, the latter assignment counts. 307 | ;; Also, we don't know return types of functions (yet...) - the parser 308 | ;; will always think it's "double". You can override the 309 | ;; parser with a special comment, like: %type% avariable = aclass 310 | 311 | ;; One day we might use a grammar for this...? 312 | 313 | (defconst semantic-matlab-type-hint-string "%type%" 314 | "Comment string which prefixes a type hint for the parser.") 315 | 316 | (defun semantic-matlab-parse-assignments () 317 | "Parse assignments in current buffer. 318 | This function starts at current point and goes backwards, until 319 | it reaches a function declaration or the beginning of the buffer. 320 | It returns a list of variable assignments (NAME TYPE ATTRIBUTES), 321 | where NAME is unique." 322 | (let ((limit (or (save-excursion 323 | (if (re-search-backward semantic-matlab-match-function-re nil t) 324 | (progn 325 | (forward-line 1) 326 | (point)) 327 | nil)) 328 | (point-min))) 329 | vars) 330 | ;; don't parse current line 331 | (beginning-of-line) 332 | (while (re-search-backward (concat "^\\(" (regexp-quote semantic-matlab-type-hint-string) 333 | "\\)?\\([^%]*[^=><~]\\)=\\([^=].*\\)$") limit t) 334 | (let ((left (match-string-no-properties 2)) 335 | (right (match-string-no-properties 3)) 336 | temp) 337 | ;; first we have to deal with elipsis... 338 | (save-excursion 339 | (while (string-match 340 | (concat "\\(.*\\)" 341 | (regexp-quote matlab-elipsis-string) "\\s-*$") 342 | right) 343 | (forward-line 1) 344 | (setq right 345 | (concat 346 | (match-string 1 right) 347 | (progn (looking-at "^.*$") 348 | (match-string-no-properties 0)))))) 349 | (save-excursion 350 | (while (and (not (bobp)) 351 | (progn 352 | (forward-line -1) 353 | (looking-at 354 | (concat "\\(.*\\)" 355 | (regexp-quote matlab-elipsis-string) "\\s-*$")))) 356 | (setq left 357 | (concat (match-string-no-properties 1) left)))) 358 | ;; remove bracket expressions and beginning/trailing whitespaces on left-hand side 359 | (while (or (string-match "\\((.*)\\|{.*}\\)" left) 360 | (string-match "^\\(\\s-+\\)" left) 361 | (string-match "\\(\\s-+\\)$" left)) 362 | (setq left (replace-match "" t t left))) 363 | ;; deal with right-hand side 364 | (cond 365 | ;; special case: a = set(class,attribute,value) 366 | ((string-match "\\s-*set(\\s-*\\([A-Za-z_0-9 ]+\\)\\s-*," right) 367 | (setq right (match-string 1 right))) 368 | ;; method call which returns same class: class=method(class [,args]) 369 | ((and (string-match "\\s-*[A-Za-z_0-9 ]+\\s-*(\\s-*\\([A-Za-z_0-9 ]+\\)\\s-*\\(,\\|)\\)" right) 370 | (string= left (match-string 1 right))) 371 | (setq right (match-string 1 right))) 372 | ;; otherwise reduce right-hand side to first symbol 373 | (t 374 | (string-match "[[({ ]*\\([A-Za-z_0-9]*\\)" right) 375 | (setq right (match-string 1 right)))) 376 | (cond 377 | ;; multiple assignment, e.g. [a,b]=size(A); 378 | ((string-match "\\[\\(.*\\)\\]" left) 379 | (dolist (cur (split-string (match-string 1 left) ",")) 380 | (string-match "\\s-*\\([A-Za-z_0-9]+\\)\\s-*" cur) 381 | (setq cur (match-string 1 cur)) 382 | (unless (assoc cur vars) 383 | ;; since we don't know any return types, we just say it's double 384 | (push (list cur "double" "") vars)))) 385 | ;; (nested) structure 386 | ((string-match "\\([A-Za-z_0-9.]+\\)\\.\\([A-Za-z_0-9]+\\)" left) 387 | (while (string-match "\\([A-Za-z_0-9.]+\\)\\.\\([A-Za-z_0-9]+\\)" left) 388 | (let ((name (match-string 1 left)) 389 | (field (match-string 2 left))) 390 | (if (setq temp (assoc name vars)) 391 | (unless (member field temp) 392 | (nconc temp (list field))) 393 | (push (list name "struct" field) 394 | vars)) 395 | (setq left name)))) 396 | ;; class 397 | ((assoc right semanticdb-matlab-user-class-cache) 398 | (string-match "\\([A-Za-z_0-9]+\\)\\s-*$" left) 399 | (setq left (match-string 1 left)) 400 | (if (and (setq temp (assoc left vars)) 401 | (string= (nth 1 temp) "struct")) 402 | ;; we first thought it's a structure, but it's probably a 403 | ;; new-style class 404 | (setcdr temp `("class" ,right)) 405 | (unless temp 406 | (push `(,left "class" ,right) vars)))) 407 | (t 408 | ;; default is double 409 | (string-match "\\([A-Za-z_0-9]+\\)\\s-*$" left) 410 | (setq left (match-string 1 left)) 411 | (unless (or (assoc left vars) 412 | (string= left right)) ; self assignment 413 | (push `(,left "double" ,right) vars)))))) 414 | vars)) 415 | 416 | 417 | 418 | (define-mode-local-override semantic-get-local-variables 419 | matlab-mode (&optional point) 420 | "Return a list of local variables for POINT." 421 | (semanticdb-matlab-cache-files) 422 | (save-excursion 423 | (let ((vars (semantic-matlab-parse-assignments)) 424 | knowntypes tags) 425 | (dolist (cur vars) 426 | ;; check right-hand side for known types which might be 427 | ;; assigned this variable 428 | (if (string= (nth 1 cur) "double") 429 | (when (member (nth 2 cur) knowntypes) 430 | (setcdr cur (cdr (assoc (nth 2 cur) vars)))) 431 | (push (nth 0 cur) knowntypes)) 432 | ;; generate the tag 433 | (push 434 | (semantic-tag-new-variable 435 | (car cur) 436 | (cond 437 | ;; structures 438 | ((string= (cadr cur) "struct") 439 | (semantic-tag-new-type 440 | ;; this is just a placeholder 441 | (concat (car cur) "_struct") 442 | "struct" 443 | (mapcar 444 | (lambda (x) 445 | (semantic-tag-new-variable 446 | x 447 | nil nil :typemodifiers '("public"))) 448 | (nthcdr 2 cur)) 449 | nil)) 450 | ;; classes 451 | ((string= (cadr cur) "class") 452 | ;; include tags from class constructor 453 | ;; (contains whole class, including methods) 454 | (car (semanticdb-file-stream 455 | (concat 456 | (nth 1 (assoc (nth 2 cur) semanticdb-matlab-user-class-cache)) 457 | "/@" (nth 2 cur) "/" (nth 2 cur) ".m")))) 458 | (t 459 | nil))) 460 | tags)) 461 | tags))) 462 | 463 | 464 | (define-mode-local-override semantic-tag-components-with-overlays 465 | matlab-mode (tag) 466 | "Return the list of subfunctions in TAG." 467 | (semantic-tag-get-attribute tag :subfunctions)) 468 | 469 | (define-mode-local-override semantic-format-tag-prototype matlab-mode 470 | (tag &optional parent color) 471 | "Return a prototype string describing tag. 472 | For MATLAB, we have to mark builtin functions, since we currently 473 | cannot derive an argument list for them." 474 | (let ((class (semantic-tag-class tag)) 475 | (name (semantic-format-tag-name tag parent color)) 476 | str) 477 | (if (eq class 'function) 478 | (let* ((args (semantic-tag-function-arguments tag)) 479 | (argstr (semantic--format-tag-arguments args 480 | #'identity 481 | color)) 482 | (builtin (semantic-tag-get-attribute tag :builtin)) 483 | (doc (semantic-tag-docstring tag))) 484 | (if builtin 485 | (if color 486 | (setq builtin (semantic--format-colorize-text " [builtin] " 'keyword) 487 | argstr (semantic--format-colorize-text " arguments unavailable" 'label)) 488 | (setq builtin " [builtin] " 489 | argstr " arguments unavailable")) 490 | (setq builtin "")) 491 | (concat name builtin "(" (if args " " "") 492 | argstr 493 | " )")) 494 | (semantic-format-tag-prototype-default tag parent color)))) 495 | 496 | (defun semantic-idle-summary-format-matlab-mode (tag &optional parent color) 497 | "Describe TAG and display corresponding MATLAB 'lookfor' doc-string." 498 | (let* ((proto (semantic-format-tag-prototype-matlab-mode tag nil color)) 499 | (doc (semantic-tag-docstring tag))) 500 | (concat proto " (" doc ")"))) 501 | 502 | (defcustom-mode-local-semantic-dependency-system-include-path 503 | matlab-mode semantic-matlab-dependency-system-include-path 504 | (if semantic-matlab-root-directory 505 | (mapcar (lambda (cur) 506 | (concat (file-name-as-directory semantic-matlab-root-directory) 507 | cur)) 508 | semantic-matlab-system-paths-include) 509 | nil) 510 | "The system include paths from MATLAB.") 511 | 512 | (defvar-mode-local matlab-mode semantic-idle-summary-function 513 | 'semantic-idle-summary-format-matlab-mode 514 | "Function to use when displaying tag information during idle time.") 515 | 516 | (defvar semantic-matlab-display-docstring t 517 | "Flag if function documentation should be displayed after completion.") 518 | 519 | (define-mode-local-override semantic-ia-insert-tag 520 | matlab-mode (tag) 521 | "Insert TAG into the current buffer based on completion." 522 | (insert (semantic-tag-name tag)) 523 | (let ((name (semantic-tag-name tag)) 524 | (tt (semantic-tag-class tag)) 525 | (args (semantic-tag-function-arguments tag)) 526 | (doc (semantic-tag-docstring tag))) 527 | (when (and (eq tt 'function) 528 | args 529 | (not (looking-at "\\s-*("))) 530 | (insert "(")) 531 | ;; delete trailing whitespaces when completing class methods 532 | (when (looking-at "\\(\\s-+\\)(") 533 | (delete-char (length (match-string 1)))) 534 | (when semantic-matlab-display-docstring 535 | (fame-message-nolog 536 | (semantic-idle-summary-format-matlab-mode tag nil t))))) 537 | 538 | (define-mode-local-override semantic-ctxt-current-symbol 539 | matlab-mode (&optional point) 540 | "Return the current symbol the cursor is on at point in a list. 541 | This will include a list of type/field names when applicable." 542 | (let* ((case-fold-search semantic-case-fold) 543 | sym) 544 | (with-syntax-table semantic-lex-syntax-table 545 | (save-excursion 546 | (when point (goto-char point)) 547 | ;; go to beginning of symbol 548 | (skip-syntax-backward "w_") 549 | (setq sym (if (looking-at "[a-zA-Z_0-9]+") 550 | (match-string-no-properties 0) 551 | nil)) 552 | (if sym 553 | (cond 554 | ;; method call: var = method(class,args) 555 | ((progn 556 | (and (looking-back "[^=><~]=\\s-*") 557 | (looking-at "[a-zA-Z_0-9]*\\s-*(\\([a-zA-Z_0-9]+\\),?"))) 558 | (list (match-string-no-properties 1) sym)) 559 | ;; class properties: var = get(class,'attribute') 560 | ((looking-back "\\(get\\|set\\)(\\s-*\\([a-zA-Z_0-9]+\\),'") 561 | (list (match-string-no-properties 2) sym)) 562 | ;; (nested) structures or new-style classes 563 | ((looking-back "[^A-Za-z_0-9.]\\([A-Za-z_0-9.]+\\)\\.") 564 | (list (match-string-no-properties 1) sym)) 565 | (t 566 | (list sym))) 567 | nil))))) 568 | 569 | (define-mode-local-override semantic-ctxt-current-symbol-and-bounds 570 | matlab-mode (&optional point) 571 | "Return the current symbol and bounds the cursor is on at POINT. 572 | Uses `semantic-ctxt-current-symbol' to calculate the symbol. 573 | Return (PREFIX ENDSYM BOUNDS)." 574 | (let ((sym (semantic-ctxt-current-symbol-matlab-mode point)) 575 | bounds endsym) 576 | (save-excursion 577 | (when point (goto-char point)) 578 | (when sym 579 | ;; go to beginning of symbol 580 | (skip-syntax-backward "w_") 581 | (setq endsym (progn (looking-at "[a-zA-Z_0-9]+") 582 | (match-string-no-properties 0))) 583 | (setq bounds (cons 584 | (match-beginning 0) 585 | (match-end 0))) 586 | (list sym endsym bounds))))) 587 | 588 | 589 | ;;;###autoload 590 | (defun semantic-default-matlab-setup () 591 | "Set up a buffer for parsing of MATLAB files." 592 | ;; This will use our parser. 593 | (semantic-install-function-overrides 594 | '((parse-region . semantic-matlab-parse-region) 595 | (parse-changes . semantic-matlab-parse-changes))) 596 | (setq semantic-parser-name "MATLAB" 597 | ;; Setup a dummy parser table to enable parsing! 598 | semantic--parse-table t 599 | imenu-create-index-function 'semantic-create-imenu-index 600 | ;; semantic-command-separation-character "." 601 | semantic-type-relation-separator-character '(".") 602 | semantic-symbol->name-assoc-list '((function . "Function")) 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 | (provide 'semantic-matlab) 610 | 611 | ;;; semantic-matlab.el ends here 612 | -------------------------------------------------------------------------------- /semanticdb-matlab.el: -------------------------------------------------------------------------------- 1 | ;;; semanticdb-matlab.el --- Semantic database extensions for MATLAB 2 | 3 | ;;; Copyright (C) 2008, 2012, 2013 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 | ;; For generic function searching. 26 | (require 'eieio) 27 | (require 'eieio-opt) 28 | 29 | ;; eval-and-compile needed because of the condition-case. 30 | ;; Normally a require is eval'd during compile, so this is the same. 31 | (eval-and-compile 32 | (condition-case nil 33 | (require 'semanticdb) 34 | (error (require 'semantic/db)))) 35 | 36 | ;;; Code: 37 | 38 | ;; Put all directories which should be recursively scanned for your 39 | ;; personal MATLAB files here. 40 | 41 | (defvar semanticdb-matlab-include-paths 42 | (if (file-exists-p (expand-file-name "~/matlab")) 43 | (list (expand-file-name "~/matlab") ;; Default location for extra code. 44 | ) 45 | ;; Else, no default path. 46 | nil) 47 | "Directories which should be scanned for m-files.") 48 | 49 | ;;; Classes: 50 | (defclass semanticdb-table-matlab (semanticdb-search-results-table) 51 | ((major-mode :initform matlab-mode)) 52 | "A table for returning search results from MATLAB path.") 53 | 54 | (defclass semanticdb-project-database-matlab 55 | (semanticdb-project-database 56 | ;; Use SINGLETON if there should be only one copy of this database. 57 | ;; Do not use this if you need a different copy for different projects. 58 | ;; eieio-singleton 59 | ) 60 | ((new-table-class :initform semanticdb-table-matlab 61 | :type class 62 | :documentation 63 | "New tables created for this database are of this class.")) 64 | "Database representing MATLAB path.") 65 | 66 | ;; Create the database, and add it to searchable databases for matlab mode. 67 | (defvar-mode-local matlab-mode semanticdb-project-system-databases 68 | (list 69 | (semanticdb-project-database-matlab "Matlab")) 70 | "Search MATLAB path for symbols.") 71 | 72 | ;; NOTE: Be sure to modify this to the best advantage of your 73 | ;; language. 74 | (defvar-mode-local matlab-mode semanticdb-find-default-throttle 75 | '(project omniscience) 76 | "Search project files, then search this omniscience database. 77 | It is not necessary to to system or recursive searching because of 78 | the omniscience database.") 79 | 80 | ;;; Filename based methods 81 | ;; 82 | (defmethod semanticdb-get-database-tables ((obj semanticdb-project-database-matlab)) 83 | "For a MATLAB database, there are no explicit tables. 84 | Create one of our special tables that can act as an intermediary." 85 | ;; NOTE: This method overrides an accessor for the `tables' slot in 86 | ;; a database. You can either construct your own (like tmp here 87 | ;; or you can manage any number of tables. 88 | 89 | ;; We need to return something since there is always the "master table" 90 | ;; The table can then answer file name type questions. 91 | (when (not (slot-boundp obj 'tables)) 92 | (let ((newtable (semanticdb-table-matlab "MATLAB system table"))) 93 | (oset obj tables (list newtable)) 94 | (oset newtable parent-db obj) 95 | (oset newtable tags nil))) 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 | (defmethod semanticdb-get-tags ((table semanticdb-table-matlab)) 104 | "Return the list of tags belonging to TABLE." 105 | ;; NOTE: Omniscient databases probably don't want to keep large tabes 106 | ;; lolly-gagging about. Keep internal Emacs tables empty and 107 | ;; refer to alternate databases when you need something. 108 | nil) 109 | 110 | (defmethod semanticdb-equivalent-mode ((table semanticdb-table-matlab) &optional buffer) 111 | "Return non-nil if TABLE's mode is equivalent to BUFFER. 112 | Equivalent modes are specified by by `semantic-equivalent-major-modes' 113 | local variable." 114 | (save-excursion 115 | (set-buffer buffer) 116 | (eq (or mode-local-active-mode major-mode) 'matlab-mode))) 117 | 118 | (defmethod semanticdb-full-filename ((obj semanticdb-table-matlab)) 119 | "Fetch the full filename that OBJ refers to. 120 | This function is currently a stub." 121 | ;; FIXME 122 | ;; return filename for object - what should we do with builtin functions? 123 | nil) 124 | 125 | 126 | ;;; Usage 127 | ;; 128 | ;; Unlike other tables, an omniscent database does not need to 129 | ;; be associated with a path. Use this routine to always add ourselves 130 | ;; to a search list. 131 | (define-mode-local-override semanticdb-find-translate-path matlab-mode 132 | (path brutish) 133 | "Return a list of semanticdb tables asociated with PATH. 134 | If brutish, do the default action. 135 | If not brutish, do the default action, and append the system 136 | database (if available.)" 137 | (let ((default 138 | ;; When we recurse, disable searching of system databases 139 | ;; so that our MATLAB database only shows up once when 140 | ;; we append it in this iteration. 141 | (let ((semanticdb-search-system-databases nil)) 142 | (semanticdb-find-translate-path-default path brutish)))) 143 | ;; Don't add anything if BRUTISH is on (it will be added in that fcn) 144 | ;; or if we aren't supposed to search the system. 145 | (if (or brutish (not semanticdb-search-system-databases)) 146 | default 147 | (let ((tables (apply #'append 148 | (mapcar 149 | (lambda (db) (semanticdb-get-database-tables db)) 150 | semanticdb-project-system-databases)))) 151 | (append default tables))))) 152 | 153 | ;;; Search Overrides 154 | ;; 155 | ;; NOTE WHEN IMPLEMENTING: Be sure to add doc-string updates explaining 156 | ;; how your new search routines are implemented. 157 | ;; 158 | 159 | 160 | (defvar semanticdb-matlab-system-files-cache '(nil) 161 | "Internal cache for system M files. 162 | This variable caches all M files in the directories listed in 163 | `semantic-matlab-system-paths-include' under MATLAB root 164 | directory. Users can reset this cache using 165 | `semanticdb-matlab-reset-files-cache'") 166 | 167 | (defvar semanticdb-matlab-user-files-cache '(nil) 168 | "Internal cache for user M files. 169 | This variable caches all M files in the directories listed in 170 | `semanticdb-matlab-include-paths'. Users can reset this cache 171 | using `semanticdb-matlab-reset-files-cache'.") 172 | 173 | (defvar semanticdb-matlab-user-class-cache nil 174 | "Internal cache for user classes.") 175 | 176 | (defun semanticdb-matlab-reset-files-cache () 177 | "Reset semanticdb-matlab file cache." 178 | (interactive) 179 | (setq semanticdb-matlab-user-files-cache '(nil)) 180 | (setq semanticdb-matlab-system-files-cache '(nil))) 181 | 182 | (defun semanticdb-matlab-possibly-add-buffer-to-cache () 183 | "Add current buffer file name to cache. 184 | This function will add the current buffer file name to 185 | `semanticdb-matlab-user-files-cache' if not already there. Meant 186 | to be called in local `after-save-hook'." 187 | (unless (and semanticdb-matlab-user-files-cache 188 | (member (buffer-file-name) 189 | (cdr semanticdb-matlab-user-files-cache))) 190 | (setcdr semanticdb-matlab-user-files-cache 191 | (append (cdr semanticdb-matlab-user-files-cache) 192 | (list (buffer-file-name)))))) 193 | 194 | ;; Make sure newly created MATLAB files get in the user-files-cache 195 | (add-hook 'matlab-mode-hook 196 | (lambda () 197 | ;; add buffer-local after-save-hook 198 | (add-hook 199 | 'after-save-hook 200 | 'semanticdb-matlab-possibly-add-buffer-to-cache t t))) 201 | 202 | ;; Helper functions 203 | 204 | (defun semanticdb-matlab-scan-directories 205 | (dirs &optional recursive exclude-classes exclude-private) 206 | "Get list of all m-files in DIRS. 207 | DIRS is a list of directories. If RECURSIVE, every subdirectory 208 | will be included in the search. If EXCLUDE-CLASSES, class 209 | directories (beginning with '@') will be skipped. If 210 | EXCLUDE-PRIVATE, 'private' directories will be skipped." 211 | (if dirs 212 | (let (files) 213 | (dolist (dir dirs) 214 | (let (subdirs) 215 | (dolist (cur (directory-files dir t "[^.]" t)) 216 | (if (file-directory-p cur) 217 | (when (and recursive 218 | (not (and exclude-classes 219 | (string-match ".*/@" cur))) 220 | (not (and exclude-private 221 | (string-match ".*/private$" cur)))) 222 | (push cur subdirs)) 223 | (when (string-match "\\.m$" cur) 224 | (push cur files)))) 225 | (when subdirs 226 | (setq files 227 | (append files 228 | (semanticdb-matlab-scan-directories 229 | subdirs recursive exclude-classes exclude-private)))))) 230 | files) 231 | nil)) 232 | 233 | (defun semanticdb-matlab-cache-files () 234 | "Cache user and system MATLAB files if necessary." 235 | ;; car of *-file-cache variables is used as flag 236 | (unless (car semanticdb-matlab-system-files-cache) 237 | (setq semanticdb-matlab-system-files-cache 238 | (cons t 239 | (semanticdb-matlab-scan-directories 240 | semantic-matlab-dependency-system-include-path t t t)))) 241 | (unless (car semanticdb-matlab-user-files-cache) 242 | (setq semanticdb-matlab-user-files-cache 243 | (cons t 244 | (semanticdb-matlab-scan-directories 245 | semanticdb-matlab-include-paths t nil nil))) 246 | ;; cache user defined old-style classes 247 | (setq semanticdb-matlab-user-class-cache 248 | (semantic-matlab-find-oldstyle-classes 249 | (cdr semanticdb-matlab-user-files-cache))))) 250 | 251 | (defun semanticdb-matlab-find-name (name &optional type) 252 | "Find NAME in matlab file names. 253 | If TYPE is 'regex, NAME is a regular expression. 254 | If TYPE is 'prefix, NAME is a prefix." 255 | (semanticdb-matlab-cache-files) 256 | (let ((files (append (cdr semanticdb-matlab-system-files-cache) 257 | (cdr semanticdb-matlab-user-files-cache))) 258 | regexp results) 259 | (cond 260 | ((eq type 'prefix) 261 | (setq regexp (format "^%s.*\\.m$" name))) 262 | ((eq type 'regex) 263 | (setq regexp (format "%s\\.m$" name))) 264 | (t 265 | (setq regexp (format "^%s\\.m" name)))) 266 | (dolist (cur files) 267 | (when (string-match regexp (file-name-nondirectory cur)) 268 | (push cur results))) 269 | results)) 270 | 271 | (define-mode-local-override semantic-ctxt-current-class-list 272 | matlab-mode (point) 273 | "Return a list of tag classes that are allowed at point. 274 | If point is nil, the current buffer location is used." 275 | (cond 276 | ((looking-at ".+=") 277 | '(variable type)) 278 | ((looking-back "\\(get\\|set\\)([a-zA-Z_0-9]*") 279 | '(variable type)) 280 | ((looking-back "\\(get\\|set\\)([a-zA-Z_0-9]+,'[a-zA-Z_0-9]*") 281 | '(variable)) 282 | ((looking-back "\\.[a-zA-Z_0-9]*") 283 | '(variable)) 284 | ((looking-at "\\s-*([a-zA-Z_0-9]+,") 285 | '(function)) 286 | (t 287 | '(function variable type)))) 288 | 289 | ;; Search functions 290 | 291 | (defmethod semanticdb-find-tags-by-name-method 292 | ((table semanticdb-table-matlab) name &optional tags) 293 | "Find all tags named NAME in TABLE. 294 | Return a list of tags." 295 | ;; If we have tags, go up. 296 | (if tags (call-next-method) 297 | (let (where) 298 | ;; If MATLAB shell is active, use it. 299 | (when (and (matlab-shell-active-p) 300 | (setq where (matlab-shell-which-fcn name))) 301 | (when (and (not (file-exists-p (car where))) 302 | ;; Sometimes MATLAB builtin functions lie. 303 | (string-match "@" (car where))) 304 | (setq where 305 | (list 306 | (concat 307 | (substring (car where) 0 (match-beginning 0)) 308 | name ".m"))))) 309 | (unless (car where) 310 | ;; Fall back to home-made database. 311 | (setq where 312 | (list (car (semanticdb-matlab-find-name name))))) 313 | (if (car where) 314 | (list (car (semanticdb-file-stream (car where)))) 315 | nil)))) 316 | 317 | (defmethod semanticdb-find-tags-by-name-regexp-method 318 | ((table semanticdb-table-matlab) regex &optional tags) 319 | "Find all tags with name matching REGEX in TABLE. 320 | Optional argument TAGS is a list of tags to search. 321 | Return a list of tags." 322 | (if tags (call-next-method) 323 | (let ((files (semanticdb-matlab-find-name regex 'regex))) 324 | (delq nil 325 | (mapcar '(lambda (x) 326 | (let ((matlab-vers-on-startup nil)) 327 | (car (semanticdb-file-stream x)))) 328 | files))))) 329 | 330 | (defmethod semanticdb-find-tags-for-completion-method 331 | ((table semanticdb-table-matlab) prefix &optional tags) 332 | "In TABLE, find all occurances of tags matching PREFIX. 333 | Optional argument TAGS is a list of tags to search. 334 | Returns a table of all matching tags." 335 | ;; If we have tags, go up. 336 | (if tags (call-next-method) 337 | ;; first, get completions from home-made database... 338 | (let ((compdb (semanticdb-matlab-find-name prefix 'prefix)) 339 | compshell) 340 | ;; ...and from MATLAB shell, if available 341 | (when (matlab-shell-active-p) 342 | (setq compshell 343 | (mapcar 344 | (lambda (x) 345 | (let ((where (matlab-shell-which-fcn (car x)))) 346 | ;; correct name for builtin functions 347 | (when (and (cdr where) 348 | (string-match 349 | "\\(.*\\)/@.*\\(/[A-Za-z_0-9]+\\.m\\)" 350 | (car where))) 351 | (setq where 352 | (list 353 | (concat (match-string 1 (car where)) 354 | (match-string 2 (car where)))))) 355 | (list (car where)))) 356 | (matlab-shell-completion-list prefix))) 357 | ;; combine results 358 | (mapc 359 | (lambda (x) 360 | (unless (member x compdb) 361 | (setq compdb (append compdb x)))) 362 | compshell)) 363 | ;; generate tags 364 | (delq nil 365 | (mapcar '(lambda (x) 366 | (let ((matlab-vers-on-startup nil)) 367 | (car (semanticdb-file-stream x)))) 368 | compdb))))) 369 | 370 | (provide 'semanticdb-matlab) 371 | 372 | ;;; semanticdb-matlab.el ends here 373 | -------------------------------------------------------------------------------- /toolbox/Makefile: -------------------------------------------------------------------------------- 1 | # Automatically Generated Makefile by EDE. 2 | # For use with: make 3 | # Relative File Name: toolbox/Makefile 4 | # 5 | # DO NOT MODIFY THIS FILE OR YOUR CHANGES MAY BE LOST. 6 | # EDE is the Emacs Development Environment. 7 | # http://cedet.sourceforge.net/ede.shtml 8 | # 9 | 10 | top=../ 11 | ede_FILES=Project.ede Makefile 12 | 13 | matlab_MISC=emacsinit.m opentoline.m emacsdocomplete.m 14 | VERSION=3.3.2 15 | DISTDIR=$(top)matlab-emacs-$(VERSION)/toolbox 16 | 17 | 18 | 19 | all: matlab 20 | 21 | matlab: 22 | @ 23 | 24 | tags: 25 | 26 | .PHONY: dist 27 | 28 | dist: 29 | mkdir $(DISTDIR) 30 | cp $(matlab_MISC) $(ede_FILES) $(DISTDIR) 31 | 32 | Makefile: Project.ede 33 | @echo Makefile is out of date! It needs to be regenerated by EDE. 34 | @echo If you have not modified Project.ede, you can use 'touch' to update the Makefile time stamp. 35 | @false 36 | 37 | 38 | 39 | # End of Makefile 40 | -------------------------------------------------------------------------------- /toolbox/dbhotlink.m: -------------------------------------------------------------------------------- 1 | function dbhotlink(L) 2 | 3 | [ST, I] = dbstack('-completenames'); 4 | if L+1 <=numel(ST) 5 | fprintf('%i \n', ST(L+1).file, ST(L+1).line, ST(L+1).line); 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /toolbox/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 | % dl - Download a new version of this download script. 10 | % core - Just the core MATLAB support files. 11 | % tlc - Just the core MATLAB/TLC support files. 12 | % cedet - Core, plus additional support for MATLAB using CEDET support. 13 | % Learn more about CEDET at: http://cedet.sf.net 14 | % support - Just the build files and READMEs for compiling. 15 | % all - All files 16 | % 17 | % DL_EMACS_SUPPORT(FILESET,DEST) - download FILESET and save in 18 | % destination directory DEST 19 | % 20 | % For the most reliable refresh of the repository, run these two 21 | % commands, the frist will make sure the downloader is current. 22 | % 23 | % dl_emacs_support dl 24 | % dl_emacs_support 25 | % 26 | % On unix, you can then execute: 27 | % 28 | % !make 29 | % 30 | % to compile. 31 | 32 | po = inputParser; 33 | 34 | addOptional(po, 'fileset', 'all', @ischar) 35 | addOptional(po, 'destination', pwd, @ischar) 36 | 37 | po.parse(varargin{:}); 38 | 39 | stuff = po.Results; 40 | 41 | if exist(stuff.destination,'dir') ~= 7 42 | error(['The folder: ''',stuff.destination, ''', does not exist.']); 43 | end 44 | 45 | downloader = { 'dl_emacs_support.m' }; 46 | 47 | coreFiles = { 'matlab-load.el' 'matlab.el' 'mlint.el' ... 48 | 'matlab-publish.el' 'company-matlab-shell.el' ... 49 | 'linemark.el' ... 50 | 'toolbox/emacsinit.m' 'toolbox/opentoline.m' 'toolbox/emacsdocomplete.m' }; 51 | tlcFiles = { 'tlc.el' }; 52 | cedetFiles = { 'cedet-matlab.el' 'semantic-matlab.el' ... 53 | 'semanticdb-matlab.el' 'srecode-matlab.el' ... 54 | 'templates/srecode-matlab.srt' }; 55 | supportFiles = { 'README.org' 'INSTALL' 'ChangeLog' ... 56 | 'Project.ede' 'Makefile' ... 57 | 'toolbox/Project.ede' 'toolbox/Makefile' ... 58 | 'templates/Project.ede' 'templates/Makefile'}; 59 | 60 | switch stuff.fileset 61 | case 'dl' 62 | getfiles(downloader); 63 | case 'core' 64 | mktoolboxdir 65 | getfiles(coreFiles); 66 | case 'tlc' 67 | mktoolboxdir 68 | getfiles(coreFiles); 69 | getfiles(tlcFiles); 70 | case 'cedet' 71 | mktoolboxdir 72 | getfiles(coreFiles); 73 | mktemplatedir; 74 | getfiles(cedetFiles); 75 | case 'support' 76 | mktemplatedir; 77 | getfiles(supportFiles); 78 | case 'all' 79 | mktoolboxdir 80 | getfiles(coreFiles); 81 | getfiles(tlcFiles); 82 | mktemplatedir; 83 | getfiles(cedetFiles); 84 | getfiles(supportFiles); 85 | otherwise 86 | error('Unknown fileset %s.', stuff.fileset); 87 | end 88 | 89 | function mktemplatedir 90 | templateDir = fullfile(stuff.destination,'templates'); 91 | if ~exist(templateDir,'dir') 92 | mkdir(templateDir); 93 | end 94 | end 95 | 96 | function mktoolboxdir 97 | toolboxDir = fullfile(stuff.destination,'toolbox'); 98 | if ~exist(toolboxDir,'dir') 99 | mkdir(toolboxDir); 100 | end 101 | end 102 | 103 | function getfiles(fList) 104 | for i = 1:length(fList) 105 | file = fList{i}; 106 | destFullFile = fullfile(stuff.destination,file); 107 | [ contents status ] = ... 108 | urlread(['https://sourceforge.net/p/matlab-emacs/src/ci/master/tree/cedet-matlab.el?format=raw',... 109 | file,'?revision=HEAD']); 110 | if ~status 111 | fprintf('Unable to download %s.\n', file); 112 | else 113 | fid = fopen(destFullFile,'w'); 114 | fwrite(fid,contents); 115 | fclose(fid); 116 | fprintf('Successfully downloaded and created: ''%s''.\n',... 117 | destFullFile); 118 | end 119 | end 120 | end 121 | end 122 | 123 | -------------------------------------------------------------------------------- /toolbox/em_who.m: -------------------------------------------------------------------------------- 1 | function em_whos() 2 | s=evalin('caller','who'); 3 | for i=1:numel(s) 4 | disp(s{i}); 5 | end 6 | end -------------------------------------------------------------------------------- /toolbox/emacs_dbstack.m: -------------------------------------------------------------------------------- 1 | function emacs_dbstack 2 | st = dbstack(1); 3 | for i = 1:size(st, 1) 4 | fprintf('%s:%d\n', which(st(i).file), st(i).line, st(i).name, st(i).line); 5 | end 6 | end -------------------------------------------------------------------------------- /toolbox/emacsdocomplete.m: -------------------------------------------------------------------------------- 1 | function emacsdocomplete(substring) 2 | % Ask for completions of SUBSTRING from MATLAB. 3 | % This is used by Emacs TAB in matlab-shell to provide possible 4 | % completions. This hides the differences between versions 5 | % for the calls needed to do completions. 6 | 7 | 8 | v = ver('MATLAB'); 9 | 10 | 11 | if str2double(v.Version) < 8.4 12 | 13 | % Pre R2014b: partial_string 14 | extracmd = ''; 15 | 16 | else 17 | 18 | % Post R2014b: partial_string, caret, num 19 | extracmd = [ ', ' num2str(length(substring)) ',0' ]; 20 | 21 | % DEV NOTE: If you find a test failure, contact Eric Ludlam 22 | % to also update matlab-emacs SF repository. 23 | 24 | end 25 | 26 | command = [ 'matlabMCRprocess_emacs = com.mathworks.jmi.MatlabMCR;' ... 27 | 'emacs_completions_output = matlabMCRprocess_emacs.mtFindAllTabCompletions(''' ... 28 | substring '''' extracmd '),' ... 29 | 'clear(''matlabMCRprocess_emacs'',''emacs_completions_output'');' ]; 30 | 31 | % Completion engine needs to run in the base workspace to know 32 | % what the variables you have to work with are. 33 | evalin('base',command); 34 | end -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------