aboutsummaryrefslogtreecommitdiffstats
path: root/test/indent/ruby.rb (unfollow)
Commit message (Collapse)AuthorFilesLines
2016-03-16Fix Ruby's operator precedenceDmitry Gutov1-1/+22
* lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Rearrange the smie-precs->prec2 form.
2016-03-15Do not tokenize a comment before continuation as ';'Dmitry Gutov1-1/+1
* lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p): Account for a comment right after point.
2016-03-15Don't misindent arguments of a method call inside continuationDmitry Gutov1-0/+11
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Use smie-indent-virtual instead of smie-rule-parent (bug#23015). Simplify the traversal loop.
2016-03-14Tweak the left precedence of '=>'Dmitry Gutov1-0/+6
* lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Tweak the left precedence of '=>', to improve indentation and sexp navigation.
2016-03-14Indent '.' relative to the first sibling expressionDmitry Gutov1-0/+5
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Indent '.' relative to the first sibling expression, instead of the parent token (bug#17213).
2016-03-12Support Ruby 2.3.0's safe navigation operatorDmitry Gutov1-4/+5
* lisp/progmodes/ruby-mode.el (ruby-smie--forward-token) (ruby-smie--backward-token): Tokenize '&.' as '.'. (ruby-smie--implicit-semi-p): Check for possible '&' before '.'. * test/indent/ruby.rb: Add an example using safe navigation operator. Fix a syntax error in existing example.
2016-03-10Indent methods with keyword names correctlyDmitry Gutov1-0/+3
* lisp/progmodes/ruby-mode.el (ruby-smie--at-dot-call): Rename to ruby-smie--before-method-name. Now also check if we're after a 'def' keyword. Update both callers.
2016-03-10Propertize character literals and special global variables differentlyDmitry Gutov1-0/+3
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize): Propertize character literals and global variables with special names with prefix and symbol syntax classes, for SMIE to tokenize them together automatically. (ruby-font-lock-keywords): Fix an old regression in highlighting character literals.
2016-03-09Propertize operator symbol names with symbol syntax classDmitry Gutov1-0/+6
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize): Do it here. (ruby-font-lock-keywords): Instead of handling them here. Leave highlighting them to the "normal" matcher, because now we can. (ruby-smie--forward-token, ruby-smie--backward-token): Likewise, don't special-case operator symbols anymore. (ruby-smie--args-separator-p): Simplify the regexp, match operator names with \s_. (ruby-smie--implicit-semi-p): Handle the special cases of ? and = at EOL the same way: check if the character has been assigned the symbol syntax class by syntax-propertize.
2016-03-07Recognize iuwu-mod after an escaped newlineDmitry Gutov1-0/+3
* lisp/progmodes/ruby-mode.el (ruby-smie--bosp): Check if the newline is escaped. (ruby-smie-rules): Indent iuwu-mod after an escaped newline correctly.
2016-01-21Support squiggly heredocs in ruby-modeDmitry Gutov1-0/+4
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re): Support squiggly heredocs added in Ruby 2.3. * test/indent/ruby.rb: Add squiggly example.
2015-11-24Rename all test files to reflect source layout.Phillip Lord1-414/+0
* CONTRIBUTE,Makefile.in,configure.ac: Update to reflect test directory moves. * test/file-organisation.org: New file. * test/automated/Makefile.in test/automated/data/decompress/foo.gz test/automated/data/epg/pubkey.asc test/automated/data/epg/seckey.asc test/automated/data/files-bug18141.el.gz test/automated/data/flymake/test.c test/automated/data/flymake/test.pl test/automated/data/package/archive-contents test/automated/data/package/key.pub test/automated/data/package/key.sec test/automated/data/package/multi-file-0.2.3.tar test/automated/data/package/multi-file-readme.txt test/automated/data/package/newer-versions/archive-contents test/automated/data/package/newer-versions/new-pkg-1.0.el test/automated/data/package/newer-versions/simple-single-1.4.el test/automated/data/package/package-test-server.py test/automated/data/package/signed/archive-contents test/automated/data/package/signed/archive-contents.sig test/automated/data/package/signed/signed-bad-1.0.el test/automated/data/package/signed/signed-bad-1.0.el.sig test/automated/data/package/signed/signed-good-1.0.el test/automated/data/package/signed/signed-good-1.0.el.sig test/automated/data/package/simple-depend-1.0.el test/automated/data/package/simple-single-1.3.el test/automated/data/package/simple-single-readme.txt test/automated/data/package/simple-two-depend-1.1.el test/automated/abbrev-tests.el test/automated/auto-revert-tests.el test/automated/calc-tests.el test/automated/icalendar-tests.el test/automated/character-fold-tests.el test/automated/comint-testsuite.el test/automated/descr-text-test.el test/automated/electric-tests.el test/automated/cl-generic-tests.el test/automated/cl-lib-tests.el test/automated/eieio-test-methodinvoke.el test/automated/eieio-test-persist.el test/automated/eieio-tests.el test/automated/ert-tests.el test/automated/ert-x-tests.el test/automated/generator-tests.el test/automated/let-alist.el test/automated/map-tests.el test/automated/advice-tests.el test/automated/package-test.el test/automated/pcase-tests.el test/automated/regexp-tests.el test/automated/seq-tests.el test/automated/subr-x-tests.el test/automated/tabulated-list-test.el test/automated/thunk-tests.el test/automated/timer-tests.el test/automated/epg-tests.el test/automated/eshell.el test/automated/faces-tests.el test/automated/file-notify-tests.el test/automated/auth-source-tests.el test/automated/gnus-tests.el test/automated/message-mode-tests.el test/automated/help-fns.el test/automated/imenu-test.el test/automated/info-xref.el test/automated/mule-util.el test/automated/isearch-tests.el test/automated/json-tests.el test/automated/bytecomp-tests.el test/automated/coding-tests.el test/automated/core-elisp-tests.el test/automated/decoder-tests.el test/automated/files.el test/automated/font-parse-tests.el test/automated/lexbind-tests.el test/automated/occur-tests.el test/automated/process-tests.el test/automated/syntax-tests.el test/automated/textprop-tests.el test/automated/undo-tests.el test/automated/man-tests.el test/automated/completion-tests.el test/automated/dbus-tests.el test/automated/newsticker-tests.el test/automated/sasl-scram-rfc-tests.el test/automated/tramp-tests.el test/automated/obarray-tests.el test/automated/compile-tests.el test/automated/elisp-mode-tests.el test/automated/f90.el test/automated/flymake-tests.el test/automated/python-tests.el test/automated/ruby-mode-tests.el test/automated/subword-tests.el test/automated/replace-tests.el test/automated/simple-test.el test/automated/sort-tests.el test/automated/subr-tests.el test/automated/reftex-tests.el test/automated/sgml-mode-tests.el test/automated/tildify-tests.el test/automated/thingatpt.el test/automated/url-future-tests.el test/automated/url-util-tests.el test/automated/add-log-tests.el test/automated/vc-bzr.el test/automated/vc-tests.el test/automated/xml-parse-tests.el test/BidiCharacterTest.txt test/biditest.el test/cedet/cedet-utests.el test/cedet/ede-tests.el test/cedet/semantic-ia-utest.el test/cedet/semantic-tests.el test/cedet/semantic-utest-c.el test/cedet/semantic-utest.el test/cedet/srecode-tests.el test/cedet/tests/test.c test/cedet/tests/test.el test/cedet/tests/test.make test/cedet/tests/testdoublens.cpp test/cedet/tests/testdoublens.hpp test/cedet/tests/testfriends.cpp test/cedet/tests/testjavacomp.java test/cedet/tests/testnsp.cpp test/cedet/tests/testpolymorph.cpp test/cedet/tests/testspp.c test/cedet/tests/testsppcomplete.c test/cedet/tests/testsppreplace.c test/cedet/tests/testsppreplaced.c test/cedet/tests/testsubclass.cpp test/cedet/tests/testsubclass.hh test/cedet/tests/testtypedefs.cpp test/cedet/tests/testvarnames.c test/etags/CTAGS.good test/etags/ETAGS.good_1 test/etags/ETAGS.good_2 test/etags/ETAGS.good_3 test/etags/ETAGS.good_4 test/etags/ETAGS.good_5 test/etags/ETAGS.good_6 test/etags/a-src/empty.zz test/etags/a-src/empty.zz.gz test/etags/ada-src/2ataspri.adb test/etags/ada-src/2ataspri.ads test/etags/ada-src/etags-test-for.ada test/etags/ada-src/waroquiers.ada test/etags/c-src/a/b/b.c test/etags/c-src/abbrev.c test/etags/c-src/c.c test/etags/c-src/dostorture.c test/etags/c-src/emacs/src/gmalloc.c test/etags/c-src/emacs/src/keyboard.c test/etags/c-src/emacs/src/lisp.h test/etags/c-src/emacs/src/regex.h test/etags/c-src/etags.c test/etags/c-src/exit.c test/etags/c-src/exit.strange_suffix test/etags/c-src/fail.c test/etags/c-src/getopt.h test/etags/c-src/h.h test/etags/c-src/machsyscalls.c test/etags/c-src/machsyscalls.h test/etags/c-src/sysdep.h test/etags/c-src/tab.c test/etags/c-src/torture.c test/etags/cp-src/MDiagArray2.h test/etags/cp-src/Range.h test/etags/cp-src/burton.cpp test/etags/cp-src/c.C test/etags/cp-src/clheir.cpp.gz test/etags/cp-src/clheir.hpp test/etags/cp-src/conway.cpp test/etags/cp-src/conway.hpp test/etags/cp-src/fail.C test/etags/cp-src/functions.cpp test/etags/cp-src/screen.cpp test/etags/cp-src/screen.hpp test/etags/cp-src/x.cc test/etags/el-src/TAGTEST.EL test/etags/el-src/emacs/lisp/progmodes/etags.el test/etags/erl-src/gs_dialog.erl test/etags/f-src/entry.for test/etags/f-src/entry.strange.gz test/etags/f-src/entry.strange_suffix test/etags/forth-src/test-forth.fth test/etags/html-src/algrthms.html test/etags/html-src/index.shtml test/etags/html-src/software.html test/etags/html-src/softwarelibero.html test/etags/lua-src/allegro.lua test/etags/objc-src/PackInsp.h test/etags/objc-src/PackInsp.m test/etags/objc-src/Subprocess.h test/etags/objc-src/Subprocess.m test/etags/objcpp-src/SimpleCalc.H test/etags/objcpp-src/SimpleCalc.M test/etags/pas-src/common.pas test/etags/perl-src/htlmify-cystic test/etags/perl-src/kai-test.pl test/etags/perl-src/yagrip.pl test/etags/php-src/lce_functions.php test/etags/php-src/ptest.php test/etags/php-src/sendmail.php test/etags/prol-src/natded.prolog test/etags/prol-src/ordsets.prolog test/etags/ps-src/rfc1245.ps test/etags/pyt-src/server.py test/etags/tex-src/gzip.texi test/etags/tex-src/nonewline.tex test/etags/tex-src/testenv.tex test/etags/tex-src/texinfo.tex test/etags/y-src/atest.y test/etags/y-src/cccp.c test/etags/y-src/cccp.y test/etags/y-src/parse.c test/etags/y-src/parse.y test/indent/css-mode.css test/indent/js-indent-init-dynamic.js test/indent/js-indent-init-t.js test/indent/js-jsx.js test/indent/js.js test/indent/latex-mode.tex test/indent/modula2.mod test/indent/nxml.xml test/indent/octave.m test/indent/pascal.pas test/indent/perl.perl test/indent/prolog.prolog test/indent/ps-mode.ps test/indent/ruby.rb test/indent/scheme.scm test/indent/scss-mode.scss test/indent/sgml-mode-attribute.html test/indent/shell.rc test/indent/shell.sh test/redisplay-testsuite.el test/rmailmm.el test/automated/buffer-tests.el test/automated/cmds-tests.el test/automated/data-tests.el test/automated/finalizer-tests.el test/automated/fns-tests.el test/automated/inotify-test.el test/automated/keymap-tests.el test/automated/print-tests.el test/automated/libxml-tests.el test/automated/zlib-tests.el: Files Moved.
2015-03-08Add an indent test example for bug#20026Dmitry Gutov1-0/+4
* test/indent/ruby.rb: Add an example for bug#20026.
2014-05-27* test/indent/ps-mode.ps: New file.Stefan Monnier1-0/+4
* test/automated/core-elisp-tests.el (core-elisp-test-window-configurations): New test. * test/indent/octave.m: Add a few more tests. * test/indent/ruby.rb: Add one more test.
2014-05-10* lisp/emacs-lisp/nadvice.el: Support adding a given function multiple times.Stefan Monnier1-0/+3
(advice--member-p): If name is given, only compare the name. (advice--remove-function): Don't stop at the first match. (advice--normalize-place): New function. (add-function, remove-function): Use it. (advice--add-function): Pass the name, if any, to advice--remove-function.
2014-03-27Fix bug#17097Dmitry Gutov1-0/+5
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Don't propertize `?' or `!' as symbol constituent when after colon.
2014-03-21Fix bug#17050Dmitry Gutov1-0/+17
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Add indentation rule for ` @ '.
2014-03-02* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): HighlightDmitry Gutov1-0/+4
regexp options. Fixes: debbugs:16914
2014-02-25Spelling fix.Paul Eggert1-1/+1
2014-02-23* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Handle theDmitry Gutov1-0/+7
inconsistent second element of the list returned by `smie-indent--parent'. (ruby-font-lock-keywords): Disqualify any identifier before `=' as method call.
2014-02-23* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Don't indent speciallyDmitry Gutov1-1/+7
after `=>'. Fixes: debbugs:16811
2014-02-01Fix bug#16609Dmitry Gutov1-0/+7
* lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p): Check for `:' before binary operators. Don't check for `:' before `[' and `(', or their syntax status. A percent literal can't end with either.
2014-01-31Implement user option ruby-align-chained-callsDmitry Gutov1-4/+4
* lisp/progmodes/ruby-mode.el (ruby-align-chained-calls): New option. (ruby-smie-grammar): Make "." right-associative. Make its priority lower than the ternary and all binary operators. (ruby-smie-rules): Indent "(" relative to the first non-"." parent, or the first "." parent at indentation. Use `ruby-align-chained-calls' for indentation of "." tokens. * test/automated/ruby-mode-tests.el (ruby-align-chained-calls): New test. Fixes: debbugs:16593
2014-01-17ruby-mode: Align def...end to the beginning of statementDmitry Gutov1-0/+4
* lisp/progmodes/ruby-mode.el (ruby-alignable-keywords): New constant. (ruby-align-to-stmt-keywords): Change the default value. Use `ruby-alignable-keywords' to generate the possible customization choices. (ruby-smie-rules): Instead of using a hardcoded list of alignable keywords, check against the value of `ruby-alignable-keywords' (http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01439.html).
2013-12-22* lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p): Return tDmitry Gutov1-0/+1
after `{'. We need it after block openers, and it doesn't seem to hurt after hash openers.
2013-12-22* lisp/progmodes/ruby-mode.el (ruby-align-to-stmt-keywords): Tweak theDmitry Gutov1-0/+6
docstring. (ruby-smie-rules): Indent plus one level after `=>'.
2013-12-20* lisp/progmodes/ruby-mode.el (ruby-align-to-stmt-keywords): NewDmitry Gutov1-21/+16
option. (ruby-smie--indent-to-stmt-p): Use it. (ruby-smie-rules): Revert the logic in the handling of `when'. Expand the `begin' clause to handle `ruby-align-to-stmt-keywords'. (ruby-deep-arglist, ruby-deep-indent-paren) (ruby-deep-indent-paren-style): Update docstrings to note that the vars don't have any effect with SMIE. * test/automated/ruby-mode-tests.el: Add tests for `ruby-align-to-stmt-keywords'. * test/indent/ruby.rb: Update examples to reflect the lack of change in default indentation of `begin' blocks. Fixes: debbugs:16182
2013-12-19* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Indent middle-of-blockDmitry Gutov1-0/+4
keywords to their parent.
2013-12-19* lisp/progmodes/ruby-mode.el (ruby-smie--args-separator-p): Allow theDmitry Gutov1-6/+17
first arg to be a string (fixed dead code), or an operator symbol. (ruby-smie--forward-token): Tokenize ` @ ' before strings and operator symbols. (ruby-smie-rules): Remove parent token check in the `.' clause, it did nothing. Don't respond to `(:after ".")', it will be called with :before anyway. Remove the ` @ ' rule, it didn't seem to change anything. Only return indentation for binary operators when they are hanging. De-dent opening paren when its parent is `.', otherwise it looks bad when the dot is not at bol or eol. Fixes: debbugs:16182
2013-12-17* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Indent ternary if.Dmitry Gutov1-0/+4
2013-12-17Fix bug#16116Dmitry Gutov1-6/+3
* lisp/emacs-lisp/smie.el (smie-indent--rule): Extract `smie-indent--rule-1'. (smie-indent-close): Call `smie-indent--rule-1' with METHOD :close-all, to see which indentation method to use. (smie-rules-function): Document the method :close-all. * test/indent/ruby.rb: Update examples according to the change in `smie-indent-close'.
2013-12-14Fix bug#16118Dmitry Gutov1-4/+35
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Return nil before open-paren tokens when preceded by a open-paren, too. (ruby-smie-rules): Handle virtual indentation after open-paren tokens specially. If there is code between it and eol, return the column where is starts. * test/indent/ruby.rb: New examples.
2013-12-09* lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p): Return tDmitry Gutov1-0/+3
after the end of a percent literal.
2013-11-12* lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Disambiguate betweenDmitry Gutov1-0/+3
binary "|" operator and closing block args delimiter. Remove FIXME comment referring to Ruby 1.8-only syntax. (ruby-smie--implicit-semi-p): Not after "|" operator. (ruby-smie--closing-pipe-p): New function. (ruby-smie--forward-token, ruby-smie--backward-token): Use it. (ruby-smie-rules): Indent after "|".
2013-11-09* lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p):Dmitry Gutov1-2/+7
Not after "||". (ruby-smie-rules): Indent non-hanging "begin" blocks as part of their parent.
2013-11-08* indent/ruby.rb: New exampleDmitry Gutov1-0/+7
2013-11-08* lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Improve precedencesDmitry Gutov1-2/+29
of "and", "or", "&&" and "||". (ruby-smie--args-separator-p): Prohibit keyword "do" as the first argument. Prohibit opening curly brace because it could only be a block opener in that position. (ruby-smie--forward-token, ruby-smie--backward-token): Separate "|" from "&" or "*" going after it. That can happen in block arguments. (ruby-smie--indent-to-stmt): New function, seeks the end of previous statement or beginning of buffer. (ruby-smie-rules): Use it. (ruby-smie-rules): Check if there's a ":" before a curly block opener candidate; if there is, it's a hash. * test/indent/ruby.rb: New examples.
2013-11-07* lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p):Dmitry Gutov1-0/+12
No implicit semi after "^", "and" or "or". (ruby-smie-grammar): New tokens: "and" and "or". (ruby-smie--args-separator-p): Fix the check for tokens at POS. Exclude "and" and "or". Remove "do" in order to work around token priorities. (ruby-smie-rules): Add all infix tokens. Handle the case of beginning-of-buffer.
2013-11-07* lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Lower priority ofDmitry Gutov1-3/+1
"." compared to "do".
2013-11-04* test/indent/ruby.rb: Move a now-successful example.Dmitry Gutov1-4/+4
2013-11-04* lisp/progmodes/ruby-mode.el (ruby-smie--forward-token)Dmitry Gutov1-0/+1
(ruby-smie--backward-token): Tokenize heredocs as semicolons. * test/automated/ruby-mode-tests.el: Remove outdated comment. * test/indent/ruby.rb: Add a statement on the line after heredoc.
2013-11-02* lisp/progmodes/ruby-mode.el (ruby-smie--rule-parent-skip-assign): NewDmitry Gutov1-0/+8
function, replacement for `smie-rule-parent' for when we want to skip over our direct parent if it's an assignment token.. (ruby-smie-rules): Use it.
2013-10-27* lisp/progmodes/ruby-mode.el (ruby-smie--bosp): Anything that goesDmitry Gutov1-0/+5
after `=' is probably a new expression.
2013-10-26* test/indent/ruby.rb: New failing example.Dmitry Gutov1-0/+4
2013-10-26* lisp/progmodes/ruby-mode.el (ruby-smie--args-separator-p): Be moreDmitry Gutov1-12/+13
specific in what the first arg can be: a non-keyword word, string/regexp/percent literal opener, opening paren, or unary operator followed directly by word. * test/automated/ruby-mode-tests.el (ruby-toggle-block-to-brace): Fix the test, in respect to adding the space after the curly.
2013-10-24* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Fix the "curly blockDmitry Gutov1-1/+1
with parameters" example. Simplify the "is it block or is it hash" check, but also make it more thorough. * test/indent/ruby.rb: Fix syntax error in the latest example.
2013-10-23* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Only align with parent ofStefan Monnier1-0/+4
{ if it is hanging.
2013-10-23* test/indent/ruby.rb: Move two examples to "working" section, add oneDmitry Gutov1-7/+11
more.
2013-10-22* lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Remove outdatedDmitry Gutov1-3/+14
TODO. Add "." after " @ ". (ruby-smie--at-dot-call): New function. Checks if point at method call with explicit target. (ruby-smie--forward-token, ruby-smie--backward-token): Prepend "." to the method name tokens when it precedes them. (ruby-smie--backward-id, ruby-smie--forward-id): Remove. (ruby-smie-rules): Add rule for indentation before and after "." token.
2013-10-21* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Indent after + used asStefan Monnier1-2/+2
an instruction.