* misc/ruby-mode.el (ruby-add-log-current-method): use ruby style

method name format.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-03-06 02:14:17 +00:00
Родитель 6b10829b22
Коммит 53577db05b
2 изменённых файлов: 38 добавлений и 8 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Thu Mar 6 11:14:14 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* misc/ruby-mode.el (ruby-add-log-current-method): use ruby style
method name format.
Thu Mar 6 11:12:29 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> Thu Mar 6 11:12:29 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sprintf.c (rb_str_format): no need of loop. * sprintf.c (rb_str_format): no need of loop.

Просмотреть файл

@ -1001,17 +1001,19 @@ balanced expression is found."
"Return current method string." "Return current method string."
(condition-case nil (condition-case nil
(save-excursion (save-excursion
(let ((mlist nil) (indent 0)) (let (mname mlist (indent 0))
;; get current method (or class/module) ;; get current method (or class/module)
(if (re-search-backward (if (re-search-backward
(concat "^[ \t]*\\(def\\|class\\|module\\)[ \t]+" (concat "^[ \t]*\\(def\\|class\\|module\\)[ \t]+"
"\\(" "\\("
;; \\. for class method ;; \\. and :: for class method
"\\(" ruby-symbol-re "\\|\\." "\\)" "\\([A-Za-z_]" ruby-symbol-re "*\\|\\.\\|::" "\\)"
"+\\)") "+\\)")
nil t) nil t)
(progn (progn
(setq mlist (list (match-string 2))) (setq mname (match-string 2))
(unless (string-equal "def" (match-string 1))
(setq mlist (list mname) mname nil))
(goto-char (match-beginning 1)) (goto-char (match-beginning 1))
(setq indent (current-column)) (setq indent (current-column))
(beginning-of-line))) (beginning-of-line)))
@ -1020,7 +1022,7 @@ balanced expression is found."
(re-search-backward (re-search-backward
(concat (concat
"^[ \t]*\\(class\\|module\\)[ \t]+" "^[ \t]*\\(class\\|module\\)[ \t]+"
"\\([A-Z]" ruby-symbol-re "+\\)") "\\([A-Z]" ruby-symbol-re "*\\)")
nil t)) nil t))
(goto-char (match-beginning 1)) (goto-char (match-beginning 1))
(if (< (current-column) indent) (if (< (current-column) indent)
@ -1028,10 +1030,33 @@ balanced expression is found."
(setq mlist (cons (match-string 2) mlist)) (setq mlist (cons (match-string 2) mlist))
(setq indent (current-column)) (setq indent (current-column))
(beginning-of-line)))) (beginning-of-line))))
(when mname
(let ((mn (split-string mname "\\.\\|::")))
(if (cdr mn)
(progn
(cond
((string-equal "" (car mn))
(setq mn (cdr mn) mlist nil))
((string-equal "self" (car mn))
(setq mn (cdr mn)))
((let ((ml (nreverse mlist)))
(while ml
(if (string-equal (car ml) (car mn))
(setq mlist (nreverse (cdr ml)) ml nil))
(or (setq ml (cdr ml)) (nreverse mlist))))))
(if mlist
(setcdr (last mlist) mn)
(setq mlist mn))
(setq mn (last mn 2))
(setq mname (concat "." (cadr mn)))
(setcdr mn nil))
(setq mname (concat "#" mname)))))
;; generate string ;; generate string
(if (consp mlist) (if (consp mlist)
(mapconcat (function identity) mlist "::") (setq mlist (mapconcat (function identity) mlist "::")))
nil))))) (if mname
(if mlist (concat mlist mname) mname)
mlist)))))
(cond (cond
((featurep 'font-lock) ((featurep 'font-lock)