1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00
Commit Graph

107 Commits

Author SHA1 Message Date
Stefan Monnier
e3c24b171b * lisp/progmodes/sh-script.el: Fix indentation rule of "| while".
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".
2014-12-04 10:09:08 -05:00
Dmitry Gutov
c613f4d6c1 Fix indentation before !=' and after +='
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.
2014-11-16 14:19:16 +02:00
Stefan Monnier
af86b05fd4 test/indent/scheme.scm: New file. 2014-09-02 16:47:44 -04:00
Stefan Monnier
d8899d09b9 * lisp/progmodes/sh-script.el (sh-smie-sh-rules): Don't align with a && in
the middle of a line.

Fixes: debbugs:17896
2014-07-08 14:38:07 -04:00
Stefan Monnier
370ceb2210 Fix some indentation problem with \; and pipes.
* 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
2014-06-24 16:16:10 -04:00
Stefan Monnier
9e248ebdc7 * lisp/progmodes/sh-script.el (sh-smie-sh-rules): For { after &&, don't
align with the surrounding parent.

Fixes: debbugs:17721
2014-06-20 10:23:30 -04:00
Stefan Monnier
500dce5f4d * lisp/emacs-lisp/smie.el (smie--hanging-eolp-function): New var.
(smie-indent--hanging-p): Use it.
* lisp/progmodes/sh-script.el (sh-set-shell): Set it.

Fixes: debbugs:17621
2014-06-19 21:05:40 -04:00
Stefan Monnier
e9638b49e5 * lisp/progmodes/sh-script.el (sh-smie-sh-rules): Use same rule for && as
for |.

Fixes: debbugs:17621
2014-06-19 18:52:12 -04:00
Stefan Monnier
5d03fb436f * lisp/emacs-lisp/nadvice.el: Support adding a given function multiple times.
(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-05-10 16:07:01 -04:00
Stefan Monnier
c08684513a * lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): Slash after
&, |, +, - and * can't be a division.

Fixes: debbugs:17317
2014-04-22 21:56:18 -04:00
Stefan Monnier
b262bde327 * lisp/nxml/nxml-mode.el (nxml-fontify-matcher): Make sure propertization
was done.
* lisp/nxml/xmltok.el (xmltok-scan-after-comment-open): Extend unclosed
comment to EOB.

Fixes: debbugs:17264
2014-04-16 11:28:26 -04:00
Feng Li
39764caa7f * lisp/progmodes/pascal.el (pascal-font-lock-keywords): Fix incorrect format
entry; use symbol boundaries to avoid mis-matches.
2014-04-10 09:56:28 -04:00
Stefan Monnier
062e286b7c * lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): Handle $'
used as a variable.

Fixes: debbugs:17174
2014-04-02 20:41:09 -04:00
Dmitry Gutov
42ebc34ea8 Fix bug#17097
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function):
Don't propertize `?' or `!' as symbol constituent when after
colon.
2014-03-27 08:53:13 +02:00
Dmitry Gutov
1fc8f6559a Fix bug#17050
* lisp/progmodes/ruby-mode.el (ruby-smie-rules):
Add indentation rule for ` @ '.
2014-03-21 06:26:39 +02:00
Dmitry Gutov
1850913d96 * lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
regexp options.

Fixes: debbugs:16914
2014-03-02 00:04:59 +02:00
Paul Eggert
9a89cfa29d Spelling fix. 2014-02-25 10:40:54 -08:00
Dmitry Gutov
dfdb365c4c * lisp/progmodes/ruby-mode.el (ruby-smie-rules): Handle the
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 10:26:40 +02:00
Dmitry Gutov
62f9502226 * lisp/progmodes/ruby-mode.el (ruby-smie-rules): Don't indent specially
after `=>'.

Fixes: debbugs:16811
2014-02-23 07:53:53 +02:00
Dmitry Gutov
a09beb3df2 Fix bug#16609
* 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-02-01 16:54:58 +02:00
Dmitry Gutov
e2a67bd08e Implement user option ruby-align-chained-calls
* 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-31 19:13:49 +02:00
Dmitry Gutov
fb3d479c91 ruby-mode: Align def...end to the beginning of statement
* 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).
2014-01-17 05:15:02 +02:00
Paul Eggert
06827ec842 Spelling fixes.
* 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.
2014-01-09 23:10:37 -08:00
Paul Eggert
ba3189039a Update copyright year to 2014 by running admin/update-copyright. 2014-01-01 07:43:34 +00:00
Dmitry Gutov
f235149801 * lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p): Return t
after `{'.  We need it after block openers, and it doesn't seem
to hurt after hash openers.
2013-12-22 08:04:40 +02:00
Dmitry Gutov
65a1da00fe * lisp/progmodes/ruby-mode.el (ruby-align-to-stmt-keywords): Tweak the
docstring.
(ruby-smie-rules): Indent plus one level after `=>'.
2013-12-22 04:31:21 +02:00
Dmitry Gutov
b520f210b1 * lisp/progmodes/ruby-mode.el (ruby-align-to-stmt-keywords): New
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-20 07:20:33 +02:00
Dmitry Gutov
ce41edb426 * lisp/progmodes/ruby-mode.el (ruby-smie-rules): Indent middle-of-block
keywords to their parent.
2013-12-19 07:06:24 +02:00
Dmitry Gutov
7e1549c91d * lisp/progmodes/ruby-mode.el (ruby-smie--args-separator-p): Allow the
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-19 06:21:44 +02:00
Dmitry Gutov
35b249a653 * lisp/progmodes/ruby-mode.el (ruby-smie-rules): Indent ternary if. 2013-12-17 14:04:23 +02:00
Dmitry Gutov
5556c0cef1 Fix bug#16116
* 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-17 03:31:55 +02:00
Dmitry Gutov
276bc3337b Fix bug#16118
* 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-14 08:46:13 +02:00
Dmitry Gutov
8212d9c0da * lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p): Return t
after the end of a percent literal.
2013-12-09 06:19:16 +02:00
Dmitry Gutov
939fef2978 Mention test/indent/js.js, and restore one lost piece of it
* test/indent/js.js: New file.
2013-12-08 18:11:08 +02:00
Dmitry Gutov
47e59c666a Port indentation code from js2-mode to js-mode
* 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.
2013-12-08 18:08:45 +02:00
Dmitry Gutov
7b08f97e71 * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Disambiguate between
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-12 16:15:14 +02:00
Dmitry Gutov
1629a32997 * lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p):
Not after "||".
(ruby-smie-rules): Indent non-hanging "begin" blocks as part of
their parent.
2013-11-09 01:59:56 +02:00
Dmitry Gutov
d85783ca32 * indent/ruby.rb: New example 2013-11-08 05:30:24 +02:00
Dmitry Gutov
1f92392383 * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Improve precedences
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-08 04:31:51 +02:00
Dmitry Gutov
1d1c86daf7 * lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p):
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 05:02:01 +02:00
Dmitry Gutov
b420ccfc4c * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Lower priority of
"." compared to "do".
2013-11-07 03:58:12 +02:00
Dmitry Gutov
41784d0ba6 * test/indent/ruby.rb: Move a now-successful example. 2013-11-04 13:04:50 +02:00
Dmitry Gutov
dca01b0923 * lisp/progmodes/ruby-mode.el (ruby-smie--forward-token)
(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-04 12:50:47 +02:00
Dmitry Gutov
3d42b96899 * lisp/progmodes/ruby-mode.el (ruby-smie--rule-parent-skip-assign): New
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-11-02 09:18:11 +04:00
Stefan Monnier
dee4ba5979 * src/eval.c (run_hook_with_args): Use FUNCTIONP.
* test/indent/css-mode.css (.x2): Test alignement inside braces.
* test/indent/prolog.prolog: Test alignment of ->; with operator at bol.
2013-10-29 10:46:23 -04:00
Dmitry Gutov
c8c605ac9c * lisp/progmodes/ruby-mode.el (ruby-smie--bosp): Anything that goes
after `=' is probably a new expression.
2013-10-27 07:25:03 +04:00
Dmitry Gutov
778859a88c * test/indent/ruby.rb: New failing example. 2013-10-26 05:22:50 +04:00
Dmitry Gutov
bae91342a4 * lisp/progmodes/ruby-mode.el (ruby-smie--args-separator-p): Be more
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-26 05:16:37 +04:00
Dmitry Gutov
369bbf7198 * lisp/progmodes/ruby-mode.el (ruby-smie-rules): Fix the "curly block
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-24 04:47:28 +04:00
Stefan Monnier
03d44565bb * lisp/progmodes/ruby-mode.el (ruby-smie-rules): Only align with parent of
{ if it is hanging.
2013-10-23 13:55:53 -04:00