aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/ruby-mode.el
diff options
context:
space:
mode:
authorAaron Jensen2024-08-31 19:31:20 -0400
committerDmitry Gutov2024-09-02 21:55:16 +0300
commit6c15b7710d4bfc201afbafd2daec74c2baec9102 (patch)
treea448892b0db91c01bf9e7c058cea4761de1b55cc /lisp/progmodes/ruby-mode.el
parent7799ef43354d756d7144cab3437f38496199522c (diff)
downloademacs-6c15b7710d4bfc201afbafd2daec74c2baec9102.tar.gz
emacs-6c15b7710d4bfc201afbafd2daec74c2baec9102.zip
Add new option ruby-bracketed-args-indent
* lisp/progmodes/ruby-mode.el (ruby-bracketed-args-indent): New option. (ruby-smie-rules): Use it (bug#60321). * test/lisp/progmodes/ruby-mode-resources/ruby-bracketed-args-indent.rb: New file. * test/lisp/progmodes/ruby-mode-tests.el: Use it for new case.
Diffstat (limited to 'lisp/progmodes/ruby-mode.el')
-rw-r--r--lisp/progmodes/ruby-mode.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 3bcfa9ee7df..d953ec8b25c 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -472,6 +472,26 @@ Only has effect when `ruby-use-smie' is t."
472 :safe 'booleanp 472 :safe 'booleanp
473 :version "29.1") 473 :version "29.1")
474 474
475(defcustom ruby-bracketed-args-indent t
476 "Non-nil to align the contents of bracketed arguments with the brackets.
477
478Example:
479
480 qux({
481 foo => bar
482 })
483
484Set it to nil to align to the beginning of the statement:
485
486 qux({
487 foo => bar
488 })
489
490Only has effect when `ruby-use-smie' is t."
491 :type 'boolean
492 :safe 'booleanp
493 :version "30.1")
494
475(defcustom ruby-deep-arglist t 495(defcustom ruby-deep-arglist t
476 "Deep indent lists in parenthesis when non-nil. 496 "Deep indent lists in parenthesis when non-nil.
477Also ignores spaces after parenthesis when `space'. 497Also ignores spaces after parenthesis when `space'.
@@ -826,6 +846,9 @@ This only affects the output of the command `ruby-toggle-block'."
826 )) 846 ))
827 (`(:before . ,(or "(" "[" "{")) 847 (`(:before . ,(or "(" "[" "{"))
828 (cond 848 (cond
849 ((and (not (eq ruby-bracketed-args-indent t))
850 (smie-rule-prev-p "," "(" "["))
851 (cons 'column (current-indentation)))
829 ((and (equal token "{") 852 ((and (equal token "{")
830 (not (smie-rule-prev-p "(" "{" "[" "," "=>" "=" "return" ";" "do")) 853 (not (smie-rule-prev-p "(" "{" "[" "," "=>" "=" "return" ";" "do"))
831 (save-excursion 854 (save-excursion