| Age | Commit message (Collapse) | Author |
|
|
|
The "<" syntax-setting code could be confused after a "?". This patch
changes the code to treat "?" as an "ambiguous operator" and adjust
according to further context.
Fixes #200
|
|
set open-paren-in-column-0-is-defun-start to nil
|
|
Set open-paren-in-column-0-is-defun-start to nil in rust-mode. This
setting is a performance hack in Emacs, at the expense of correctness in
some cases. However, due to the syntax-ppss cache, I doubt whether this
hack is needed for Rust code.
Fixes #107
|
|
font-lock-syntactic-keywords have been obsolete since Emacs 24.1, the
earliest version supported by rust-mode. Instead, modes are
encouraged to use syntax-propertize-function.
syntax-propertize-function provides a generally better experience.
Syntax propertization is not tied to font lock,so angle bracket
matching will still work when font-lock is disabled. There's no
longer a need to call font-lock-fontify-buffer or font-lock-ensure
(you can see this in the tests). The resulting code is also shorter.
I removed a few tests:
* font-lock-raw-string-constant was written assuming font-lock based
syntax propertization, but that's no longer the case.
* font-lock-extend-region-in-string and
rust-test-revert-hook-preserves-point both called functions that no
longer exist.
There's a fix for a hidden bug in rust-is-in-expression-context. This
previously could signal in some situations, but the signal was hidden
by font-lock. It was visible now when running tests, hence the new
call to condition-case.
I suspect this might fix #192, but I haven't tried it.
|
|
rust-mode-tests.el uses "&optional &rest" in some function signatures.
This was never really correct, and newer versions of Emacs complain
about it. &rest implies &optional, so removing &optional is all that is
needed.
|
|
Recognize "extern" imenu items
|
|
fix PR link in README
|
|
|
|
Fixes #188.
|
|
Add instructions for version tag update requests
|
|
Recognize imenu items starting with "unsafe"
|
|
handle indirect buffers and multiple windows in rust-format-buffer
|
|
minor cleanups: https links and defcustom grouping
|
|
|
|
|
|
|
|
|
|
|
|
Bump version - this commit will also be added as a version tag.
|
|
|
|
Handle comments when indenting method chains
|
|
Previously, indentation went wrong when the comment on the line above
looked like a method call/member access:
fn main() {
// Lorem ipsum lorem ipsum lorem ipsum lorem.ipsum
foo.bar()
}
With this patch:
fn main() {
// Lorem ipsum lorem ipsum lorem ipsum lorem.ipsum
foo.bar()
}
Also, a blank line or a comment broke method-chain indentation:
fn main() {
something.a.do_it
// A comment
.aligned
.more_alignment();
}
With this patch:
fn main() {
something.a.do_it
// A comment
.aligned
.more_alignment();
}
Note that comments interleaving a method chain are not aligned with the
'.' of the method chain.
|
|
|
|
|
|
Fix #168: use while in rust-rewind-irrelevant
|
|
Before applying #169 the new test fails with a stack overflow, with #169
it passes.
|
|
Rewrite the recursive function `rust-rewind-irrelevant`, which causes a
stack overflow in #168, using a `while` loop.
|
|
fix regex to account for `[E123]`
|
|
Correctly restore point position after running rustfmt
|
|
|
|
The previous approach simply moved to the same character offset. This is
unlikely to preserve the position of point, as rustfmt often changes
whitespace, changing the number of characters before point.
Instead, we go back to the line number and column number we were on
before. Provided that rustfmt has not radically changed the number of
lines, this will typically put point back to its previous position, or
at least close.
Improves, but doesn't completely solve, issue #162.
|
|
Otherwise, rust-format-buffer always moves point to the end of the
buffer.
|
|
[master] Copy buffer only when format changes.
|
|
Fix #160
|
|
|
|
Use `font-lock-fontify-region` on the whole buffer to actually force
refontification in Emacs 24, which does not support `font-lock-ensure`.
`font-lock-fontify-buffer` is actually closer to `font-lock-flush`, so it's not
the right function to use in `rust--after-revert-hook`.
|
|
|
|
Improve imenu support
|
|
All items gathered by imenu were put at the top-level, except impls.
This commit puts all items in separate menu titles, following "Impl".
Fixes #93.
|
|
imenu did not register macros previously.
We must add `!` to the `word` syntax category for imenu since we reuse
the `rust-re-item-def-imenu` regexp which use word boundaries.
|
|
Fixes #94.
This commit changes the regexp used to build
`rust-imenu-generic-expression` to strictly match item definitions
on lines that are not single-line comments.
|
|
add code to handle new-style rustc errors
|
|
These errors are available on nightly builds (or will be soon), but
only (at the moment) when enabled via environment variable. They will
become the default at some point in the future.
In this commit we match on the `-->`, but after that we have to scroll
the compilation window to make the error visible. One shortcoming is
that if you enter the window and click on the filename/line-number, then
the "next-error-hook" doesn't seem to run. (If you click at the start of
the line, it does.) It may be possible to tweak the "hyperlink" here to
make that work more smoothly, or perhaps add a hook somewhere else.
|
|
Fix #151
|
|
Always check whether we're not in a string or comment when looking for
the `where` keyword. Use two helpers for this: `rust-looking-at-where`
and `rust-rewind-to-where`.
|
|
When looking for a `where` in
`rust-rewind-to-beginning-of-current-level-expr`, check that it is not
part of a string or comment.
|
|
Fill regular block comments correctly
|
|
|
|
|