Commit graph

63 commits

Author SHA1 Message Date
Eric Ludlam
318404cada Refactor how MATLAB mode handles font-locking:
* Support special classdef syntaxes, including class name highlight,
  class, property, and method block attribute highlighting, property
  variable name highlighting and property variable data-type
  highlighting.

* Create matlab mode specific version of regexp-opt so users can
  customize keyword lists in any Emacs version.

* Converted the simulink symbols, and constant symbols (like pi) into
  lists that can be configured.

Tweaks:
* Simulink symbols are always highlighted.  Removed configuration
  variable to disable.

* matlab-gaudy-font-lock-keywords is now built from 3 other variables,
  making maintenance a little easier.

* set font-lock-multiline to 'undecided.  This fixes block comments,
  unreachable code, and enables property block var highlighting so
  they work when editing inside the block.

* Added "autostart" option to matlab-forward-sexp to aid in font-locking
  blocks.  This will move until a block the cursor is in is exited.
2019-09-29 19:30:01 -04:00
Eric Ludlam
9d3803e3d5 Add matlab-show-paren-or-block, an implementation for show-paren-mode.
Correctly highlights parens even when there are other parens in strings and comments.
In mode, init paren-mode with this fcn.  Disable older block highlighter.
2019-09-28 22:32:23 -04:00
Eric Ludlam
ff70f3e933 Font-lock funtion for strings and comments - Add elipsis to the list of matchable things.
Remove elipsis highliter from gaudy font lock elements.
Add matlab-up-string-or-comment, and matlab-backward-up-string-or-comment.
Add matlab-move-list-sexp-internal for navigating lists
Add matlab-move-simple-sexp-internal for navigating simple sexp expressions like comments, strings, and lists.
Update matlab-backward-sexp and matlab-forward-sexp replace emacs sexp navigation with above simple-sexp naviation functions.
Update matlb-cursor-comment-string-context to also return bounds to be used for navigating strings and comments.
2019-09-26 21:41:30 -04:00
Eric Ludlam
d2eadb289c Change font-locking for NaT to have correct case.
Update matlab-cursor-comment-string-context to also return elipsis if cursor after an elipsis.
2019-09-23 21:48:58 -04:00
Eric Ludlam
d2cf209b54 Remove some more left over comments. 2019-09-18 23:12:14 -04:00
Eric Ludlam
2f047c34b7 cleanup some leftover comments 2019-09-18 23:11:19 -04:00
Eric Ludlam
9664fb88ea Complete re-write of charvec/string highlighting support.
Regex version had too many mismatch conditions that could go subtly wrong.
New version philosophy:
* A single font-locker for comment, charvec, and comments.
* After matching a start for one of the above, identify the end
  location, custom for each type.
This prevents interaction between multiple font lock matchers.
For predicates like matlab-cursor-in-comment, same idea to avoid same problem.
* add a new fcn 'matlab-cursor-comment-string-context' which starts at
  beginning of line, and scans to point, identifying where the cursor
  is in.
* all predicates now use this new fcn.
Also, fix elipsis as comment highlighter.
2019-09-18 23:05:56 -04:00
Eric Ludlam
baa2270928 Add support for "strings" in addition to 'char vectors'.
Undo previous attempt at supporting strings.
Strategy: Have two sets of font lock functions, one for char vectors, and one for strings.
the "in a string" functions will check for both.
Added ' as an operator when it is placed as a transpose.
2019-09-18 20:04:00 -04:00
Uwe Brauer
3fbca4259b Add support for Strings in matlab mode (thanks to Eric Ludlam)
* matlab.el (matlab-string-start-regexp): Patch provided by Eric
Ludlam: adds support for Strings in matlab-mode. b = "string
scalar" and b = "string "" scalar" are now highlighted.
2018-09-28 17:26:26 +02:00
John Ciolfi
50266ff812 Allow completion within a line and better quit support. 2018-01-25 13:10:25 -05:00
John Ciolfi
239c0d67e3 Revamp README.org, allow emacsclient customization
* README.org: Revamp help. Remove stale items.
* matlab.el, emacsinit.m: make matlab-shell-emacsclient-command
  customizable so people can easily tailor the ">> edit file.m" behavior.
2017-12-05 20:52:11 -05:00
John Ciolfi
be1b68bd03 fix tab completiong, m-file debugging, and emacs warnings
See ChangeLog for details.
2017-12-05 14:08:53 -05:00
Uwe Brauer
32a69776d1 Patch for improved indent behaviour, using calls to 'current-column'. 2016-08-15 07:50:23 +00:00
Uwe Brauer
64f2a5635f Applied patch and changed version, to 3.3.6 2016-05-27 20:52:59 +00:00
Uwe Brauer
bd56554ad0 Apply patch by Thibault Marin <thibault.marin.us@ieee.org>. The patch
adds an option to matlab.el to align continuation lines after opening
parentheses with a single indent instead of aligning to the open
parenthesis.
2016-05-27 20:51:55 +00:00
Uwe Brauer
865c0b8b6d * matlab.el: Add an empty line after the first line in matlab.el,
maybe this will generate the desired info line when calling
package-list-package in GNU emacs. (MELPA).
2016-04-10 17:18:28 +00:00
Uwe Brauer
a513050994 * matlab.el (matlab-enable-block-highlighting): Applied patch
provided by
kaushal_modi@users.sf.net

* matlab.el (matlab-mode-version): change version to 3.3.5
2016-04-01 08:08:07 +00:00
Uwe Brauer
6361a95f6a 2016-03-17 Uwe Brauer <oub@mat.ucm.es>
* toolbox/dbhotlink.m (dbhotlink): new file
	* matlab.el (matlab-shell-mode): Applied patch from  Odd Andersen
	<odd.andersen@gmail.com>.
2016-03-17 08:16:35 +00:00
Uwe Brauer
3030994ffa *** empty log message *** 2016-02-10 10:27:23 +00:00
zappo
203fa9350b (matlab-mode-verify-fix-functions): Add matlab-mode-vf-classname.
(matlab-match-classdef-re): New.
(matlab-mode-vf-functionname): buffer substring no properties.
(matlab-mode-vf-classname): New.
2014-12-27 12:27:12 +00:00
zappo
050e6fee59 Handle difference in output of completion string. 2014-11-08 00:14:03 +00:00
zappo
c7ca733e97 (matlab-shell-completion-list): remove custom call to MCR with call to emacsdocomplete.m in the matlab-emacs toolbox directlry. 2014-11-05 16:43:39 +00:00
zappo
92e71ca479 (matlab-shell-font-lock-keywords): Tweak to support some changes in error output.
(matlab-comment): For comment on same line.  If we run out of space (fill-column)
pull the comment closer to the code.
(matlab-auto-fill): When filling a string, improve checking of when to add brackets
around the string.
(matlab-shell-mode): Disable html rendering trickery.
(gud-matlab-error-regexp): Add a new variant (off by default) as reminder to
go back and get the current ones to handle newer MATLAB error format.
2014-09-23 12:33:18 +00:00
zappo
c144a14491 (matlab-mode-version): Bump very-minor versin.
(matlab-ltype-comm): Add support for block comment detection.
(matlab-ltype-block-comm): New fcn.
(matlab-shell): Add TAB binding for TAB for when (tab) doesn't work.
Add support for setting WINDOWID environment variable so that MATLAB
will bring Emacs forward when typing in a figure.
2013-08-26 13:05:06 +00:00
zappo
889d06a3e3 (matlab-mode): Change page-delimeter to allow any whitespace or \n after a %%. 2012-02-23 13:39:48 +00:00
zappo
c751c103d6 (matlab-ltype-endfunction-comm): If the endfunction comment occurs on
a line, but the next bit of code isn't part of an enclosing fcn, then no.
(matlab-shell-mode): Patch from Eli Merriam;
make comint-input-filter-functions buffer local.
Add matlab-shell-render-html-txt-format hook to comint.
(matlab-txt-format-beg, matlab-txt-format-end): New
(matlab-shell-render-html-txt-format): New.
(matlab-shell-last-anchor-as-frame): New.
(matlab-shell-render-errors-as-anchor): Use last anchor var above.
Note: Not used for any logic yet. ;(
(matlab-shell-previous-matching-input-from-input): patch; Mark Histed
Force cursor to eol.
(matlab-shell-run-region): Force displayed buffer to recycled visible buffers.
2011-10-05 13:53:08 +00:00
davenar
e29c2d05d1 (matlab-shell-mode): Add `comint-postoutput-scroll-to-bottom' to
`comint-output-filter-functions' (suggested by Mark Histed).
2011-08-10 06:43:07 +00:00
davenar
2c4046efd2 (matlab-shell-run-region): Fix last commit and correctly use
`buffer-substring' again.
2011-08-09 21:10:38 +00:00
davenar
4e27fa2f9f (matlab-shell-run-region): When removing comments, do not touch matlab
strings or we might remove format specifiers.
2011-08-09 19:44:46 +00:00
davenar
33bbe29b0c (matlab-shell-run-region): Remove all comments before running a
region, otherwise `matlab-shell-run-cell' will break.
2011-07-17 19:17:40 +00:00
davenar
1c6c0079d5 (matlab-shell-run-region): Remove comment lines. If NOSHOW, also
remove continuations.
2011-07-17 19:15:15 +00:00
davenar
5336746dc3 (matlab-shell-run-region): New optional argument NOSHOW to replace
newlines with commas, so that by default this will not be done.
(matlab-shell-run-cell): Use it.
2011-07-17 15:43:36 +00:00
zappo
75f6a6d621 (matlab-shell-render-html-anchor): Add arbitrary reverse-search limit
to improve performance when the output buffer gets large.
2011-06-16 14:43:05 +00:00
zappo
ff4b860338 (matlab-shell-use-emacs-toolbox): Fix to use let* 2011-03-23 19:27:47 +00:00
zappo
c955ce95d3 (matlab-shell-running-matlab-release): Make more robust if matlab.el
is not on the path.
(matlab-shell-window-exists-for-display-completion-flag): New flag
(matlab-shell-tab): Update to set window exists flag (above) when
showing completions, and call hide-completions (below) when done
completing.
(matlab-shell-tab-hide-completions): New.
2011-03-23 14:40:28 +00:00
zappo
b7c4c9de4d (matlab-mode): Move line that moves point to end of buffer to just
in front of where it is used, and inside a save-excursion.
2010-12-08 16:18:56 +00:00
zappo
5ee5284da9 Patch from Rudiger Sonderfeld
(matlab-frame-init): Add a "switch to" in addition to "start" matlab
menu item to make it clear what will happen.
2010-12-06 14:48:20 +00:00
zappo
6dba92521e (matlab-mode): Wrap guessing of indentation in a save-excursion.
and running of hooks in a save excursion so point can be moved during
checking for the indentation style.
(matlab-toggle-show-mlint-warnings)
(matlab-toggle-highlight-cross-function-variables):
Always call mlint-minor-mode after a change, but pass in a numeric arg
to force on or off dependent on the current state.
2010-09-14 16:39:26 +00:00
zappo
dbacb80c1a (gud-matlab-error-regexp): Patch from EricW: Fix for more error types.
(matlab-shell-run-region): Add hack for replacing CR w/ ,.
(matlab-shell-last-error): Fix call to find other window call so 0 is a str.
2010-07-28 12:36:25 +00:00
zappo
b75a47ca58 (matlab-shell-html-map): Update how it is initialized.
Add binding for return
(matlab-anchor-beg): Add to expression to remove "matlab:"
(matlab-shell-render-html-anchor): Add help-echo.
(gud-matlab-error-regexp): Improve for newere MATLABs
(matlab-shell-last-error-anchor): New
(matlab-shell-render-errors-as-anchor): No longer depend on deleted
stack start/end variables which seem to no longer be active.
Add help-echo to overlay.
Change how 'first' is calculated, apply after the fact.
(gud-matlab-marker-filter):Don't collect if prompt hasn't been seen yet.
(matlab-shell-html-click): Now use below
(matlab-shell-html-go): New from above.
2010-04-06 14:01:04 +00:00
zappo
bc6d421b5e (gud-matlab-marker-filter): Don't filter out backspace.
In section collecting whole error strings, wait for \n, not the prompt.
2010-01-13 13:18:32 +00:00
zappo
6c2751af81 (matlab-mode-version): Update minor version number.
(matlab-indent-function-body): Add 'MathWorks-Standard option.
(matlab-functions-have-end-minor-mode): Add code to flip the
`matlab-functions-have-end' variable.
(matlab-do-functions-have-end-p): New.
(matlab-indent-function-body-p): New function.
(matlab-mode): First detect if fcns have end, save.
Next detect indenting fcn bodies based on 'guess.
(matlab-calculate-indentation-1, matlab-next-line-indentation)
(matlab-frame-init):
Use fcn form of indent-function-body.
2010-01-05 16:14:47 +00:00
zappo
b4f6e45fe4 (matlab-shell-tab): Add '.' to list of chars that limit completion.
This enables structure completion.
2009-09-23 15:51:32 +00:00
zappo
c9fc179476 (matlab-shell-mode): Add debugging next, and fix step to step in. 2009-09-03 21:43:31 +00:00
zappo
c1f3d8d7f3 (gud-matlab-marker-filter): Remove debug message. 2009-09-03 21:37:30 +00:00
zappo
ab496c083e (matlab-shell-mode): Add matlab-shell-render-errors-as-anchor to
comint-output-filter-functions.
(matlab-anchor-beg,matlab-anchor-end)
(gud-matlab-marker-regexp-1,gud-matlab-marker-regexp-2): Moved.
(gud-matlab-marker-regexp-prefix): Updated.
(gud-matlab-error-regexp): Updated.
(matlab-last-frame-returned): Deleted.
(gud-matlab-error-regexp): Updated.
(matlab-shell-render-html-anchor): Remove debugger jumping code.
(matlab-shell-error-stack-start, matlab-shell-error-stack-end): New
(matlab-shell-render-errors-as-anchor): New.
(gud-matlab-marker-filter): Remove support for MATLAB 5 debugging.
I don't think it would have worked anyway.  (matlab-one-db-request stuff).
For frame calculations, query out of gud-marker-acc instead of scanning the buffer
which was unreliable.
When stripping individual lines from the return buffer, only do so if
there is no telltale sign of debugger output.
(matlab-url-stack-top-at): New.
(matlab-shell-previus-matlab-url):Call above is new arg is t.
(matlab-find-other-window-file-line-column): Be robust to more types
of file names that might not have .m on the end.
(matlab-shell-last-error): Specify there might be a stack, and choose the top.
2009-09-03 21:34:15 +00:00
zappo
51ec21037a (mline): Remove require.
(matlab-functions-have-end-minor-mode): Remove bogus doc string (copy paste bug).
2009-08-21 18:28:13 +00:00
zappo
42276a63b2 (mlint): Add require.
(defcustom, etc): Delete old backward compatable stuff for Emacs 19.
(matlab-toggle-functions-have-end-minor-mode): Moved to supress
byte compile warnings.
(matlab-font-lock-nested-function-keyword-match)
(matlab-font-lock-cross-function-variables-match): Make overlay a local variable.
(matlab-mode): Comments about byte-comp warnings.
(gud-matlab-marker-filter,matlab-find-other-window-file-line-column):
Use string-to-number.
(matlab-shell-run-region-or-line): New new mechanism w/ transient-mark-mode.
(matlab-shell-topic-highlight-line): Add comment.
2009-08-13 18:16:46 +00:00
zappo
f860cfc5a5 Misc: Add (R) to some occurances of MATLAB.
OBSOLETE STUFF:
(matlab-hilit19-patterns,fume-function-name-regexp-matlab)
(fume-find-next-matlab-function-name,matlab-mode-hilit): Delete
(matlab-imenu-generic-expression): Get rid of fume use.
INDENT FIX:
(matlab-valid-end-construct-p,matlab-lattr-block-close)
(matlab-calc-indent,matlab-calculate-indentation)
(matlab-calculate-indentation-1): Handle multiple ends on one line.
MATLAB EDITOR UPDATE:
(matlab-shell-history-file): Calculate from below.
(matlab-shell-running-matlab-version, matlab-shell-running-matlab-release)
(matlab-shell-use-emacs-toolbox, matlab-shell-emacsclient-command):
New variables.
(matlab-shell,matlab-shell-hack-logo,matlab-shell-mode)
(gud-matlab-marker-filter):
Calc version from output.
(matlab-shell-version-scrape): New, for above.
(matlab-shell-next-matching-input-from-input)
(matlab-shell-prev-matching-input-from-input): New commands.
(matlab-find-other-window-via-url): Support opentoline links.
2009-08-13 16:35:45 +00:00
zappo
b386cacce0 (matlab-mode-version): Update. 2009-07-06 20:04:18 +00:00