[#19011] open-uri - very easy net access library — Tanaka Akira <akr@...17n.org>

HTTP, FTP に簡単にアクセスするための open-uri というライブラリを作って

19 messages 2002/12/06

[#19066] ruby 1.6.9 preview4 予告 — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

41 messages 2002/12/13
[#19079] Re: ruby 1.6.9 preview4 予告 — "Akinori MUSHA" <knu@...> 2002/12/16

At Fri, 13 Dec 2002 15:28:47 +0900,

[#19086] Re: ruby 1.6.9 preview4 予告 — UENO Katsuhiro <unnie@...> 2002/12/17

うえのです。

[#19087] Re: ruby 1.6.9 preview4 予告 — matz@... (Yukihiro Matsumoto) 2002/12/17

まつもと ゆきひろです

[#19083] Re: [ruby-cvs] ruby: * file.c (utimbuf): need to define for VC++. — WATANABE Hirofumi <eban@...>

わたなべです。

11 messages 2002/12/16

[#19127] Re: 1.6.8-preview4 build failed (on Vine Linux 2.1.5) (PR#373) — nobu.nakada@...

なかだです。

16 messages 2002/12/19
[#19129] Re: 1.6.8-preview4 build failed (on Vine Linux 2.1.5) (PR#373) — WATANABE Hirofumi <eban@...> 2002/12/19

わたなべです。

[#19198] ruby-1.8.0 / yield(nil)とyield()のちがい — m_seki@...

38 messages 2002/12/25
[#19209] Re: ruby-1.8.0 / yield(nil)とyield()のちがい — matz@... (Yukihiro Matsumoto) 2002/12/27

まつもと ゆきひろです

[#19218] Re: ruby-1.8.0 / yield(nil)とyield()のちがい — m_seki@... 2002/12/27

[#19219] Re: ruby-1.8.0 / yield(nil)とyield()のちがい — matz@... (Yukihiro Matsumoto) 2002/12/27

まつもと ゆきひろです

[#19264] Re: ruby-1.8.0 / yield(nil)とyield()のちがい — matz@... (Yukihiro Matsumoto) 2003/01/01

まつもと ゆきひろです

[#19266] Re: ruby-1.8.0 / yield(nil)とyield()のちがい — Tanaka Akira <akr@...17n.org> 2003/01/01

In article <1041383157.631472.21307.nullmailer@picachu.netlab.jp>,

[#19271] Re: ruby-1.8.0 / yield(nil)とyield()のちがい — matz@... (Yukihiro Matsumoto) 2003/01/01

まつもと ゆきひろです

[#19272] Re: ruby-1.8.0 / yield(nil)とyield()のちがい — Tanaka Akira <akr@...17n.org> 2003/01/01

In article <1041394108.920587.21729.nullmailer@picachu.netlab.jp>,

[#19276] Re: ruby-1.8.0 / yield(nil)とyield()のちがい — matz@... (Yukihiro Matsumoto) 2003/01/01

まつもと ゆきひろです

[#19278] Re: ruby-1.8.0 / yield(nil)とyield()のちがい — Tanaka Akira <akr@...17n.org> 2003/01/01

In article <1041420724.492653.22355.nullmailer@picachu.netlab.jp>,

[ruby-dev:19163] [PATCH] ruby-{forward,backward}-sexp

From: nobu.nakada@...
Date: 2002-12-22 00:15:09 UTC
List: ruby-dev #19163
なかだです。

ruby-modeにforward-sexpとbackward-sexpを追加してみました。一応
Emacs 21.1.1とXEmacs 21.4.6で動くことは確認しましたが、なんだか
結構動作が違う感じ。


Index: ruby-mode.el
===================================================================
RCS file: /cvs/ruby/src/ruby/misc/ruby-mode.el,v
retrieving revision 1.61
diff -u -2 -p -r1.61 ruby-mode.el
--- ruby-mode.el	20 Dec 2002 22:27:30 -0000	1.61
+++ ruby-mode.el	22 Dec 2002 00:10:39 -0000
@@ -80,6 +80,6 @@
   (define-key ruby-mode-map "\e\C-a" 'ruby-beginning-of-defun)
   (define-key ruby-mode-map "\e\C-e" 'ruby-end-of-defun)
-  (define-key ruby-mode-map "\e\C-b" 'ruby-beginning-of-block)
-  (define-key ruby-mode-map "\e\C-f" 'ruby-end-of-block)
+  (define-key ruby-mode-map "\e\C-b" 'ruby-backward-sexp)
+  (define-key ruby-mode-map "\e\C-f" 'ruby-forward-sexp)
   (define-key ruby-mode-map "\e\C-p" 'ruby-beginning-of-block)
   (define-key ruby-mode-map "\e\C-n" 'ruby-end-of-block)
@@ -133,5 +133,5 @@ Also ignores spaces after parenthesis wh
 (eval-when-compile (require 'cl))
 (defun ruby-imenu-create-index-in-block (prefix beg end)
-  (let ((index-alist '()) (nest '()) (case-fold-search nil)
+  (let ((index-alist '()) (case-fold-search nil)
 	name next pos decl sing)
     (goto-char beg)
@@ -307,5 +307,5 @@ The variable ruby-indent-level controls 
     (cond ((zerop n))
 	  (no-error nil)
-	  (error "unterminated string"))))
+	  ((error "unterminated string")))))
 
 (defun ruby-parse-partial (&optional end in-string nest depth pcol indent)
@@ -531,6 +531,5 @@ The variable ruby-indent-level controls 
 	  (goto-char (cdr (nth 1 state)))
 	  (if (and (eq (car (nth 1 state)) ?\( ) ruby-deep-arglist)
-	      (let ((column (current-column))
-		    (s (ruby-parse-region (point) indent-point)))
+	      (let ((s (ruby-parse-region (point) indent-point)))
 		(cond
 		 ((and (nth 2 s) (> (nth 2 s) 0))
@@ -648,5 +647,15 @@ The variable ruby-indent-level controls 
   (ruby-indent-line t))
 
-(defun ruby-beginning-of-defun (&optional arg)
+(eval-when-compile
+  (defmacro defun-region-command (func args &rest body)
+    (let ((intr (car body)))
+      (when (featurep 'xemacs)
+	(if (stringp intr) (setq intr (cadr body)))
+	(and (eq (car intr) 'interactive)
+	     (setq intr (cdr intr))
+	     (setcar intr (concat "_" (car intr)))))
+      (cons 'defun (cons func (cons args body))))))
+
+(defun-region-command ruby-beginning-of-defun (&optional arg)
   "Move backward to next beginning-of-defun.
 With argument, do this that many times.
@@ -664,5 +673,5 @@ Returns t unless search stops due to end
 	 t)))
 
-(defun ruby-end-of-defun (&optional arg)
+(defun-region-command ruby-end-of-defun (&optional arg)
   "Move forward to next end of defun.
 An end of a defun is found by moving forward from the beginning of one."
@@ -702,13 +711,76 @@ An end of a defun is found by moving for
   (back-to-indentation))
 
-(defun ruby-beginning-of-block ()
+(defun-region-command ruby-beginning-of-block (&optional arg)
   "Move backward to next beginning-of-block"
-  (interactive)
-  (ruby-move-to-block -1))
+  (interactive "p")
+  (ruby-move-to-block (- (or arg 1))))
 
-(defun ruby-end-of-block ()
+(defun-region-command ruby-end-of-block (&optional arg)
   "Move forward to next beginning-of-block"
-  (interactive)
-  (ruby-move-to-block 1))
+  (interactive "p")
+  (ruby-move-to-block (or arg 1)))
+
+(defun-region-command ruby-forward-sexp (&optional cnt)
+  (interactive "p")
+  (if (< cnt 0)
+      (ruby-backward-sexp (- cnt))
+    (dotimes (i cnt)
+      (skip-chars-forward " \n,.:;|&^~=!?\\+\\-\\*")
+      (cond ((looking-at "\\s(")
+	     (goto-char (scan-sexps (point) 1)))
+	    ((looking-at ruby-block-beg-re)
+	     (ruby-end-of-block)
+	     (forward-word 1))
+	    ((looking-at "\\(\\$\\|@@?\\)?\\sw")
+	     (while (progn
+		      (while (progn (forward-word 1) (looking-at "_")))
+		      (cond ((looking-at "::") (forward-char 2) t)
+			    ((> (skip-chars-forward ".") 0))
+			    ((looking-at "\\?\\|!\\(=[~=>]\\|[^~=]\\)")
+			     (forward-char 1) nil)))))
+	    ((let (state expr)
+	       (while
+		   (progn
+		     (setq expr (or expr (ruby-expr-beg)
+				    (looking-at "%\\sw?\\Sw\\|[\"'`/]")))
+		     (nth 1 (setq state (apply 'ruby-parse-partial nil state))))
+		 (setq expr t)
+		 (skip-chars-forward "<"))
+	       (not expr)))))))
+
+(defun-region-command ruby-backward-sexp (&optional cnt)
+  (interactive "p")
+  (dotimes (i (or cnt 1))
+    (skip-chars-backward " \n,.:;|&^~=!?\\+\\-\\*")
+    (forward-char -1)
+    (cond ((looking-at "\\s)")
+	   (goto-char (scan-sexps (1+ (point)) -1))
+	   (case (char-before)
+	     (?% (forward-char -1))
+	     ('(?q ?Q ?w ?W ?r ?x)
+	      (if (eq (char-before (1- (point))) ?%) (forward-char -2))))
+	   nil)
+	  ((looking-at "\\s\"\\|\\\\\\S_")
+	   (let ((c (char-to-string (char-before (match-end 0)))))
+	     (while (and (search-backward c)
+			 (oddp (skip-chars-backward "\\")))))
+	   nil)
+	  ((looking-at "\\s.\\|\\s\\"))
+	  ((looking-at "\\s(") nil)
+	  (t
+	   (forward-char 1)
+	   (while (progn (forward-word -1)
+			 (case (char-before)
+			   (?_ t)
+			   (?. (forward-char -1) t)
+			   ((?$ ?@)
+			    (forward-char -1)
+			    (and (eq (char-before) (char-after)) (forward-char -1)))
+			   (?:
+			    (forward-char -1)
+			    (eq (char-before) :)))))
+	   (if (looking-at ruby-block-end-re)
+	       (ruby-beginning-of-block))
+	   nil))))
 
 (defun ruby-reindent-then-newline-and-indent ()


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread

Prev Next