This support has been obsolete since Emacs 25.1. The final version of
the Galeon web browser was released in September, 2008.
+** Ruby Mode
+
+*** New user option 'ruby-toggle-block-space-before-parameters'.
+
** Miscellaneous
---
"Use `ruby-encoding-map' to set encoding magic comment if this is non-nil."
:type 'boolean :group 'ruby)
+(defcustom ruby-toggle-block-space-before-parameters t
+ "When non-nil, ensure space between the \"toggled\" curly and parameters.
+This only affects the output of the command `ruby-toggle-block'."
+ :type 'boolean
+ :safe 'booleanp
+ :version "29.1")
+
;;; SMIE support
(require 'smie)
(insert "}")
(goto-char orig)
(delete-char 2)
- ;; Maybe this should be customizable, let's see if anyone asks.
- (insert "{ ")
- (setq beg-marker (point-marker))
- (when (looking-at "\\s +|")
- (delete-char (- (match-end 0) (match-beginning 0) 1))
- (forward-char)
- (re-search-forward "|" (line-end-position) t))
+ (insert "{")
+ (if (looking-at "\\s +|")
+ (progn
+ (just-one-space (if ruby-toggle-block-space-before-parameters 1 0))
+ (setq beg-marker (point-marker))
+ (forward-char)
+ (re-search-forward "|" (line-end-position) t))
+ (setq beg-marker (point-marker)))
(save-excursion
(skip-chars-forward " \t\n\r")
(setq beg-pos (point))
(ruby-toggle-block)
(should (string= "foo { \"#{bar}\" }" (buffer-string)))))
+(ert-deftest ruby-toggle-block-to-brace-no-space ()
+ (ruby-with-temp-buffer "foo do |b|\n b + 2\nend"
+ (beginning-of-line)
+ (let (ruby-toggle-block-space-before-parameters)
+ (ruby-toggle-block))
+ (should (string= "foo {|b| b + 2 }" (buffer-string)))))
+
(ert-deftest ruby-recognize-symbols-starting-with-at-character ()
(ruby-assert-face ":@abc" 3 font-lock-constant-face))