[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r116049: ruby-mode: Align def...end to the beginning
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] trunk r116049: ruby-mode: Align def...end to the beginning of statement |
Date: |
Fri, 17 Jan 2014 03:15:12 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 116049
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Fri 2014-01-17 05:15:02 +0200
message:
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).
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/progmodes/ruby-mode.el
rubymode.el-20091113204419-o5vbwnq5f7feedwu-8804
test/indent/ruby.rb ruby.rb-20120424165921-h044139hbrd7snvw-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-01-17 02:59:24 +0000
+++ b/lisp/ChangeLog 2014-01-17 03:15:02 +0000
@@ -1,3 +1,13 @@
+2014-01-17 Dmitry Gutov <address@hidden>
+
+ * 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 Glenn Morris <address@hidden>
* emacs-lisp/authors.el (authors-aliases): Remove unnecessary entries.
=== modified file 'lisp/progmodes/ruby-mode.el'
--- a/lisp/progmodes/ruby-mode.el 2014-01-10 16:32:45 +0000
+++ b/lisp/progmodes/ruby-mode.el 2014-01-17 03:15:02 +0000
@@ -226,7 +226,10 @@
:group 'ruby
:safe 'integerp)
-(defcustom ruby-align-to-stmt-keywords nil
+(defconst ruby-alignable-keywords '(if while unless until begin case for def)
+ "Keywords that can be used in `ruby-align-to-stmt-keywords'.")
+
+(defcustom ruby-align-to-stmt-keywords '(def)
"Keywords after which we align the expression body to statement.
When nil, an expression that begins with one these keywords is
@@ -250,17 +253,13 @@
Only has effect when `ruby-use-smie' is t.
"
- :type '(choice
+ :type `(choice
(const :tag "None" nil)
(const :tag "All" t)
(repeat :tag "User defined"
- (choice (const if)
- (const while)
- (const unless)
- (const until)
- (const begin)
- (const case)
- (const for))))
+ (choice ,@(mapcar
+ (lambda (kw) (list 'const kw))
+ ruby-alignable-keywords))))
:group 'ruby
:safe 'listp
:version "24.4")
@@ -639,7 +638,7 @@
(smie-indent--hanging-p)
ruby-indent-level))
(`(:after . ,(or "?" ":")) ruby-indent-level)
- (`(:before . ,(or "if" "while" "unless" "until" "begin" "case" "for"))
+ (`(:before . ,(guard (memq (intern-soft token) ruby-alignable-keywords)))
(when (not (ruby--at-indentation-p))
(if (ruby-smie--indent-to-stmt-p token)
(ruby-smie--indent-to-stmt)
=== modified file 'test/indent/ruby.rb'
--- a/test/indent/ruby.rb 2013-12-22 06:04:40 +0000
+++ b/test/indent/ruby.rb 2014-01-17 03:15:02 +0000
@@ -331,6 +331,10 @@
end
end
+private def foo
+ bar
+end
+
%^abc^
ddd
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r116049: ruby-mode: Align def...end to the beginning of statement,
Dmitry Gutov <=