mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Strip trailing whitespaces at the end of converted do block
* lisp/progmodes/ruby-mode.el (ruby-brace-to-do-end): Strip trailing whitespaces at the end of converted do block (bug#36756). https://bugs.ruby-lang.org/issues/16014 https://github.com/syl20bnr/spacemacs/issues/12548
This commit is contained in:
parent
a112547f91
commit
0cbdbac2bb
2 changed files with 7 additions and 2 deletions
|
|
@ -1690,7 +1690,8 @@ See `add-log-current-defun-function'."
|
|||
(when (eq (char-before) ?\})
|
||||
(delete-char -1)
|
||||
(when (save-excursion
|
||||
(skip-chars-backward " \t")
|
||||
(let ((n (skip-chars-backward " \t")))
|
||||
(if (< n 0) (delete-char (- n))))
|
||||
(not (bolp)))
|
||||
(insert "\n"))
|
||||
(insert "end")
|
||||
|
|
|
|||
|
|
@ -369,7 +369,11 @@ VALUES-PLIST is a list with alternating index and value elements."
|
|||
(ruby-with-temp-buffer "foo {|b|\n}"
|
||||
(beginning-of-line)
|
||||
(ruby-toggle-block)
|
||||
(should (string= "foo do |b|\nend" (buffer-string)))))
|
||||
(should (string= "foo do |b|\nend" (buffer-string))))
|
||||
(ruby-with-temp-buffer "foo {|b| b }"
|
||||
(beginning-of-line)
|
||||
(ruby-toggle-block)
|
||||
(should (string= "foo do |b|\n b\nend" (buffer-string)))))
|
||||
|
||||
(ert-deftest ruby-toggle-block-to-brace ()
|
||||
(let ((pairs '((17 . "foo { |b| b + 2 }")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue