summaryrefslogtreecommitdiff
path: root/misc/ruby-electric.el
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-06 22:36:10 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-06 22:36:10 +0000
commit4cbbf3bdfc27dc69ebd45ce3baa803611f4326a2 (patch)
treec5246276cc1a9aede622dc15e0f3de33bd60260a /misc/ruby-electric.el
parentd250d79e5bf7e5d4e1239a4f135d1325ffe8cf56 (diff)
* misc/*.el: untabify, for interal consistency and consistency
with standard Emacs elisp files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'misc/ruby-electric.el')
-rw-r--r--misc/ruby-electric.el78
1 files changed, 39 insertions, 39 deletions
diff --git a/misc/ruby-electric.el b/misc/ruby-electric.el
index e305d55..174bd00 100644
--- a/misc/ruby-electric.el
+++ b/misc/ruby-electric.el
@@ -77,14 +77,14 @@ is to be inserted."
"*List of contexts where matching delimiter should be
inserted. The word 'all' will do all insertions."
:type '(set :extra-offset 8
- (const :tag "Everything" all )
- (const :tag "Curly brace" ?\{ )
- (const :tag "Square brace" ?\[ )
- (const :tag "Round brace" ?\( )
- (const :tag "Quote" ?\' )
- (const :tag "Double quote" ?\" )
- (const :tag "Back quote" ?\` )
- (const :tag "Vertical bar" ?\| ))
+ (const :tag "Everything" all )
+ (const :tag "Curly brace" ?\{ )
+ (const :tag "Square brace" ?\[ )
+ (const :tag "Round brace" ?\( )
+ (const :tag "Quote" ?\' )
+ (const :tag "Double quote" ?\" )
+ (const :tag "Back quote" ?\` )
+ (const :tag "Vertical bar" ?\| ))
:group 'ruby-electric)
(defcustom ruby-electric-newline-before-closing-bracket nil
@@ -126,15 +126,15 @@ strings. Note that you must have Font Lock enabled."
(self-insert-command (prefix-numeric-value arg))
(if (ruby-electric-space-can-be-expanded-p)
(save-excursion
- (ruby-indent-line t)
- (newline)
- (ruby-insert-end))))
+ (ruby-indent-line t)
+ (newline)
+ (ruby-insert-end))))
(defun ruby-electric-code-at-point-p()
(and ruby-electric-mode
(let* ((properties (text-properties-at (point))))
- (and (null (memq 'font-lock-string-face properties))
- (null (memq 'font-lock-comment-face properties))))))
+ (and (null (memq 'font-lock-string-face properties))
+ (null (memq 'font-lock-comment-face properties))))))
(defun ruby-electric-string-at-point-p()
(and ruby-electric-mode
@@ -147,17 +147,17 @@ strings. Note that you must have Font Lock enabled."
(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))))))))
+ (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)
@@ -165,17 +165,17 @@ strings. Note that you must have Font Lock enabled."
(self-insert-command (prefix-numeric-value arg))
(if (ruby-electric-is-last-command-char-expandable-punct-p)
(cond ((ruby-electric-code-at-point-p)
- (insert " ")
- (save-excursion
- (if ruby-electric-newline-before-closing-bracket
- (newline))
- (insert "}")))
- ((ruby-electric-string-at-point-p)
- (save-excursion
- (backward-char 1)
- (when (char-equal ?\# (preceding-char))
- (forward-char 1)
- (insert "}")))))))
+ (insert " ")
+ (save-excursion
+ (if ruby-electric-newline-before-closing-bracket
+ (newline))
+ (insert "}")))
+ ((ruby-electric-string-at-point-p)
+ (save-excursion
+ (backward-char 1)
+ (when (char-equal ?\# (preceding-char))
+ (forward-char 1)
+ (insert "}")))))))
(defun ruby-electric-matching-char(arg)
(interactive "P")
@@ -183,8 +183,8 @@ 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
- ruby-electric-matching-delimeter-alist))))))
+ (insert (cdr (assoc last-command-char
+ ruby-electric-matching-delimeter-alist))))))
(defun ruby-electric-bar(arg)
(interactive "P")
@@ -192,9 +192,9 @@ 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)
(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)