From 9652eae6e7f618bddb898d0c630a1983b1b77ac9 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 8 Mar 2011 14:12:48 +0000 Subject: * misc/ruby-electric.el: remove trailing spaces. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- misc/ruby-electric.el | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'misc/ruby-electric.el') diff --git a/misc/ruby-electric.el b/misc/ruby-electric.el index 174bd00fd9..6c1ad9a88a 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 "|")))) -- cgit v1.2.3