1818; ;; (setq auto-mode-alist
1919; ;; (append '(("\\ .rb$" . ruby-mode)) auto-mode-alist))
2020; ;; (setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
21- ; ;; interpreter-mode-alist))
21+ ; ;; interpreter-mode-alist))
2222; ;;
2323; ;; (2) set to load inf-ruby and set inf-ruby key definition in ruby-mode.
2424; ;;
3333; ;;
3434; ;; HISTORY
3535; ;; senda - 8 Apr 1998: Created.
36- ; ;; $Log$
37- ; ;; Revision 1.7 2004/07/27 08:11:36 matz
38- ; ;; * eval.c (rb_eval): copy on write for argument local variable
39- ; ;; assignment.
36+ ; ;; $Log$
37+ ; ;; Revision 1.7 2004/07/27 08:11:36 matz
38+ ; ;; * eval.c (rb_eval): copy on write for argument local variable
39+ ; ;; assignment.
4040; ;;
41- ; ;; * eval.c (assign): ditto.
41+ ; ;; * eval.c (assign): ditto.
4242; ;;
43- ; ;; * eval.c (rb_call0): update ruby_frame->argv with the default
44- ; ;; value used for the optional arguments.
43+ ; ;; * eval.c (rb_call0): update ruby_frame->argv with the default
44+ ; ;; value used for the optional arguments.
4545; ;;
46- ; ;; * object.c (Init_Object): "===" calls rb_obj_equal() directly.
47- ; ;; [ruby-list:39937]
46+ ; ;; * object.c (Init_Object): "===" calls rb_obj_equal() directly.
47+ ; ;; [ruby-list:39937]
4848; ;;
49- ; ;; Revision 1.6 2002/09/07 14:35:46 nobu
50- ; ;; * misc/inf-ruby.el (inferior-ruby-error-regexp-alist): regexp
51- ; ;; alist for error message from ruby.
52- ; ;;
53- ; ;; * misc/inf-ruby.el (inferior-ruby-mode): fixed for Emacs.
54- ; ;;
55- ; ;; * misc/inf-ruby.el (ruby-send-region): compilation-parse-errors
56- ; ;; doesn't parse first line, so insert separators before each
57- ; ;; evaluations.
58- ; ;;
59- ; ;; Revision 1.5 2002/08/19 10:05:47 nobu
60- ; ;; * misc/inf-ruby.el (inf-ruby-keys): ruby-send-definition
61- ; ;; conflicted with ruby-insert-end.
62- ; ;;
63- ; ;; * misc/inf-ruby.el (inferior-ruby-mode): compilation-minor-mode.
64- ; ;;
65- ; ;; * misc/inf-ruby.el (ruby-send-region): send as here document to
66- ; ;; adjust source file/line. [ruby-talk:47113], [ruby-dev:17965]
67- ; ;;
68- ; ;; * misc/inf-ruby.el (ruby-send-terminator): added to make unique
69- ; ;; terminator.
70- ; ;;
71- ; ;; Revision 1.4 2002/01/29 07:16:09 matz
72- ; ;; * file.c (rb_stat_rdev_major): added. [new]
73- ; ;;
74- ; ;; * file.c (rb_stat_rdev_minor): added. [new]
75- ; ;;
76- ; ;; * file.c (rb_stat_inspect): print mode in octal.
77- ; ;;
78- ; ;; Revision 1.3 1999/12/01 09:24:18 matz
79- ; ;; 19991201
80- ; ;;
81- ; ;; Revision 1.2 1999/08/13 05:45:18 matz
82- ; ;; 1.4.0
83- ; ;;
84- ; ;; Revision 1.1.1.1.2.1 1999/07/15 07:59:59 matz
85- ; ;; 990715
86- ; ;;
87- ; ;; Revision 1.1.1.1 1999/01/20 04:59:36 matz
88- ; ;; ruby 1.3 cycle
89- ; ;;
90- ; ;; Revision 1.1.2.1 1998/12/16 07:30:36 matz
91- ; ;; first public release of 1.1d (pre1.2) series
92- ; ;;
93- ; ;; Revision 1.4 1998/05/20 02:45:58 senda
94- ; ;; default program to irb
49+ ; ;; Revision 1.6 2002/09/07 14:35:46 nobu
50+ ; ;; * misc/inf-ruby.el (inferior-ruby-error-regexp-alist): regexp
51+ ; ;; alist for error message from ruby.
52+ ; ;;
53+ ; ;; * misc/inf-ruby.el (inferior-ruby-mode): fixed for Emacs.
54+ ; ;;
55+ ; ;; * misc/inf-ruby.el (ruby-send-region): compilation-parse-errors
56+ ; ;; doesn't parse first line, so insert separators before each
57+ ; ;; evaluations.
58+ ; ;;
59+ ; ;; Revision 1.5 2002/08/19 10:05:47 nobu
60+ ; ;; * misc/inf-ruby.el (inf-ruby-keys): ruby-send-definition
61+ ; ;; conflicted with ruby-insert-end.
62+ ; ;;
63+ ; ;; * misc/inf-ruby.el (inferior-ruby-mode): compilation-minor-mode.
64+ ; ;;
65+ ; ;; * misc/inf-ruby.el (ruby-send-region): send as here document to
66+ ; ;; adjust source file/line. [ruby-talk:47113], [ruby-dev:17965]
67+ ; ;;
68+ ; ;; * misc/inf-ruby.el (ruby-send-terminator): added to make unique
69+ ; ;; terminator.
70+ ; ;;
71+ ; ;; Revision 1.4 2002/01/29 07:16:09 matz
72+ ; ;; * file.c (rb_stat_rdev_major): added. [new]
73+ ; ;;
74+ ; ;; * file.c (rb_stat_rdev_minor): added. [new]
75+ ; ;;
76+ ; ;; * file.c (rb_stat_inspect): print mode in octal.
77+ ; ;;
78+ ; ;; Revision 1.3 1999/12/01 09:24:18 matz
79+ ; ;; 19991201
80+ ; ;;
81+ ; ;; Revision 1.2 1999/08/13 05:45:18 matz
82+ ; ;; 1.4.0
83+ ; ;;
84+ ; ;; Revision 1.1.1.1.2.1 1999/07/15 07:59:59 matz
85+ ; ;; 990715
86+ ; ;;
87+ ; ;; Revision 1.1.1.1 1999/01/20 04:59:36 matz
88+ ; ;; ruby 1.3 cycle
89+ ; ;;
90+ ; ;; Revision 1.1.2.1 1998/12/16 07:30:36 matz
91+ ; ;; first public release of 1.1d (pre1.2) series
92+ ; ;;
93+ ; ;; Revision 1.4 1998/05/20 02:45:58 senda
94+ ; ;; default program to irb
9595; ;;
96- ; ;; Revision 1.3 1998/04/10 04:11:30 senda
97- ; ;; modification by Matsumoto san (1.1b9_09)
98- ; ;; remove-in-string defined
99- ; ;; global variable :
100- ; ;; inferior-ruby-first-prompt-pattern
101- ; ;; inferior-ruby-prompt-pattern
102- ; ;; defined
96+ ; ;; Revision 1.3 1998/04/10 04:11:30 senda
97+ ; ;; modification by Matsumoto san (1.1b9_09)
98+ ; ;; remove-in-string defined
99+ ; ;; global variable :
100+ ; ;; inferior-ruby-first-prompt-pattern
101+ ; ;; inferior-ruby-prompt-pattern
102+ ; ;; defined
103103; ;;
104- ; ;; Revision 1.2 1998/04/09 07:53:42 senda
105- ; ;; remove M-C-x in inferior-ruby-mode
104+ ; ;; Revision 1.2 1998/04/09 07:53:42 senda
105+ ; ;; remove M-C-x in inferior-ruby-mode
106106; ;;
107- ; ;; Revision 1.1 1998/04/09 07:28:36 senda
108- ; ;; Initial revision
107+ ; ;; Revision 1.1 1998/04/09 07:28:36 senda
108+ ; ;; Initial revision
109109; ;;
110110; ;;
111111
145145
146146(defconst inferior-ruby-error-regexp-alist
147147 '((" SyntaxError: compile error\n ^\\ ([^\( ].*\\ ):\\ ([1-9][0-9]*\\ ):" 1 2 )
148- (" ^\t from \\ ([^\( ].*\\ ):\\ ([1-9][0-9]*\\ )\\ (:in `.*' \\ )?$" 1 2 )))
148+ (" ^\t from \\ ([^\( ].*\\ ):\\ ([1-9][0-9]*\\ )\\ (:in `.*' \\ )?$" 1 2 )))
149149
150150(cond ((not inferior-ruby-mode-map)
151151 (setq inferior-ruby-mode-map
152- (copy-keymap comint-mode-map))
152+ (copy-keymap comint-mode-map))
153153; (define-key inferior-ruby-mode-map "\M-\C-x" ;gnu convention
154- ; 'ruby-send-definition)
154+ ; 'ruby-send-definition)
155155; (define-key inferior-ruby-mode-map "\C-x\C-e" 'ruby-send-last-sexp)
156156 (define-key inferior-ruby-mode-map " \C -c\C -l" 'ruby-load-file )
157157))
@@ -239,8 +239,8 @@ Defaults to a regexp ignoring all inputs of 0, 1, or 2 letters.")
239239 (let ((rtn-str " " ) (start 0 ) match prev-start)
240240 (while (setq match (string-match regexp str start))
241241 (setq prev-start start
242- start (match-end 0 )
243- rtn-str (concat rtn-str (substring str prev-start match ))))
242+ start (match-end 0 )
243+ rtn-str (concat rtn-str (substring str prev-start match ))))
244244 (concat rtn-str (substring str start))))
245245
246246(defun ruby-get-old-input ()
@@ -249,21 +249,21 @@ Defaults to a regexp ignoring all inputs of 0, 1, or 2 letters.")
249249 (let ((end (point )))
250250 (re-search-backward inferior-ruby-first-prompt-pattern)
251251 (remove-in-string (buffer-substring (point ) end)
252- inferior-ruby-prompt-pattern)
252+ inferior-ruby-prompt-pattern)
253253 )))
254254
255255(defun ruby-args-to-list (string )
256256 (let ((where (string-match " [ \t ]" string)))
257257 (cond ((null where) (list string))
258- ((not (= where 0 ))
259- (cons (substring string 0 where)
260- (ruby-args-to-list (substring string (+ 1 where)
261- (length string)))))
262- (t (let ((pos (string-match " [^ \t ]" string)))
263- (if (null pos)
264- nil
265- (ruby-args-to-list (substring string pos
266- (length string)))))))))
258+ ((not (= where 0 ))
259+ (cons (substring string 0 where)
260+ (ruby-args-to-list (substring string (+ 1 where)
261+ (length string)))))
262+ (t (let ((pos (string-match " [^ \t ]" string)))
263+ (if (null pos)
264+ nil
265+ (ruby-args-to-list (substring string pos
266+ (length string)))))))))
267267
268268(defun run-ruby (cmd )
269269 " Run an inferior Ruby process, input and output via buffer *ruby*.
@@ -274,13 +274,13 @@ of `ruby-program-name'). Runs the hooks `inferior-ruby-mode-hook'
274274\( Type \\ [describe-mode] in the process buffer for a list of commands.)"
275275
276276 (interactive (list (if current-prefix-arg
277- (read-string " Run Ruby: " ruby-program-name)
278- ruby-program-name)))
277+ (read-string " Run Ruby: " ruby-program-name)
278+ ruby-program-name)))
279279 (if (not (comint-check-proc " *ruby*" ))
280280 (let ((cmdlist (ruby-args-to-list cmd)))
281- (set-buffer (apply 'make-comint " ruby" (car cmdlist)
282- nil (cdr cmdlist)))
283- (inferior-ruby-mode)))
281+ (set-buffer (apply 'make-comint " ruby" (car cmdlist)
282+ nil (cdr cmdlist)))
283+ (inferior-ruby-mode)))
284284 (setq ruby-program-name cmd)
285285 (setq ruby-buffer " *ruby*" )
286286 (pop-to-buffer " *ruby*" ))
@@ -297,20 +297,20 @@ Must not contain ruby meta characters.")
297297 (let (term (file (buffer-file-name )) line)
298298 (save-excursion
299299 (save-restriction
300- (widen )
301- (goto-char start)
302- (setq line (+ start (forward-line (- start)) 1 ))
303- (goto-char start)
304- (while (progn
305- (setq term (apply 'format ruby-send-terminator (random ) (current-time )))
306- (re-search-forward (concat " ^" (regexp-quote term ) " $" ) end t )))))
300+ (widen )
301+ (goto-char start)
302+ (setq line (+ start (forward-line (- start)) 1 ))
303+ (goto-char start)
304+ (while (progn
305+ (setq term (apply 'format ruby-send-terminator (random ) (current-time )))
306+ (re-search-forward (concat " ^" (regexp-quote term ) " $" ) end t )))))
307307 ; ; compilation-parse-errors parses from second line.
308308 (save-excursion
309309 (let ((m (process-mark (ruby-proc))))
310- (set-buffer (marker-buffer m))
311- (goto-char m)
312- (insert ruby-eval-separator " \n " )
313- (set-marker m (point ))))
310+ (set-buffer (marker-buffer m))
311+ (goto-char m)
312+ (insert ruby-eval-separator " \n " )
313+ (set-marker m (point ))))
314314 (comint-send-string (ruby-proc) (format " eval <<'%s ', nil, %S , %d \n " term file line))
315315 (comint-send-region (ruby-proc) start end)
316316 (comint-send-string (ruby-proc) (concat " \n " term " \n " ))))
@@ -347,8 +347,8 @@ With argument, positions cursor at end of buffer."
347347 (pop-to-buffer ruby-buffer)
348348 (error " No current process buffer. See variable ruby-buffer. " ))
349349 (cond (eob-p
350- (push-mark )
351- (goto-char (point-max )))))
350+ (push-mark )
351+ (goto-char (point-max )))))
352352
353353(defun ruby-send-region-and-go (start end )
354354 " Send the current region to the inferior Ruby process.
@@ -386,29 +386,29 @@ next one.")
386386(defun ruby-load-file (file-name )
387387 " Load a Ruby file into the inferior Ruby process."
388388 (interactive (comint-get-source " Load Ruby file: " ruby-prev-l/c-dir/file
389- ruby-source-modes t )) ; T because LOAD
389+ ruby-source-modes t )) ; T because LOAD
390390 ; needs an exact name
391391 (comint-check-source file-name) ; Check to see if buffer needs saved.
392392 (setq ruby-prev-l/c-dir/file (cons (file-name-directory file-name)
393- (file-name-nondirectory file-name)))
393+ (file-name-nondirectory file-name)))
394394 (comint-send-string (ruby-proc) (concat " (load \" "
395- file-name
396- " \"\)\n " )))
395+ file-name
396+ " \"\)\n " )))
397397
398398(defun ruby-proc ()
399399 " Returns the current ruby process. See variable ruby-buffer."
400400 (let ((proc (get-buffer-process (if (eq major-mode 'inferior-ruby-mode )
401- (current-buffer )
402- ruby-buffer))))
401+ (current-buffer )
402+ ruby-buffer))))
403403 (or proc
404- (error " No current process. See variable ruby-buffer " ))))
404+ (error " No current process. See variable ruby-buffer " ))))
405405
406406; ;; Do the user's customisation...
407407
408408(defvar inf-ruby-load-hook nil
409409 " This hook is run when inf-ruby is loaded in.
410410This is a good place to put keybindings." )
411-
411+
412412(run-hooks 'inf-ruby-load-hook )
413413
414414(provide 'inf-ruby )
0 commit comments