From a7a7324ea645b881658fb78d2e7e049f48970afd Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 18 Jan 2002 14:24:01 +0000 Subject: * io.c (rb_io_s_new): block check moved from initialize to this method. * io.c (rb_io_s_open): open should call initialize too. IO#for_fd also calls initialize. [new] * error.c (rb_sys_fail): replace INT2FIX() by INT2NUM() since errno value may not fit in Fixnum size on Hurd. * error.c (set_syserr): ditto. * dir.c (dir_s_glob): returns nil if block given. * io.c (rb_io_each_byte): should return self. * io.c (rb_io_close_m): close check added. * dir.c (dir_seek): should return pos. * parse.y (fixpos): orig may be (NODE*)1, which should not be dereferenced. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- misc/ruby-mode.el | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'misc/ruby-mode.el') diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el index c365c20a3b..56cb1ed2aa 100644 --- a/misc/ruby-mode.el +++ b/misc/ruby-mode.el @@ -189,6 +189,9 @@ The variable ruby-indent-level controls the amount of indentation. (make-local-variable 'imenu-create-index-function) (setq imenu-create-index-function 'ruby-imenu-create-index) + (make-local-variable 'add-log-current-defun-function) + (setq add-log-current-defun-function 'ruby-add-log-current-method) + (run-hooks 'ruby-mode-hook)) (defun ruby-current-indentation () @@ -682,6 +685,42 @@ An end of a defun is found by moving forward from the beginning of one." (ruby-beginning-of-defun) (re-search-backward "^\n" (- (point) 1) t)) +(defun ruby-add-log-current-method () + "Return current method string." + (condition-case nil + (save-excursion + (let ((mlist nil) (indent 0)) + ;; get current method (or class/module) + (if (re-search-backward + (concat "^[ \t]*\\(def\\|class\\|module\\)[ \t]+" + "\\(" ruby-symbol-re "+\\)") + nil t) + (progn + (setq mlist (list (buffer-substring + (match-beginning 2) (match-end 2)))) + (goto-char (match-beginning 1)) + (setq indent (current-column)) + (beginning-of-line))) + ;; nest class/module + (while (and (> indent 0) + (re-search-backward + (concat + "^[ \t]*\\(class\\|module\\)[ \t]+" + "\\([A-Z]" ruby-symbol-re "+\\)") + nil t)) + (goto-char (match-beginning 1)) + (if (< (current-column) indent) + (progn + (setq mlist + (cons (buffer-substring + (match-beginning 2) (match-end 2)) mlist)) + (setq indent (current-column)) + (beginning-of-line)))) + ;; generate string + (if (consp mlist) + (mapconcat (function identity) mlist "::") + nil))))) + (cond ((featurep 'font-lock) (or (boundp 'font-lock-variable-name-face) -- cgit v1.2.3