ruby-changes:4214
From: ko1@a...
Date: Thu, 6 Mar 2008 11:14:34 +0900 (JST)
Subject: [ruby-changes:4214] nobu - Ruby:r15704 (trunk): * misc/ruby-mode.el (ruby-add-log-current-method): use ruby style
nobu 2008-03-06 11:14:17 +0900 (Thu, 06 Mar 2008) New Revision: 15704 Modified files: trunk/ChangeLog trunk/misc/ruby-mode.el Log: * misc/ruby-mode.el (ruby-add-log-current-method): use ruby style method name format. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/misc/ruby-mode.el?r1=15704&r2=15703&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15704&r2=15703&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 15703) +++ ChangeLog (revision 15704) @@ -1,3 +1,8 @@ +Thu Mar 6 11:14:14 2008 Nobuyoshi Nakada <nobu@r...> + + * 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@r...> * sprintf.c (rb_str_format): no need of loop. Index: misc/ruby-mode.el =================================================================== --- misc/ruby-mode.el (revision 15703) +++ misc/ruby-mode.el (revision 15704) @@ -1001,17 +1001,19 @@ "Return current method string." (condition-case nil (save-excursion - (let ((mlist nil) (indent 0)) + (let (mname mlist (indent 0)) ;; get current method (or class/module) (if (re-search-backward (concat "^[ \t]*\\(def\\|class\\|module\\)[ \t]+" - "\\(" - ;; \\. for class method - "\\(" ruby-symbol-re "\\|\\." "\\)" + "\\(" + ;; \\. and :: for class method + "\\([A-Za-z_]" ruby-symbol-re "*\\|\\.\\|::" "\\)" "+\\)") nil t) (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)) (setq indent (current-column)) (beginning-of-line))) @@ -1020,7 +1022,7 @@ (re-search-backward (concat "^[ \t]*\\(class\\|module\\)[ \t]+" - "\\([A-Z]" ruby-symbol-re "+\\)") + "\\([A-Z]" ruby-symbol-re "*\\)") nil t)) (goto-char (match-beginning 1)) (if (< (current-column) indent) @@ -1028,10 +1030,33 @@ (setq mlist (cons (match-string 2) mlist)) (setq indent (current-column)) (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 (if (consp mlist) - (mapconcat (function identity) mlist "::") - nil))))) + (setq mlist (mapconcat (function identity) mlist "::"))) + (if mname + (if mlist (concat mlist mname) mname) + mlist))))) (cond ((featurep 'font-lock) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/