Skip to content

Commit

Permalink
auto merge of #9015 : MicahChalmer/rust/emacs-fixes-round-2, r=nikoma…
Browse files Browse the repository at this point in the history
…tsakis

Here are fixes for more problems mentioned in #8787.  I think I've addressed everything mentioned there except for @nikomatsakis's comment about match/patterns now.  (This also fixes the bug in struct alignment that @pnkfelix mentioned from my earlier pull request #8872.)

The biggest change here is to make fill-paragraph (M-q) and auto-fill-mode work inside different variations of multi-line and doc comments.  Because of the way emacs paragraph fills work (callbacks interacting with global regexp variables that are used in odd ways) there were quite a few edge cases that I had to work around.

The only way I was able to keep it all straight was to create some regression tests.  They use the emacs lisp regression testing tool ERT, and are included as the last commit here.  I added a few tests for indentation as well.  I have not attempted to integrate the tests into the overall rust compiler build process, since I can't imagine anyone would want the compiler build to have a dependency on emacs.  Maybe at some point tools like this get their own repositories?  Just a thought.

One other thought related to the tests: should there be a place to put these types of style samples that isn't specific to one text editor?  Maybe as part of an official rust style guide, but in a form that would allow tools like this to pull out the samples and use them for tests?
  • Loading branch information
bors committed Sep 7, 2013
2 parents f6b36c6 + a469734 commit b3d50fc
Show file tree
Hide file tree
Showing 4 changed files with 568 additions and 35 deletions.
6 changes: 6 additions & 0 deletions src/etc/emacs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ marking, press x, and ELPA will install the packages for you (under

* or using <kbd>M-x package-install rust-mode

### Tests via ERT

The file `rust-mode-tests.el` contains tests that can be run via ERT. You can
use `run_rust_emacs_tests.sh` to run them in batch mode, if emacs is somewhere
in your `$PATH`.

### Known bugs

* Combining `global-whitespace-mode` and `rust-mode` is generally glitchy.
Expand Down
3 changes: 3 additions & 0 deletions src/etc/emacs/run_rust_emacs_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This runs the test for emacs rust-mode.
# It must be possible to find emacs via PATH.
emacs -batch -l rust-mode.el -l rust-mode-tests.el -f ert-run-tests-batch-and-exit
Loading

0 comments on commit b3d50fc

Please sign in to comment.