From: Kazuhiro NISHIYAMA Date: 2003-04-11T02:15:22+09:00 Subject: [ruby-list:37545] Re: ReFe 0.7 (Re: ReFe 0.6) 西山和広です。 In <20030408.032336.74754787.JCA02266@nifty.ne.jp> On Tue, 8 Apr 2003 03:23:40 +0900 Koji Arai wrote: > します。入力したメソッド名に対して複数のクラス候補がある場合 > はクラス名を聞いて来ます。メソッド名、クラス名の入力には補完 > が効きます。 引数無しのrefeの実行結果にクラス名しかなくて、 メソッド名の補完がきかないのですが。 とりあえず気にしないことにして、Meadowで動かなかったので ruby -S refeにするのと、no such class or methodなどの エラーメッセージの時にクラス名をきいてこないようにする パッチです。 -- |ZnZ(ゼット エヌ ゼット) |西山和広(Kazuhiro NISHIYAMA) diff -u -p -u -r1.2 refe.el --- refe.el 10 Apr 2003 17:08:53 -0000 +++ refe.el 10 Apr 2003 17:13:02 -0000 @@ -1,11 +1,23 @@ -(defvar refe-program-name "refe") +(defvar refe-program-name + (if (featurep 'meadow) + "ruby" + "refe")) +(defvar refe-program-args + (if (featurep 'meadow) + '("-S" "refe") + nil)) (defvar refe-buffer-name "*Refe*") (defvar refe-method-table nil) +(defun refe-call-process (buf &rest args) + (let ((coding-system-for-read 'euc-japan)) + (apply 'call-process refe-program-name nil buf nil + (append refe-program-args args)))) + (defun refe-make-completion-table () (setq refe-method-table (make-vector 547 0)) (with-temp-buffer - (call-process refe-program-name nil t nil "") + (refe-call-process t) (goto-char (point-min)) (while (looking-at "^[A-Z][A-Za-z_0-9:]*[#.]\\(.*\\)") @@ -49,7 +61,7 @@ (setq buffer-read-only nil) (erase-buffer) - (call-process refe-program-name nil buf nil word) + (refe-call-process buf word) (goto-char (point-min)) (if (re-search-forward "^---" nil t) @@ -60,10 +72,12 @@ (while (looking-at "^\\([A-Z][A-Za-z_0-9:]*\\)[#.]") (intern (match-string 1) klass-table) (forward-line)) - (setq klass (completing-read "Class: " - klass-table nil nil nil nil nil)) - (erase-buffer) - (call-process refe-program-name nil buf nil klass word))) + (if (= (point) (point-min)) + nil ; (message "no such class or method: %s" word) + (setq klass (completing-read "Class: " + klass-table nil nil nil nil nil)) + (erase-buffer) + (refe-call-process buf klass word)))) (set-buffer-modified-p nil) (setq buffer-read-only t)