mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
d250d79e5b
commit
4cbbf3bdfc
5 changed files with 860 additions and 857 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue