   (and (ruby-electric-is-last-command-char-expandable-punct-p)
        (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
+            (= (point) (match-end 0))) ;looking-back is missing on XEmacs
        (save-excursion 
-	 (insert "|"))))
+         (insert "|"))))
 
 
 (provide 'ruby-electric)

    (?\` . ?\`)
    (?\" . ?\")))

(defcustom ruby-electric-simple-keywords-re 
  "\\(def\\|if\\|class\\|module\\|unless\\|case\\|while\\|do\\|until\\|for\\|begin\\)"
  "*Regular expresion matching keywords for which closing 'end'
is to be inserted."
  :type 'regexp :group 'ruby-electric)

(defun ruby-electric-space-can-be-expanded-p()
  (if (ruby-electric-code-at-point-p)
      (let* ((ruby-electric-keywords-re 
              (concat ruby-electric-simple-keywords-re "\\s-$"))
             (ruby-electric-single-keyword-in-line-re 
              (concat "\\s-*" ruby-electric-keywords-re)))
        (save-excursion
          (backward-word 1)
          (or (looking-at ruby-electric-expandable-do-re)
              (and (looking-at ruby-electric-keywords-re)
                   (not (string= "do" (match-string 1)))
                   (progn
                     (beginning-of-line)
                     (looking-at ruby-electric-single-keyword-in-line-re))))))))


(defun ruby-electric-curlies(arg)
