File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 260260 ((looking-at elixir-smie--operator-regexp)
261261 (goto-char (match-end 0 ))
262262 " OP" )
263- (t (smie-default-forward-token ))))
263+ (t
264+ (let ((token (smie-default-forward-token )))
265+ (unless (elixir-smie-empty-string-p token)
266+ token)))))
264267
265268(defun elixir-smie-backward-token ()
266269 (let ((pos (point )))
@@ -635,6 +638,12 @@ Rules:
635638 (goto-char indent)
636639 (goto-char (elixir-smie--previous-line-indentation)))))))
637640
641+ (defun elixir-smie-empty-string-p (string )
642+ " Return non-nil if STRING is null, blank or whitespace only."
643+ (or (null string)
644+ (string= string " " )
645+ (if (string-match-p " ^\s +$" string) t )))
646+
638647(add-to-list 'smie-indent-functions 'elixir-smie--indent-inside-heredoc )
639648
640649(provide 'elixir-smie )
Original file line number Diff line number Diff line change @@ -173,6 +173,18 @@ end")
173173 (goto-line 4 )
174174 (elixir-smie-current-line-contains-built-in-keyword-p)))))
175175
176+ (ert-deftest test-if-string-is-empty ()
177+ (should (equal (elixir-smie-empty-string-p nil )
178+ t ))
179+ (should (equal (elixir-smie-empty-string-p " " )
180+ t ))
181+ (should (equal (elixir-smie-empty-string-p " " )
182+ t ))
183+ (should (equal (elixir-smie-empty-string-p " story" )
184+ nil ))
185+ (should (equal (elixir-smie-empty-string-p " " )
186+ t )))
187+
176188(provide 'elixir-mode-helper-test )
177189
178190; ;; elixir-mode-helper-test.el ends here
You can’t perform that action at this time.
0 commit comments