summaryrefslogtreecommitdiff
path: root/misc/ruby-electric.el
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-08 14:12:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-08 14:12:48 +0000
commit9652eae6e7f618bddb898d0c630a1983b1b77ac9 (patch)
tree5f05bfa4cb4469ab10546c48bb2fe4ec9241a3a3 /misc/ruby-electric.el
parent6b0dc7fd81b25bc66681548b8b82f38258f7e08c (diff)
* misc/ruby-electric.el: remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'misc/ruby-electric.el')
-rw-r--r--misc/ruby-electric.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/misc/ruby-electric.el b/misc/ruby-electric.el
index 174bd00..6c1ad9a 100644
--- a/misc/ruby-electric.el
+++ b/misc/ruby-electric.el
@@ -85,7 +85,7 @@ inserted. The word 'all' will do all insertions."
(const :tag "Double quote" ?\" )
(const :tag "Back quote" ?\` )
(const :tag "Vertical bar" ?\| ))
- :group 'ruby-electric)
+ :group 'ruby-electric)
(defcustom ruby-electric-newline-before-closing-bracket nil
"*Controls whether a newline should be inserted before the
@@ -142,13 +142,13 @@ strings. Note that you must have Font Lock enabled."
(defun ruby-electric-is-last-command-char-expandable-punct-p()
(or (memq 'all ruby-electric-expand-delimiters-list)
- (memq last-command-char ruby-electric-expand-delimiters-list)))
+ (memq last-command-char ruby-electric-expand-delimiters-list)))
(defun ruby-electric-space-can-be-expanded-p()
(if (ruby-electric-code-at-point-p)
- (let* ((ruby-electric-keywords-re
+ (let* ((ruby-electric-keywords-re
(concat ruby-electric-simple-keywords-re "\\s-$"))
- (ruby-electric-single-keyword-in-line-re
+ (ruby-electric-single-keyword-in-line-re
(concat "\\s-*" ruby-electric-keywords-re)))
(save-excursion
(backward-word 1)
@@ -171,6 +171,11 @@ strings. Note that you must have Font Lock enabled."
(newline))
(insert "}")))
((ruby-electric-string-at-point-p)
+ (if (eq last-command-event ?{)
+ (save-excursion
+ (when (not (char-equal ?\# (preceding-char)))
+ (delete-backward-char)
+ (insert "#"))))
(save-excursion
(backward-char 1)
(when (char-equal ?\# (preceding-char))
@@ -183,7 +188,7 @@ strings. Note that you must have Font Lock enabled."
(and (ruby-electric-is-last-command-char-expandable-punct-p)
(ruby-electric-code-at-point-p)
(save-excursion
- (insert (cdr (assoc last-command-char
+ (insert (cdr (assoc last-command-char
ruby-electric-matching-delimeter-alist))))))
(defun ruby-electric-bar(arg)
@@ -193,7 +198,7 @@ strings. Note that you must have Font Lock enabled."
(ruby-electric-code-at-point-p)
(and (save-excursion (re-search-backward ruby-electric-expandable-bar nil t))
(= (point) (match-end 0))) ;looking-back is missing on XEmacs
- (save-excursion
+ (save-excursion
(insert "|"))))