File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 80
80
" >=" " <" " >" " &&" " ||" " <>" " ++" " --" " //"
81
81
" />" " =~" " |>" " ->" )))
82
82
83
+ (defvar elixir-smie--spaces-til-eol-regexp
84
+ (rx (and (1+ space) eol))
85
+ " Regex representing one or more whitespace characters concluding with eol." )
86
+
83
87
(defvar elixir-smie-indent-basic 2 )
84
88
85
89
(defmacro elixir-smie-debug (message &rest format-args )
94
98
95
99
(defun elixir-smie-forward-token ()
96
100
(cond
101
+ ; ; If there is nothing but whitespace between the last token and eol, emit
102
+ ; ; a semicolon.
103
+ ((looking-at elixir-smie--spaces-til-eol-regexp)
104
+ (goto-char (match-end 0 ))
105
+ " ;" )
97
106
((and (looking-at " [\n #]" ) (elixir-smie--implicit-semi-p))
98
107
(if (eolp ) (forward-char 1 ) (forward-comment 1 ))
99
108
" ;" )
Original file line number Diff line number Diff line change @@ -514,3 +514,33 @@ end"
514
514
def foo do #comment
515
515
:bar
516
516
end" )
517
+
518
+ (elixir-def-indentation-test indent-after-require-Record
519
+ ()
520
+ ; ; Mind the significant whitespace after `Record' in each case. There should
521
+ ; ; be two spaces after `Record' , otherwise this test is meaningless.
522
+ "
523
+ defmodule RSS do
524
+ require Record
525
+
526
+ def zip(list1, list2) when length(list1) == length(list2) do
527
+ x = 1
528
+ end
529
+ end"
530
+ "
531
+ defmodule RSS do
532
+ require Record
533
+
534
+ def zip(list1, list2) when length(list1) == length(list2) do
535
+ x = 1
536
+ end
537
+ end" )
538
+
539
+ ; ; We don't want automatic whitespace cleanup here because of the significant
540
+ ; ; whitespace after `Record' above. By setting `whitespace-action' to nil,
541
+ ; ; `whitespace-mode' won't automatically clean up trailing whitespace (in my
542
+ ; ; config, anyway).
543
+
544
+ ; ;; Local Variables:
545
+ ; ;; whitespace-action: nil
546
+ ; ;; End:
You can’t perform that action at this time.
0 commit comments