mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* misc/*.el: untabify, for interal consistency and consistency
with standard Emacs elisp files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									d250d79e5b
								
							
						
					
					
						commit
						4cbbf3bdfc
					
				
					 5 changed files with 860 additions and 857 deletions
				
			
		| 
						 | 
					@ -14,6 +14,9 @@ Sun Sep  7 07:24:09 2008  Yukihiro Matsumoto  <matz@ruby-lang.org>
 | 
				
			||||||
	* misc/ruby-mode.el, misc/ruby-electric.el: use regexp-opt where
 | 
						* misc/ruby-mode.el, misc/ruby-electric.el: use regexp-opt where
 | 
				
			||||||
	  possible for more efficient regexps.
 | 
						  possible for more efficient regexps.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* misc/*.el: untabify, for interal consistency and consistency
 | 
				
			||||||
 | 
						  with standard Emacs elisp files.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Sun Sep  7 06:31:51 2008  Yukihiro Matsumoto  <matz@ruby-lang.org>
 | 
					Sun Sep  7 06:31:51 2008  Yukihiro Matsumoto  <matz@ruby-lang.org>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* file.c (file_expand_path): applied a patch from Nobuhiro Tachino
 | 
						* file.c (file_expand_path): applied a patch from Nobuhiro Tachino
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										216
									
								
								misc/inf-ruby.el
									
										
									
									
									
								
							
							
						
						
									
										216
									
								
								misc/inf-ruby.el
									
										
									
									
									
								
							| 
						 | 
					@ -18,7 +18,7 @@
 | 
				
			||||||
;;;    (setq auto-mode-alist
 | 
					;;;    (setq auto-mode-alist
 | 
				
			||||||
;;;          (append '(("\\.rb$" . ruby-mode)) auto-mode-alist))
 | 
					;;;          (append '(("\\.rb$" . ruby-mode)) auto-mode-alist))
 | 
				
			||||||
;;;    (setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
 | 
					;;;    (setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
 | 
				
			||||||
;;;    				     interpreter-mode-alist))
 | 
					;;;                                  interpreter-mode-alist))
 | 
				
			||||||
;;;    
 | 
					;;;    
 | 
				
			||||||
;;; (2) set to load inf-ruby and set inf-ruby key definition in ruby-mode.
 | 
					;;; (2) set to load inf-ruby and set inf-ruby key definition in ruby-mode.
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
| 
						 | 
					@ -33,79 +33,79 @@
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;; HISTORY
 | 
					;;; HISTORY
 | 
				
			||||||
;;; senda -  8 Apr 1998: Created.
 | 
					;;; senda -  8 Apr 1998: Created.
 | 
				
			||||||
;;;	 $Log$
 | 
					;;;      $Log$
 | 
				
			||||||
;;;	 Revision 1.7  2004/07/27 08:11:36  matz
 | 
					;;;      Revision 1.7  2004/07/27 08:11:36  matz
 | 
				
			||||||
;;;	 * eval.c (rb_eval): copy on write for argument local variable
 | 
					;;;      * eval.c (rb_eval): copy on write for argument local variable
 | 
				
			||||||
;;;	   assignment.
 | 
					;;;        assignment.
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;;	 * eval.c (assign): ditto.
 | 
					;;;      * eval.c (assign): ditto.
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;;	 * eval.c (rb_call0): update ruby_frame->argv with the default
 | 
					;;;      * eval.c (rb_call0): update ruby_frame->argv with the default
 | 
				
			||||||
;;;	   value used for the optional arguments.
 | 
					;;;        value used for the optional arguments.
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;;	 * object.c (Init_Object): "===" calls rb_obj_equal() directly.
 | 
					;;;      * object.c (Init_Object): "===" calls rb_obj_equal() directly.
 | 
				
			||||||
;;;	   [ruby-list:39937]
 | 
					;;;        [ruby-list:39937]
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;;	 Revision 1.6  2002/09/07 14:35:46  nobu
 | 
					;;;      Revision 1.6  2002/09/07 14:35:46  nobu
 | 
				
			||||||
;;;	 * misc/inf-ruby.el (inferior-ruby-error-regexp-alist): regexp
 | 
					;;;      * misc/inf-ruby.el (inferior-ruby-error-regexp-alist): regexp
 | 
				
			||||||
;;;	   alist for error message from ruby.
 | 
					;;;        alist for error message from ruby.
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 * misc/inf-ruby.el (inferior-ruby-mode): fixed for Emacs.
 | 
					;;;      * misc/inf-ruby.el (inferior-ruby-mode): fixed for Emacs.
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 * misc/inf-ruby.el (ruby-send-region): compilation-parse-errors
 | 
					;;;      * misc/inf-ruby.el (ruby-send-region): compilation-parse-errors
 | 
				
			||||||
;;;	   doesn't parse first line, so insert separators before each
 | 
					;;;        doesn't parse first line, so insert separators before each
 | 
				
			||||||
;;;	   evaluations.
 | 
					;;;        evaluations.
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 Revision 1.5  2002/08/19 10:05:47  nobu
 | 
					;;;      Revision 1.5  2002/08/19 10:05:47  nobu
 | 
				
			||||||
;;;	 * misc/inf-ruby.el (inf-ruby-keys): ruby-send-definition
 | 
					;;;      * misc/inf-ruby.el (inf-ruby-keys): ruby-send-definition
 | 
				
			||||||
;;;	   conflicted with ruby-insert-end.
 | 
					;;;        conflicted with ruby-insert-end.
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 * misc/inf-ruby.el (inferior-ruby-mode): compilation-minor-mode.
 | 
					;;;      * misc/inf-ruby.el (inferior-ruby-mode): compilation-minor-mode.
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 * misc/inf-ruby.el (ruby-send-region): send as here document to
 | 
					;;;      * misc/inf-ruby.el (ruby-send-region): send as here document to
 | 
				
			||||||
;;;	   adjust source file/line.  [ruby-talk:47113], [ruby-dev:17965]
 | 
					;;;        adjust source file/line.  [ruby-talk:47113], [ruby-dev:17965]
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 * misc/inf-ruby.el (ruby-send-terminator): added to make unique
 | 
					;;;      * misc/inf-ruby.el (ruby-send-terminator): added to make unique
 | 
				
			||||||
;;;	   terminator.
 | 
					;;;        terminator.
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 Revision 1.4  2002/01/29 07:16:09  matz
 | 
					;;;      Revision 1.4  2002/01/29 07:16:09  matz
 | 
				
			||||||
;;;	 * file.c (rb_stat_rdev_major): added. [new]
 | 
					;;;      * file.c (rb_stat_rdev_major): added. [new]
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 * file.c (rb_stat_rdev_minor): added. [new]
 | 
					;;;      * file.c (rb_stat_rdev_minor): added. [new]
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 * file.c (rb_stat_inspect): print mode in octal.
 | 
					;;;      * file.c (rb_stat_inspect): print mode in octal.
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 Revision 1.3  1999/12/01 09:24:18  matz
 | 
					;;;      Revision 1.3  1999/12/01 09:24:18  matz
 | 
				
			||||||
;;;	 19991201
 | 
					;;;      19991201
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 Revision 1.2  1999/08/13 05:45:18  matz
 | 
					;;;      Revision 1.2  1999/08/13 05:45:18  matz
 | 
				
			||||||
;;;	 1.4.0
 | 
					;;;      1.4.0
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 Revision 1.1.1.1.2.1  1999/07/15 07:59:59  matz
 | 
					;;;      Revision 1.1.1.1.2.1  1999/07/15 07:59:59  matz
 | 
				
			||||||
;;;	 990715
 | 
					;;;      990715
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 Revision 1.1.1.1  1999/01/20 04:59:36  matz
 | 
					;;;      Revision 1.1.1.1  1999/01/20 04:59:36  matz
 | 
				
			||||||
;;;	 ruby 1.3 cycle
 | 
					;;;      ruby 1.3 cycle
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 Revision 1.1.2.1  1998/12/16 07:30:36  matz
 | 
					;;;      Revision 1.1.2.1  1998/12/16 07:30:36  matz
 | 
				
			||||||
;;;	 first public release of 1.1d (pre1.2) series
 | 
					;;;      first public release of 1.1d (pre1.2) series
 | 
				
			||||||
;;;	
 | 
					;;;     
 | 
				
			||||||
;;;	 Revision 1.4  1998/05/20 02:45:58  senda
 | 
					;;;      Revision 1.4  1998/05/20 02:45:58  senda
 | 
				
			||||||
;;;	 default program to irb
 | 
					;;;      default program to irb
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;;	 Revision 1.3  1998/04/10 04:11:30  senda
 | 
					;;;      Revision 1.3  1998/04/10 04:11:30  senda
 | 
				
			||||||
;;;	 modification by Matsumoto san (1.1b9_09)
 | 
					;;;      modification by Matsumoto san (1.1b9_09)
 | 
				
			||||||
;;;	 remove-in-string defined
 | 
					;;;      remove-in-string defined
 | 
				
			||||||
;;;	 global variable :
 | 
					;;;      global variable :
 | 
				
			||||||
;;;	 	 inferior-ruby-first-prompt-pattern
 | 
					;;;              inferior-ruby-first-prompt-pattern
 | 
				
			||||||
;;;	       inferior-ruby-prompt-pattern
 | 
					;;;            inferior-ruby-prompt-pattern
 | 
				
			||||||
;;;	 defined
 | 
					;;;      defined
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;;	 Revision 1.2  1998/04/09 07:53:42  senda
 | 
					;;;      Revision 1.2  1998/04/09 07:53:42  senda
 | 
				
			||||||
;;;	 remove M-C-x in inferior-ruby-mode
 | 
					;;;      remove M-C-x in inferior-ruby-mode
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;;	 Revision 1.1  1998/04/09 07:28:36  senda
 | 
					;;;      Revision 1.1  1998/04/09 07:28:36  senda
 | 
				
			||||||
;;;	 Initial revision
 | 
					;;;      Initial revision
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,13 +145,13 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defconst inferior-ruby-error-regexp-alist
 | 
					(defconst inferior-ruby-error-regexp-alist
 | 
				
			||||||
       '(("SyntaxError: compile error\n^\\([^\(].*\\):\\([1-9][0-9]*\\):" 1 2)
 | 
					       '(("SyntaxError: compile error\n^\\([^\(].*\\):\\([1-9][0-9]*\\):" 1 2)
 | 
				
			||||||
	 ("^\tfrom \\([^\(].*\\):\\([1-9][0-9]*\\)\\(:in `.*'\\)?$" 1 2)))
 | 
					         ("^\tfrom \\([^\(].*\\):\\([1-9][0-9]*\\)\\(:in `.*'\\)?$" 1 2)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(cond ((not inferior-ruby-mode-map)
 | 
					(cond ((not inferior-ruby-mode-map)
 | 
				
			||||||
       (setq inferior-ruby-mode-map
 | 
					       (setq inferior-ruby-mode-map
 | 
				
			||||||
	     (copy-keymap comint-mode-map))
 | 
					             (copy-keymap comint-mode-map))
 | 
				
			||||||
;       (define-key inferior-ruby-mode-map "\M-\C-x" ;gnu convention
 | 
					;       (define-key inferior-ruby-mode-map "\M-\C-x" ;gnu convention
 | 
				
			||||||
;	           'ruby-send-definition)
 | 
					;                  'ruby-send-definition)
 | 
				
			||||||
;       (define-key inferior-ruby-mode-map "\C-x\C-e" 'ruby-send-last-sexp)
 | 
					;       (define-key inferior-ruby-mode-map "\C-x\C-e" 'ruby-send-last-sexp)
 | 
				
			||||||
       (define-key inferior-ruby-mode-map "\C-c\C-l" 'ruby-load-file)
 | 
					       (define-key inferior-ruby-mode-map "\C-c\C-l" 'ruby-load-file)
 | 
				
			||||||
))
 | 
					))
 | 
				
			||||||
| 
						 | 
					@ -239,8 +239,8 @@ Defaults to a regexp ignoring all inputs of 0, 1, or 2 letters.")
 | 
				
			||||||
  (let ((rtn-str "") (start 0) match prev-start)
 | 
					  (let ((rtn-str "") (start 0) match prev-start)
 | 
				
			||||||
    (while (setq match (string-match regexp str start))
 | 
					    (while (setq match (string-match regexp str start))
 | 
				
			||||||
      (setq prev-start start
 | 
					      (setq prev-start start
 | 
				
			||||||
	    start (match-end 0)
 | 
					            start (match-end 0)
 | 
				
			||||||
	    rtn-str (concat rtn-str (substring str prev-start match))))
 | 
					            rtn-str (concat rtn-str (substring str prev-start match))))
 | 
				
			||||||
    (concat rtn-str (substring str start))))
 | 
					    (concat rtn-str (substring str start))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun ruby-get-old-input ()
 | 
					(defun ruby-get-old-input ()
 | 
				
			||||||
| 
						 | 
					@ -249,21 +249,21 @@ Defaults to a regexp ignoring all inputs of 0, 1, or 2 letters.")
 | 
				
			||||||
    (let ((end (point)))
 | 
					    (let ((end (point)))
 | 
				
			||||||
      (re-search-backward inferior-ruby-first-prompt-pattern)
 | 
					      (re-search-backward inferior-ruby-first-prompt-pattern)
 | 
				
			||||||
      (remove-in-string (buffer-substring (point) end)
 | 
					      (remove-in-string (buffer-substring (point) end)
 | 
				
			||||||
			inferior-ruby-prompt-pattern)
 | 
					                        inferior-ruby-prompt-pattern)
 | 
				
			||||||
      )))
 | 
					      )))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun ruby-args-to-list (string)
 | 
					(defun ruby-args-to-list (string)
 | 
				
			||||||
  (let ((where (string-match "[ \t]" string)))
 | 
					  (let ((where (string-match "[ \t]" string)))
 | 
				
			||||||
    (cond ((null where) (list string))
 | 
					    (cond ((null where) (list string))
 | 
				
			||||||
	  ((not (= where 0))
 | 
					          ((not (= where 0))
 | 
				
			||||||
	   (cons (substring string 0 where)
 | 
					           (cons (substring string 0 where)
 | 
				
			||||||
		 (ruby-args-to-list (substring string (+ 1 where)
 | 
					                 (ruby-args-to-list (substring string (+ 1 where)
 | 
				
			||||||
						 (length string)))))
 | 
					                                                 (length string)))))
 | 
				
			||||||
	  (t (let ((pos (string-match "[^ \t]" string)))
 | 
					          (t (let ((pos (string-match "[^ \t]" string)))
 | 
				
			||||||
	       (if (null pos)
 | 
					               (if (null pos)
 | 
				
			||||||
		   nil
 | 
					                   nil
 | 
				
			||||||
		 (ruby-args-to-list (substring string pos
 | 
					                 (ruby-args-to-list (substring string pos
 | 
				
			||||||
						 (length string)))))))))
 | 
					                                                 (length string)))))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun run-ruby (cmd)
 | 
					(defun run-ruby (cmd)
 | 
				
			||||||
  "Run an inferior Ruby process, input and output via buffer *ruby*.
 | 
					  "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'
 | 
				
			||||||
\(Type \\[describe-mode] in the process buffer for a list of commands.)"
 | 
					\(Type \\[describe-mode] in the process buffer for a list of commands.)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  (interactive (list (if current-prefix-arg
 | 
					  (interactive (list (if current-prefix-arg
 | 
				
			||||||
			 (read-string "Run Ruby: " ruby-program-name)
 | 
					                         (read-string "Run Ruby: " ruby-program-name)
 | 
				
			||||||
			 ruby-program-name)))
 | 
					                         ruby-program-name)))
 | 
				
			||||||
  (if (not (comint-check-proc "*ruby*"))
 | 
					  (if (not (comint-check-proc "*ruby*"))
 | 
				
			||||||
      (let ((cmdlist (ruby-args-to-list cmd)))
 | 
					      (let ((cmdlist (ruby-args-to-list cmd)))
 | 
				
			||||||
	(set-buffer (apply 'make-comint "ruby" (car cmdlist)
 | 
					        (set-buffer (apply 'make-comint "ruby" (car cmdlist)
 | 
				
			||||||
			   nil (cdr cmdlist)))
 | 
					                           nil (cdr cmdlist)))
 | 
				
			||||||
	(inferior-ruby-mode)))
 | 
					        (inferior-ruby-mode)))
 | 
				
			||||||
  (setq ruby-program-name cmd)
 | 
					  (setq ruby-program-name cmd)
 | 
				
			||||||
  (setq ruby-buffer "*ruby*")
 | 
					  (setq ruby-buffer "*ruby*")
 | 
				
			||||||
  (pop-to-buffer "*ruby*"))
 | 
					  (pop-to-buffer "*ruby*"))
 | 
				
			||||||
| 
						 | 
					@ -297,20 +297,20 @@ Must not contain ruby meta characters.")
 | 
				
			||||||
  (let (term (file (buffer-file-name)) line)
 | 
					  (let (term (file (buffer-file-name)) line)
 | 
				
			||||||
    (save-excursion
 | 
					    (save-excursion
 | 
				
			||||||
      (save-restriction
 | 
					      (save-restriction
 | 
				
			||||||
	(widen)
 | 
					        (widen)
 | 
				
			||||||
	(goto-char start)
 | 
					        (goto-char start)
 | 
				
			||||||
	(setq line (+ start (forward-line (- start)) 1))
 | 
					        (setq line (+ start (forward-line (- start)) 1))
 | 
				
			||||||
	(goto-char start)
 | 
					        (goto-char start)
 | 
				
			||||||
	(while (progn
 | 
					        (while (progn
 | 
				
			||||||
		 (setq term (apply 'format ruby-send-terminator (random) (current-time)))
 | 
					                 (setq term (apply 'format ruby-send-terminator (random) (current-time)))
 | 
				
			||||||
		 (re-search-forward (concat "^" (regexp-quote term) "$") end t)))))
 | 
					                 (re-search-forward (concat "^" (regexp-quote term) "$") end t)))))
 | 
				
			||||||
    ;; compilation-parse-errors parses from second line.
 | 
					    ;; compilation-parse-errors parses from second line.
 | 
				
			||||||
    (save-excursion
 | 
					    (save-excursion
 | 
				
			||||||
      (let ((m (process-mark (ruby-proc))))
 | 
					      (let ((m (process-mark (ruby-proc))))
 | 
				
			||||||
	(set-buffer (marker-buffer m))
 | 
					        (set-buffer (marker-buffer m))
 | 
				
			||||||
	(goto-char m)
 | 
					        (goto-char m)
 | 
				
			||||||
	(insert ruby-eval-separator "\n")
 | 
					        (insert ruby-eval-separator "\n")
 | 
				
			||||||
	(set-marker m (point))))
 | 
					        (set-marker m (point))))
 | 
				
			||||||
    (comint-send-string (ruby-proc) (format "eval <<'%s', nil, %S, %d\n" term file line))
 | 
					    (comint-send-string (ruby-proc) (format "eval <<'%s', nil, %S, %d\n" term file line))
 | 
				
			||||||
    (comint-send-region (ruby-proc) start end)
 | 
					    (comint-send-region (ruby-proc) start end)
 | 
				
			||||||
    (comint-send-string (ruby-proc) (concat "\n" term "\n"))))
 | 
					    (comint-send-string (ruby-proc) (concat "\n" term "\n"))))
 | 
				
			||||||
| 
						 | 
					@ -347,8 +347,8 @@ With argument, positions cursor at end of buffer."
 | 
				
			||||||
      (pop-to-buffer ruby-buffer)
 | 
					      (pop-to-buffer ruby-buffer)
 | 
				
			||||||
      (error "No current process buffer. See variable ruby-buffer."))
 | 
					      (error "No current process buffer. See variable ruby-buffer."))
 | 
				
			||||||
  (cond (eob-p
 | 
					  (cond (eob-p
 | 
				
			||||||
	 (push-mark)
 | 
					         (push-mark)
 | 
				
			||||||
	 (goto-char (point-max)))))
 | 
					         (goto-char (point-max)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun ruby-send-region-and-go (start end)
 | 
					(defun ruby-send-region-and-go (start end)
 | 
				
			||||||
  "Send the current region to the inferior Ruby process.
 | 
					  "Send the current region to the inferior Ruby process.
 | 
				
			||||||
| 
						 | 
					@ -386,29 +386,29 @@ next one.")
 | 
				
			||||||
(defun ruby-load-file (file-name)
 | 
					(defun ruby-load-file (file-name)
 | 
				
			||||||
  "Load a Ruby file into the inferior Ruby process."
 | 
					  "Load a Ruby file into the inferior Ruby process."
 | 
				
			||||||
  (interactive (comint-get-source "Load Ruby file: " ruby-prev-l/c-dir/file
 | 
					  (interactive (comint-get-source "Load Ruby file: " ruby-prev-l/c-dir/file
 | 
				
			||||||
				  ruby-source-modes t)) ; T because LOAD 
 | 
					                                  ruby-source-modes t)) ; T because LOAD 
 | 
				
			||||||
                                                          ; needs an exact name
 | 
					                                                          ; needs an exact name
 | 
				
			||||||
  (comint-check-source file-name) ; Check to see if buffer needs saved.
 | 
					  (comint-check-source file-name) ; Check to see if buffer needs saved.
 | 
				
			||||||
  (setq ruby-prev-l/c-dir/file (cons (file-name-directory    file-name)
 | 
					  (setq ruby-prev-l/c-dir/file (cons (file-name-directory    file-name)
 | 
				
			||||||
				       (file-name-nondirectory file-name)))
 | 
					                                       (file-name-nondirectory file-name)))
 | 
				
			||||||
  (comint-send-string (ruby-proc) (concat "(load \""
 | 
					  (comint-send-string (ruby-proc) (concat "(load \""
 | 
				
			||||||
					    file-name
 | 
					                                            file-name
 | 
				
			||||||
					    "\"\)\n")))
 | 
					                                            "\"\)\n")))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun ruby-proc ()
 | 
					(defun ruby-proc ()
 | 
				
			||||||
  "Returns the current ruby process. See variable ruby-buffer."
 | 
					  "Returns the current ruby process. See variable ruby-buffer."
 | 
				
			||||||
  (let ((proc (get-buffer-process (if (eq major-mode 'inferior-ruby-mode)
 | 
					  (let ((proc (get-buffer-process (if (eq major-mode 'inferior-ruby-mode)
 | 
				
			||||||
				      (current-buffer)
 | 
					                                      (current-buffer)
 | 
				
			||||||
				    ruby-buffer))))
 | 
					                                    ruby-buffer))))
 | 
				
			||||||
    (or proc
 | 
					    (or proc
 | 
				
			||||||
	(error "No current process. See variable ruby-buffer"))))
 | 
					        (error "No current process. See variable ruby-buffer"))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;; Do the user's customisation...
 | 
					;;; Do the user's customisation...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defvar inf-ruby-load-hook nil
 | 
					(defvar inf-ruby-load-hook nil
 | 
				
			||||||
  "This hook is run when inf-ruby is loaded in.
 | 
					  "This hook is run when inf-ruby is loaded in.
 | 
				
			||||||
This is a good place to put keybindings.")
 | 
					This is a good place to put keybindings.")
 | 
				
			||||||
	
 | 
					        
 | 
				
			||||||
(run-hooks 'inf-ruby-load-hook)
 | 
					(run-hooks 'inf-ruby-load-hook)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(provide 'inf-ruby)
 | 
					(provide 'inf-ruby)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -77,14 +77,14 @@ is to be inserted."
 | 
				
			||||||
  "*List of contexts where matching delimiter should be
 | 
					  "*List of contexts where matching delimiter should be
 | 
				
			||||||
inserted. The word 'all' will do all insertions."
 | 
					inserted. The word 'all' will do all insertions."
 | 
				
			||||||
  :type '(set :extra-offset 8
 | 
					  :type '(set :extra-offset 8
 | 
				
			||||||
	      (const :tag "Everything" all )
 | 
					              (const :tag "Everything" all )
 | 
				
			||||||
	      (const :tag "Curly brace" ?\{ )
 | 
					              (const :tag "Curly brace" ?\{ )
 | 
				
			||||||
	      (const :tag "Square brace" ?\[ )
 | 
					              (const :tag "Square brace" ?\[ )
 | 
				
			||||||
	      (const :tag "Round brace" ?\( )
 | 
					              (const :tag "Round brace" ?\( )
 | 
				
			||||||
	      (const :tag "Quote" ?\' )
 | 
					              (const :tag "Quote" ?\' )
 | 
				
			||||||
	      (const :tag "Double quote" ?\" )
 | 
					              (const :tag "Double quote" ?\" )
 | 
				
			||||||
	      (const :tag "Back quote" ?\` )
 | 
					              (const :tag "Back quote" ?\` )
 | 
				
			||||||
	      (const :tag "Vertical bar" ?\| ))
 | 
					              (const :tag "Vertical bar" ?\| ))
 | 
				
			||||||
  :group 'ruby-electric) 
 | 
					  :group 'ruby-electric) 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defcustom ruby-electric-newline-before-closing-bracket nil
 | 
					(defcustom ruby-electric-newline-before-closing-bracket nil
 | 
				
			||||||
| 
						 | 
					@ -126,15 +126,15 @@ strings. Note that you must have Font Lock enabled."
 | 
				
			||||||
  (self-insert-command (prefix-numeric-value arg))
 | 
					  (self-insert-command (prefix-numeric-value arg))
 | 
				
			||||||
  (if (ruby-electric-space-can-be-expanded-p)
 | 
					  (if (ruby-electric-space-can-be-expanded-p)
 | 
				
			||||||
      (save-excursion
 | 
					      (save-excursion
 | 
				
			||||||
	(ruby-indent-line t)
 | 
					        (ruby-indent-line t)
 | 
				
			||||||
	(newline)
 | 
					        (newline)
 | 
				
			||||||
	(ruby-insert-end))))
 | 
					        (ruby-insert-end))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun ruby-electric-code-at-point-p()
 | 
					(defun ruby-electric-code-at-point-p()
 | 
				
			||||||
  (and ruby-electric-mode
 | 
					  (and ruby-electric-mode
 | 
				
			||||||
       (let* ((properties (text-properties-at (point))))
 | 
					       (let* ((properties (text-properties-at (point))))
 | 
				
			||||||
	 (and (null (memq 'font-lock-string-face properties))
 | 
					         (and (null (memq 'font-lock-string-face properties))
 | 
				
			||||||
	      (null (memq 'font-lock-comment-face properties))))))
 | 
					              (null (memq 'font-lock-comment-face properties))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun ruby-electric-string-at-point-p()
 | 
					(defun ruby-electric-string-at-point-p()
 | 
				
			||||||
  (and ruby-electric-mode
 | 
					  (and ruby-electric-mode
 | 
				
			||||||
| 
						 | 
					@ -147,17 +147,17 @@ strings. Note that you must have Font Lock enabled."
 | 
				
			||||||
(defun ruby-electric-space-can-be-expanded-p()
 | 
					(defun ruby-electric-space-can-be-expanded-p()
 | 
				
			||||||
  (if (ruby-electric-code-at-point-p)
 | 
					  (if (ruby-electric-code-at-point-p)
 | 
				
			||||||
      (let* ((ruby-electric-keywords-re 
 | 
					      (let* ((ruby-electric-keywords-re 
 | 
				
			||||||
	      (concat ruby-electric-simple-keywords-re "\\s-$"))
 | 
					              (concat ruby-electric-simple-keywords-re "\\s-$"))
 | 
				
			||||||
	     (ruby-electric-single-keyword-in-line-re 
 | 
					             (ruby-electric-single-keyword-in-line-re 
 | 
				
			||||||
	      (concat "\\s-*" ruby-electric-keywords-re)))
 | 
					              (concat "\\s-*" ruby-electric-keywords-re)))
 | 
				
			||||||
	(save-excursion
 | 
					        (save-excursion
 | 
				
			||||||
	  (backward-word 1)
 | 
					          (backward-word 1)
 | 
				
			||||||
	  (or (looking-at ruby-electric-expandable-do-re)
 | 
					          (or (looking-at ruby-electric-expandable-do-re)
 | 
				
			||||||
	      (and (looking-at ruby-electric-keywords-re)
 | 
					              (and (looking-at ruby-electric-keywords-re)
 | 
				
			||||||
		   (not (string= "do" (match-string 1)))
 | 
					                   (not (string= "do" (match-string 1)))
 | 
				
			||||||
		   (progn
 | 
					                   (progn
 | 
				
			||||||
		     (beginning-of-line)
 | 
					                     (beginning-of-line)
 | 
				
			||||||
		     (looking-at ruby-electric-single-keyword-in-line-re))))))))
 | 
					                     (looking-at ruby-electric-single-keyword-in-line-re))))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun ruby-electric-curlies(arg)
 | 
					(defun ruby-electric-curlies(arg)
 | 
				
			||||||
| 
						 | 
					@ -165,17 +165,17 @@ strings. Note that you must have Font Lock enabled."
 | 
				
			||||||
  (self-insert-command (prefix-numeric-value arg))
 | 
					  (self-insert-command (prefix-numeric-value arg))
 | 
				
			||||||
  (if (ruby-electric-is-last-command-char-expandable-punct-p)
 | 
					  (if (ruby-electric-is-last-command-char-expandable-punct-p)
 | 
				
			||||||
      (cond ((ruby-electric-code-at-point-p)
 | 
					      (cond ((ruby-electric-code-at-point-p)
 | 
				
			||||||
	     (insert " ")
 | 
					             (insert " ")
 | 
				
			||||||
	     (save-excursion
 | 
					             (save-excursion
 | 
				
			||||||
	       (if ruby-electric-newline-before-closing-bracket
 | 
					               (if ruby-electric-newline-before-closing-bracket
 | 
				
			||||||
		   (newline))
 | 
					                   (newline))
 | 
				
			||||||
	       (insert "}")))
 | 
					               (insert "}")))
 | 
				
			||||||
	    ((ruby-electric-string-at-point-p)
 | 
					            ((ruby-electric-string-at-point-p)
 | 
				
			||||||
	     (save-excursion
 | 
					             (save-excursion
 | 
				
			||||||
	       (backward-char 1)
 | 
					               (backward-char 1)
 | 
				
			||||||
	       (when (char-equal ?\# (preceding-char))
 | 
					               (when (char-equal ?\# (preceding-char))
 | 
				
			||||||
		 (forward-char 1)
 | 
					                 (forward-char 1)
 | 
				
			||||||
		 (insert "}")))))))
 | 
					                 (insert "}")))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun ruby-electric-matching-char(arg)
 | 
					(defun ruby-electric-matching-char(arg)
 | 
				
			||||||
  (interactive "P")
 | 
					  (interactive "P")
 | 
				
			||||||
| 
						 | 
					@ -183,8 +183,8 @@ strings. Note that you must have Font Lock enabled."
 | 
				
			||||||
  (and (ruby-electric-is-last-command-char-expandable-punct-p)
 | 
					  (and (ruby-electric-is-last-command-char-expandable-punct-p)
 | 
				
			||||||
       (ruby-electric-code-at-point-p)
 | 
					       (ruby-electric-code-at-point-p)
 | 
				
			||||||
       (save-excursion
 | 
					       (save-excursion
 | 
				
			||||||
	 (insert (cdr (assoc last-command-char 
 | 
					         (insert (cdr (assoc last-command-char 
 | 
				
			||||||
			     ruby-electric-matching-delimeter-alist))))))
 | 
					                             ruby-electric-matching-delimeter-alist))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun ruby-electric-bar(arg)
 | 
					(defun ruby-electric-bar(arg)
 | 
				
			||||||
  (interactive "P")
 | 
					  (interactive "P")
 | 
				
			||||||
| 
						 | 
					@ -192,9 +192,9 @@ strings. Note that you must have Font Lock enabled."
 | 
				
			||||||
  (and (ruby-electric-is-last-command-char-expandable-punct-p)
 | 
					  (and (ruby-electric-is-last-command-char-expandable-punct-p)
 | 
				
			||||||
       (ruby-electric-code-at-point-p)
 | 
					       (ruby-electric-code-at-point-p)
 | 
				
			||||||
       (and (save-excursion (re-search-backward ruby-electric-expandable-bar nil t))
 | 
					       (and (save-excursion (re-search-backward ruby-electric-expandable-bar nil t))
 | 
				
			||||||
	    (= (point) (match-end 0))) ;looking-back is missing on XEmacs
 | 
					            (= (point) (match-end 0))) ;looking-back is missing on XEmacs
 | 
				
			||||||
       (save-excursion 
 | 
					       (save-excursion 
 | 
				
			||||||
	 (insert "|"))))
 | 
					         (insert "|"))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(provide 'ruby-electric)
 | 
					(provide 'ruby-electric)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1378
									
								
								misc/ruby-mode.el
									
										
									
									
									
								
							
							
						
						
									
										1378
									
								
								misc/ruby-mode.el
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
					@ -28,20 +28,20 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ;; Process all the complete markers in this chunk.
 | 
					    ;; Process all the complete markers in this chunk.
 | 
				
			||||||
    (while (string-match "\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
 | 
					    (while (string-match "\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n"
 | 
				
			||||||
			 gud-rubydb-marker-acc)
 | 
					                         gud-rubydb-marker-acc)
 | 
				
			||||||
      (setq
 | 
					      (setq
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       ;; Extract the frame position from the marker.
 | 
					       ;; Extract the frame position from the marker.
 | 
				
			||||||
       gud-last-frame
 | 
					       gud-last-frame
 | 
				
			||||||
       (cons (substring gud-rubydb-marker-acc (match-beginning 1) (match-end 1))
 | 
					       (cons (substring gud-rubydb-marker-acc (match-beginning 1) (match-end 1))
 | 
				
			||||||
	     (string-to-int (substring gud-rubydb-marker-acc
 | 
					             (string-to-int (substring gud-rubydb-marker-acc
 | 
				
			||||||
				       (match-beginning 2)
 | 
					                                       (match-beginning 2)
 | 
				
			||||||
				       (match-end 2))))
 | 
					                                       (match-end 2))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       ;; Append any text before the marker to the output we're going
 | 
					       ;; Append any text before the marker to the output we're going
 | 
				
			||||||
       ;; to return - we don't include the marker in this text.
 | 
					       ;; to return - we don't include the marker in this text.
 | 
				
			||||||
       output (concat output
 | 
					       output (concat output
 | 
				
			||||||
		      (substring gud-rubydb-marker-acc 0 (match-beginning 0)))
 | 
					                      (substring gud-rubydb-marker-acc 0 (match-beginning 0)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       ;; Set the accumulator to the remaining text.
 | 
					       ;; Set the accumulator to the remaining text.
 | 
				
			||||||
       gud-rubydb-marker-acc (substring gud-rubydb-marker-acc (match-end 0))))
 | 
					       gud-rubydb-marker-acc (substring gud-rubydb-marker-acc (match-end 0))))
 | 
				
			||||||
| 
						 | 
					@ -52,17 +52,17 @@
 | 
				
			||||||
    ;; know the full marker regexp above failed, it's pretty simple to
 | 
					    ;; know the full marker regexp above failed, it's pretty simple to
 | 
				
			||||||
    ;; test for marker starts.
 | 
					    ;; test for marker starts.
 | 
				
			||||||
    (if (string-match "\032.*\\'" gud-rubydb-marker-acc)
 | 
					    (if (string-match "\032.*\\'" gud-rubydb-marker-acc)
 | 
				
			||||||
	(progn
 | 
					        (progn
 | 
				
			||||||
	  ;; Everything before the potential marker start can be output.
 | 
					          ;; Everything before the potential marker start can be output.
 | 
				
			||||||
	  (setq output (concat output (substring gud-rubydb-marker-acc
 | 
					          (setq output (concat output (substring gud-rubydb-marker-acc
 | 
				
			||||||
						 0 (match-beginning 0))))
 | 
					                                                 0 (match-beginning 0))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	  ;; Everything after, we save, to combine with later input.
 | 
					          ;; Everything after, we save, to combine with later input.
 | 
				
			||||||
	  (setq gud-rubydb-marker-acc
 | 
					          (setq gud-rubydb-marker-acc
 | 
				
			||||||
		(substring gud-rubydb-marker-acc (match-beginning 0))))
 | 
					                (substring gud-rubydb-marker-acc (match-beginning 0))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      (setq output (concat output gud-rubydb-marker-acc)
 | 
					      (setq output (concat output gud-rubydb-marker-acc)
 | 
				
			||||||
	    gud-rubydb-marker-acc ""))
 | 
					            gud-rubydb-marker-acc ""))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    output))
 | 
					    output))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -83,18 +83,18 @@ The directory containing FILE becomes the initial working directory
 | 
				
			||||||
and source-file directory for your debugger."
 | 
					and source-file directory for your debugger."
 | 
				
			||||||
  (interactive
 | 
					  (interactive
 | 
				
			||||||
   (list (read-from-minibuffer "Run rubydb (like this): "
 | 
					   (list (read-from-minibuffer "Run rubydb (like this): "
 | 
				
			||||||
			       (if (consp gud-rubydb-history)
 | 
					                               (if (consp gud-rubydb-history)
 | 
				
			||||||
				   (car gud-rubydb-history)
 | 
					                                   (car gud-rubydb-history)
 | 
				
			||||||
				 (concat rubydb-command-name " "))
 | 
					                                 (concat rubydb-command-name " "))
 | 
				
			||||||
			       nil nil
 | 
					                               nil nil
 | 
				
			||||||
			       '(gud-rubydb-history . 1))))
 | 
					                               '(gud-rubydb-history . 1))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  (if (not (fboundp 'gud-overload-functions))
 | 
					  (if (not (fboundp 'gud-overload-functions))
 | 
				
			||||||
      (gud-common-init command-line 'gud-rubydb-massage-args
 | 
					      (gud-common-init command-line 'gud-rubydb-massage-args
 | 
				
			||||||
		       'gud-rubydb-marker-filter 'gud-rubydb-find-file)
 | 
					                       'gud-rubydb-marker-filter 'gud-rubydb-find-file)
 | 
				
			||||||
    (gud-overload-functions '((gud-massage-args . gud-rubydb-massage-args)
 | 
					    (gud-overload-functions '((gud-massage-args . gud-rubydb-massage-args)
 | 
				
			||||||
			      (gud-marker-filter . gud-rubydb-marker-filter)
 | 
					                              (gud-marker-filter . gud-rubydb-marker-filter)
 | 
				
			||||||
			      (gud-find-file . gud-rubydb-find-file)))
 | 
					                              (gud-find-file . gud-rubydb-find-file)))
 | 
				
			||||||
    (gud-common-init command-line rubydb-command-name))
 | 
					    (gud-common-init command-line rubydb-command-name))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  (gud-def gud-break  "b %l"         "\C-b" "Set breakpoint at current line.")
 | 
					  (gud-def gud-break  "b %l"         "\C-b" "Set breakpoint at current line.")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue