diff options
Diffstat (limited to 'lisp/progmodes/ruby-mode.el')
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 72631a6557f..eb54ffe05a8 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -325,6 +325,13 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." | |||
| 325 | "Use `ruby-encoding-map' to set encoding magic comment if this is non-nil." | 325 | "Use `ruby-encoding-map' to set encoding magic comment if this is non-nil." |
| 326 | :type 'boolean :group 'ruby) | 326 | :type 'boolean :group 'ruby) |
| 327 | 327 | ||
| 328 | (defcustom ruby-toggle-block-space-before-parameters t | ||
| 329 | "When non-nil, ensure space between the \"toggled\" curly and parameters. | ||
| 330 | This only affects the output of the command `ruby-toggle-block'." | ||
| 331 | :type 'boolean | ||
| 332 | :safe 'booleanp | ||
| 333 | :version "29.1") | ||
| 334 | |||
| 328 | ;;; SMIE support | 335 | ;;; SMIE support |
| 329 | 336 | ||
| 330 | (require 'smie) | 337 | (require 'smie) |
| @@ -1722,13 +1729,14 @@ See `add-log-current-defun-function'." | |||
| 1722 | (insert "}") | 1729 | (insert "}") |
| 1723 | (goto-char orig) | 1730 | (goto-char orig) |
| 1724 | (delete-char 2) | 1731 | (delete-char 2) |
| 1725 | ;; Maybe this should be customizable, let's see if anyone asks. | 1732 | (insert "{") |
| 1726 | (insert "{ ") | 1733 | (if (looking-at "\\s +|") |
| 1727 | (setq beg-marker (point-marker)) | 1734 | (progn |
| 1728 | (when (looking-at "\\s +|") | 1735 | (just-one-space (if ruby-toggle-block-space-before-parameters 1 0)) |
| 1729 | (delete-char (- (match-end 0) (match-beginning 0) 1)) | 1736 | (setq beg-marker (point-marker)) |
| 1730 | (forward-char) | 1737 | (forward-char) |
| 1731 | (re-search-forward "|" (line-end-position) t)) | 1738 | (re-search-forward "|" (line-end-position) t)) |
| 1739 | (setq beg-marker (point-marker))) | ||
| 1732 | (save-excursion | 1740 | (save-excursion |
| 1733 | (skip-chars-forward " \t\n\r") | 1741 | (skip-chars-forward " \t\n\r") |
| 1734 | (setq beg-pos (point)) | 1742 | (setq beg-pos (point)) |