Commit graph

203 commits

Author SHA1 Message Date
Dmitry Gutov
8142fc97af ruby-mode: Fix a "required arguments" confusion
* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Move `at_exit'
and `callcc' to the "methods with required arguments" section,
they need a block argument.  Remove a `throw' duplicate.
2015-03-20 07:03:54 +02:00
Bozhidar Batsov
5b77d81840 Separate Kernel methods with required args from those without 2015-03-17 23:40:20 +02:00
Bozhidar Batsov
771978259e Font-lock more Kernel methods as built-in 2015-03-17 22:41:36 +02:00
Dmitry Gutov
8854b9cf52 ruby-mode: Detect regexps after `!'
Fixes: debbugs:19285

* lisp/progmodes/ruby-mode.el (ruby-syntax-before-regexp-re): Detect
regexps after `!'.
2015-03-09 05:53:58 +02:00
Dmitry Gutov
4fab7badf5 ruby-mode: Don't consider =' a part of symbol when followed by >'
Fixes: debbugs:18644

* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Don't consider
`=' a part of symbol when followed by `>'.
2015-03-09 05:26:57 +02:00
Dmitry Gutov
e991af9228 ruby-mode: Change faces used for self, true, false and nil
Fixes: debbugs:17733

* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Use
`font-lock-constant-face' for nil, true and false.  Highlight
`self' as a keyword.
2015-03-08 22:10:45 +02:00
Nobuyoshi Nakada
dad0fc589c ruby-mode: Expect regexp after { or | too
Fixes: debbugs:20026

* progmodes/ruby-mode.el (ruby-syntax-before-regexp-re): Expect
beginning of regexp also after open brace or vertical bar.
2015-03-08 20:57:29 +02:00
Paul Eggert
7e09ef09a4 Update copyright year to 2015
Run admin/update-copyright.
2015-01-01 14:26:41 -08:00
Bozhidar Batsov
fafba80d73 Simplify ruby--string-region
* progmodes/ruby-mode.el (ruby--string-region): Simplify code
by leveraging `syntax-ppss'.
2014-12-22 17:03:32 +02:00
Bozhidar Batsov
e8acfc7fb4 Add a command for string quotes toggling to ruby-mode
* progmodes/ruby-mode.el (ruby-toggle-string-quotes): New command that
allows you to quickly toggle between single-quoted and double-quoted
string literals.
2014-12-09 19:45:03 +02:00
Bozhidar Batsov
fda355b5bd Associate more files with ruby-mode
* progmodes/ruby-mode.el (auto-mode-alist): Add .rabl, Berksfile
and Puppetfile.
2014-12-09 19:05:13 +02:00
Stefan Monnier
d66146bf18 * lisp/progmodes/ruby-mode.el (ruby-mode-variables): Don't meddle with
require-final-newline since prog-mode already took care of it.

Fixes: debbugs:17947
2014-07-05 14:37:45 -04:00
Dmitry Gutov
6a7faa1664 Fix bug#17732
* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Don't fontify
`!' in `!~' with `font-lock-negation-char-face'.
2014-06-16 06:33:29 +03:00
Dmitry Gutov
4dd3c4d53a * lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function):
Backtrack one char if the global/char-literal var matcher hits
inside a string.  The next char could be the beginning of an
expression expansion.

* test/automated/ruby-mode-tests.el
(ruby-interpolation-after-dollar-sign): New test.
2014-05-06 03:18:18 +04:00
Dmitry Gutov
0122b24d90 Highlight more Module methods
* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight more
Module methods.

Fixes: debbugs:17216
2014-04-09 04:14:37 +04:00
Dmitry Gutov
8de64bb862 * lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
special globals with font-lock-builtin-face.

Fixes: debbugs:17057
2014-03-27 10:21:15 +02: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
c2d6c639cf Match special globals in Ruby better
* lisp/progmodes/ruby-mode.el (ruby-expression-expansion-re):
Match special global variables without curlies, too.
(ruby-font-lock-keywords): Simplify the matcher for special global
variables.  Don't require a non-word character after the variable.

Fixes: debbugs:17057
2014-03-24 10:53:56 +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
1f44df94fa * lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Fontify
multiple adjacent negation chars.

Fixes: debbugs:17004
2014-03-13 15:37:27 +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
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
cb8f50a75c * lisp/progmodes/ruby-mode.el (auto-mode-alist): Add missing "or". 2014-02-21 17:39:17 +02:00
Dmitry Gutov
6da8227cfa * lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): `private',
`protected' and `public' can also be called without arguments.
2014-02-03 17:59:39 +02:00
Dmitry Gutov
68e004e0cd Fix bug#16610
* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): For built-ins
that require arguments, check that they're followed by something that
looks like argument.
2014-02-01 19:06:08 +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
2f313daf4a Fixup the documentation for the previous change
* etc/NEWS: Mention `ruby-align-chained-calls'.

* lisp/progmodes/ruby-mode.el (ruby-align-chained-calls): Update the
  docstring and add :version tag.

Fixes: debbugs:16593
2014-01-31 19:33:12 +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
Bozhidar Batsov
dd80671031 * lisp/progmodes/ruby-mode.el (auto-mode-alist): Add .podspec and Podfile. 2014-01-10 18:32:45 +02:00
Paul Eggert
ba3189039a Update copyright year to 2014 by running admin/update-copyright. 2014-01-01 07:43:34 +00:00
Glenn Morris
9c5a5c7700 Every defcustom should specify its type
* apropos.el (apropos-match-face):
* calculator.el (calculator-displayer):
* dabbrev.el (dabbrev-search-these-buffers-only):
* face-remap.el (buffer-face-mode-face):
* simple.el (yank-handled-properties):
* emacs-lisp/testcover.el (testcover-potentially-1value-functions):
* mail/footnote.el (footnote-mode-line-string, footnote-prefix):
* mail/hashcash.el (hashcash-accept-resources, hashcash-program)
(hashcash-double-spend-database):
* progmodes/ruby-mode.el (ruby-deep-indent-paren)
(ruby-deep-indent-paren-style):
* textmodes/flyspell.el (flyspell-auto-correct-binding):
* textmodes/rst.el (rst-toc-indent, rst-toc-insert-style)
(rst-toc-insert-number-separator, rst-toc-insert-max-level):
* vc/pcvs-defs.el (cvs-minor-mode-prefix):
* erc/erc-log.el (erc-log-file-coding-system):
* gnus/gnus-sieve.el (gnus-sieve-select-method):
* gnus/gravatar.el (gravatar-automatic-caching, gravatar-cache-ttl)
(gravatar-rating, gravatar-size):
* gnus/message.el (message-minibuffer-local-map):
* gnus/sieve-manage.el (sieve-manage-authenticators)
(sieve-manage-authenticator-alist):
Specify custom types.

* mail/hashcash.el (hashcash-program): Rename from hashcash-path.
Update callers.
2013-12-28 00:21:33 -08:00
Dmitry Gutov
1f87a56cc7 * lisp/progmodes/ruby-mode.el (ruby--electric-indent-p): Improve the
comments.  Handle electric indent after typing `?' and `!'.
2013-12-22 22:38:26 +02: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
6cddebc11b Integrate ruby-mode with electric-indent-mode better
* lisp/progmodes/ruby-mode.el (ruby--at-indentation-p): New function,
extracted from `ruby-smie-rules'.
(ruby--electric-indent-chars): New variable.
(ruby--electric-indent-p): New function.
(ruby-mode): Use `electric-indent-functions' instead of
`electric-indent-chars'.
2013-12-22 06:57:00 +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
660efa1a14 Fix comment from the last change to `ruby-smie-rules' 2013-12-14 15:57:58 +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
Cameron Desautels
8f48d13181 * lisp/progmodes/ruby-mode.el (ruby-forward-string): Document.
Handle caret-delimited strings.

Fixes: debbugs:16079
2013-12-09 05:43:34 +02:00
Dmitry Gutov
ff8c976420 * lisp/progmodes/ruby-mode.el (ruby-accurate-end-of-block): When
`ruby-use-smie' is t, use `smie-forward-sexp' instead of
`ruby-parse-partial'.

Fixes: debbugs:16078
2013-12-09 05:27:21 +02:00
Dmitry Gutov
fa834a93da * lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Touch
up the last change.
2013-12-06 16:24:10 +02:00
Dmitry Gutov
af67e79a52 Fix Bug#15874
* lisp/progmodes/ruby-mode.el (ruby-mode-syntax-table): Don't modify
syntax for `?'.
(ruby-expr-beg): Expect that `!' will have syntax class "symbol"
where appropriate already.
(ruby-syntax-propertize-function): Propertize `?' and `!' at the
end of method names.
2013-12-06 06:22:08 +02:00
Bozhidar Batsov
15ba218206 * progmodes/ruby-mode.el (ruby-custom-encoding-magic-comment-template),
(ruby-encoding-magic-comment-style): Add :version.
2013-11-22 14:36:38 +02:00
Bozhidar Batsov
d19ffd647d * lisp/progmodes/ruby-mode.el (ruby-custom-encoding-magic-comment-template):
Improve docstring.
2013-11-22 14:28:23 +02:00