From: nobu.nakada@... Date: 2002-09-07T20:28:23+09:00 Subject: [ruby-dev:18216] Re: inferior-ruby-mode and irb なかだです。 At Sat, 7 Sep 2002 02:21:07 +0900, Koji Arai wrote: > > 今の inf-ruby.el (revision 1.5) は、この > > > > compilation-build-compilation-error-regexp-alist > > compilation-error-regexp-alist-alist > > > > というのを使ってますがこれは、xemacs 添付パッケージの機能なんですかね? > > GNU Emacs では、以下のようにエラーになります。(ちなみに、Debianです) > > とりあえずの逃げです。他にも (line-number) という関数がない > などと怒られましたが、inf-ruby.el ぢつは使ってるわけではない > ので、これ以上は追求しませんでした。 ここのところ反応が鈍くてすいません。これでどうでしょうか。 Index: inf-ruby.el =================================================================== RCS file: /cvs/ruby/src/ruby/misc/inf-ruby.el,v retrieving revision 1.5 diff -u -2 -p -r1.5 inf-ruby.el --- inf-ruby.el 19 Aug 2002 10:05:47 -0000 1.5 +++ inf-ruby.el 7 Sep 2002 11:25:16 -0000 @@ -123,8 +123,7 @@ "*Mode map for inferior-ruby-mode") -(pushnew '(ruby ("^\tfrom \\([^\(].*\\):\\([1-9][0-9]*\\):in \`.*\'$" 1 2)) - compilation-error-regexp-alist-alist) -(pushnew '(ruby ("SyntaxError: compile error\n^\\([^\(].*\\):\\([1-9][0-9]*\\):" 1 2)) - compilation-error-regexp-alist-alist) +(defconst inferior-ruby-error-regexp-alist + '(("SyntaxError: compile error\n^\\([^\(].*\\):\\([1-9][0-9]*\\):" 1 2) + ("^\tfrom \\([^\(].*\\):\\([1-9][0-9]*\\)\\(:in `.*'\\)?$" 1 2))) (cond ((not inferior-ruby-mode-map) @@ -201,6 +200,7 @@ to continue it." (setq comint-input-filter (function ruby-input-filter)) (setq comint-get-old-input (function ruby-get-old-input)) - (compilation-minor-mode) - (compilation-build-compilation-error-regexp-alist) + (compilation-shell-minor-mode t) + (make-local-variable 'compilation-error-regexp-alist) + (setq compilation-error-regexp-alist inferior-ruby-error-regexp-alist) (run-hooks 'inferior-ruby-mode-hook)) @@ -269,4 +269,6 @@ of `ruby-program-name'). Runs the hooks Must not contain ruby meta characters.") +(defconst ruby-eval-separator "") + (defun ruby-send-region (start end) "Send the current region to the inferior Ruby process." @@ -274,9 +276,19 @@ Must not contain ruby meta characters.") (let (term (file (buffer-file-name)) line) (save-excursion - (goto-char start) - (setq line (line-number)) - (while (progn - (setq term (apply 'format ruby-send-terminator (random) (current-time))) - (re-search-forward (concat "^" (regexp-quote term) "$") end t)))) + (save-restriction + (widen) + (goto-char start) + (setq line (+ start (forward-line (- start)) 1)) + (goto-char start) + (while (progn + (setq term (apply 'format ruby-send-terminator (random) (current-time))) + (re-search-forward (concat "^" (regexp-quote term) "$") end t))))) + ;; compilation-parse-errors parses from second line. + (save-excursion + (let ((m (process-mark (ruby-proc)))) + (set-buffer (marker-buffer m)) + (goto-char m) + (insert ruby-eval-separator "\n") + (set-marker m (point)))) (comint-send-string (ruby-proc) (format "eval <<'%s', nil, %S, %d\n" term file line)) (comint-send-region (ruby-proc) start end) -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦