Fixes: debbugs:18031
* lisp/progmodes/sh-script.el (sh-smie-sh-rules): Go back to the beginning
of the whole pipe when indenting an opening keyword after a |.
Generalize this treatment to opening keywords like "while".
Originally reported in https://github.com/mooz/js2-mode/issues/174.
* lisp/progmodes/js.el (js--indent-operator-re): Make assignments and
(in)equality operator a separate case.
(js--continued-expression-p): Escape the second `+' in the regexp.
* lisp/progmodes/sh-script.el (sh-mode-syntax-table): Set syntax of ;|&.
(sh-smie--default-forward-token, sh-smie--default-backward-token):
New functions.
(sh-smie-sh-forward-token, sh-smie-sh-backward-token)
(sh-smie-rc-forward-token, sh-smie-rc-backward-token): Use them.
(sh-smie-sh-rules): Fix indentation of a pipe at BOL.
Fixes: debbugs:17842
(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.
inconsistent second element of the list returned by
`smie-indent--parent'.
(ruby-font-lock-keywords): Disqualify any identifier before `=' as
method call.
* 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.
* 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
* 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).
* mail/unrmail.el (unrmail-mbox-format): Choice is mboxo, not mboxro.
* woman.el (woman-mark-horizontal-position):
Rename from woman-mark-horizonal-position. Use changed.
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
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
* 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'.
* 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.
* lisp/progmodes/js.el (js-auto-indent-flag): Remove, was unused.
(js-switch-indent-offset): New option.
(js--proper-indentation): Use it. And handle the case when
"default" is actually a key in an object literal.
(js--same-line): New function.
(js--multi-line-declaration-indentation): Use it.
(js--indent-in-array-comp, js--array-comp-indentation): New
functions.
(js--proper-indentation): Use them, to handle array comprehension
continuations.
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 "|".
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.
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.
(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.
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.
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.