Ruby ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«ï¼é称ããã¾ï¼ã¨ ReFe2 ãã¤ã³ã¹ãã¼ã«ã» Emacs ã§åç §ããã» anything.el ã¨ã®é£æº
[update] Ruby リファレンスマニュアルを Emacs で参照・ anything.el との連携(改訂版) - http://rubikitch.com/に移転しました
ããã¾ããªãªã¼ã¹ãããã®ã§ã¤ã³ã¹ãã¼ã«ãã¦ã¿ããããªãã®å
å®ã¶ãã«é©ãã
次ä¸ä»£ ReFe 㯠BitClust ã¨ãããã¼ã«ããã¼ã¹ã¨ãªã£ã¦ããã BitClust ã¯ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«ç¨ãã¼ã«ç¾¤ã§å°ç¨ Web ãµã¼ãã¼ãªã©ãæä¾ãã¦ããã¿ããã
ã¨ããããå±éã㦠BitClust ãã¤ã³ã¹ãã¼ã«ã
ã¤ã³ã¹ãã¼ã«
url=http://www.ruby-lang.org/ja/man/archive/ruby-refm-1.9.0-dynamic.tar.bz2 cd ~/compile; wget $url cd `basename $url .tar.bz2` cd bitclust; sudo ruby setup.rb
ReFe2 ã使ã
ReFe2 ã使ãã«ã¯ããã¼ã¿ãã¼ã¹ãæå®ããªãã¨ãããªãããã¡ãã¡æå®ããã®ãããã©ãã®ã§ãããã£ã¨ã¹ã¯ãªãããä½æã 1.8.6 㨠1.9.0 両対å¿ãªã®ã§ãå¤ãæ¹ã¨ã®å·®åãåºãããã«ãã¦ã¿ãã以ä¸ãããã£ã¦ãï¼
http://www.rubyist.net/~rubikitch/archive/refe2
#!/bin/sh cd ~/compile/ruby-refm-1.9.0-dynamic/bitclust/ old=/tmp/refm.old new=/tmp/refm.new cat <<XXXX ################################################## # ruby 1.9.0 # ################################################## XXXX ruby -Ke -Ilib bin/refe.rb -d ../db-1_9_0 "$@" | tee $new cat <<XXXX ################################################## # changes from ruby 1.8.6 # ################################################## XXXX ruby -Ke -Ilib bin/refe.rb -d ../db-1_8_6 "$@" > $old diff -u $old $new rm -f $old $new
ãã¨ãã°ã refe2 Array flatten ãã¨ããã¨ã Array#flatten ãã®èª¬æãã§ã¦ããã
################################################## # ruby 1.9.0 # ################################################## Array#flatten --- flatten(lv = nil) -> Array --- flatten!(lv = nil) -> self | nil flatten ã¯èªèº«ãå帰çã«å¹³æ»åããé åãçæãã¦è¿ãã¾ãã flatten! 㯠èªèº«ãå帰çãã¤ç ´å£çã«å¹³æ»åããå¹³æ»åãè¡ãããå ´å㯠self ãããã§ãªã å ´å㯠nil ãè¿ãã¾ãã lv ãæå®ãããå ´åã lv ã®æ·±ãã¾ã§å帰çã«å¹³æ»åãã¾ãã @param lv å¹³æ»åã®å帰ã®æ·±ããæ´æ°ã§æå®ãã¾ãã nil ãæå®ããå ´åãå帰ã®æ·±ãã®å¶éç¡ãã«å¹³æ»åãã¾ãã @raise ArgumentError é åè¦ç´ ãèªèº«ãå«ããããªç¡éã«ãã¹ãããé åã«å¯¾ã㦠flatten ãå¼ãã å ´åã«çºçãã¾ãã # èªèº«ãå帰çã«å¹³æ»åããä¾ã a = [1, [2, 3, [4], 5]] p a.flatten #=> [1, 2, 3, 4, 5] p a #=> [1, [2, 3, [4], 5]] # èªèº«ãç ´å£çã«å¹³æ»åããä¾ã a = [[[1, [2, 3]]]] p a.flatten! #=> [1, 2, 3] p a #=> [1, 2, 3] # å¹³æ»åãè¡ãããªãå ´å㯠nil ãè¿ãã p [1, 2, 3].flatten! #=> nil # å¹³æ»åã®å帰ã®æ·±ããæå®ããä¾ã a = [ 1, 2, [3, [4, 5] ] ] a.flatten(1) #=> [1, 2, 3, [4, 5]] ################################################## # changes from ruby 1.8.6 # ################################################## --- /tmp/refm.old 2007-12-28 04:07:12.735596235 +0900 +++ /tmp/refm.new 2007-12-28 04:07:12.235567620 +0900 @@ -1,11 +1,13 @@ Array#flatten ---- flatten -> Array ---- flatten! -> self | nil +--- flatten(lv = nil) -> Array +--- flatten!(lv = nil) -> self | nil flatten ã¯èªèº«ãå帰çã«å¹³æ»åããé åãçæãã¦è¿ãã¾ãã flatten! 㯠èªèº«ãå帰çãã¤ç ´å£çã«å¹³æ»åããå¹³æ»åãè¡ãããå ´å㯠self ãããã§ãªã å ´å㯠nil ãè¿ãã¾ãã +lv ãæå®ãããå ´åã lv ã®æ·±ãã¾ã§å帰çã«å¹³æ»åãã¾ãã +@param lv å¹³æ»åã®å帰ã®æ·±ããæ´æ°ã§æå®ãã¾ãã nil ãæå®ããå ´åãå帰ã®æ·±ãã®å¶éç¡ãã«å¹³æ»åãã¾ãã @raise ArgumentError é åè¦ç´ ãèªèº«ãå«ããããªç¡éã«ãã¹ãããé åã«å¯¾ã㦠flatten ãå¼ãã å ´åã«çºçãã¾ãã @@ -21,4 +23,8 @@ # å¹³æ»åãè¡ãããªãå ´å㯠nil ãè¿ãã p [1, 2, 3].flatten! #=> nil + + # å¹³æ»åã®å帰ã®æ·±ããæå®ããä¾ã + a = [ 1, 2, [3, [4, 5] ] ] + a.flatten(1) #=> [1, 2, 3, [4, 5]]
ã¯ã©ã¹åã»ã¡ã½ããåã®ç®æ¬¡ãä½æããã
bitclust ã³ãã³ãã§ã¯ã©ã¹åãã¡ã½ããåããªã¹ããããã¨ãã§ãããå ¨ãªã¹ããä¿åãã¦ããã
cd ~/compile/ruby-refm-1.9.0-dynamic/bitclust/ (ruby -Ke -Ilib bin/bitclust.rb --database ../db-1_9_0 list --class; ruby -Ke -Ilib bin/bitclust.rb --database ../db-1_9_0 list --method) > refe2.index
ããã¦ã Emacs ã§ä½¿ãããã« S å¼ã«ãã¦ããã
ruby -ne 'print "# (refe2 \"",$_.chomp,"\")\n"' refe2.index > refe2.e
ãã¡ãããä½æãããã®ãç½®ãã¦ããããä½æ¥ãé¢åãªäººã¯ãã£ã¦ãï¼
http://www.rubyist.net/~rubikitch/archive/refe2.e
Emacs ã§ä½¿ãã
Emacs ã§ä½¿ãããã«ãããã£ã¨ refe2 é¢æ°ãä½æã
refe2.e ãéãã¦ãè¦ããããã¥ã¡ã³ãã® S å¼ãæå®ã㦠C-e C-x C-e ããã°ãããã¥ã¡ã³ãããããã¢ããããããã¡ãã対話çã«ã使ããã
(defun refe2 (kw) (interactive "sReFe2: ") (let ((coding-system-for-read 'euc-japan)) (with-current-buffer (get-buffer-create (concat "*refe2:" kw "*")) (when (zerop (buffer-size)) (call-process "refe2" nil t t kw) (diff-mode)) (setq minibuffer-scroll-window (get-buffer-window (current-buffer) t)) (goto-char (point-min)) (display-buffer (current-buffer)))))
anything.el ã¨ã®é£æº
俺㯠anything ã®ç±ççã¦ã¼ã¶ã¼ãªã®ã§ anything ã§çµãè¾¼ã¿æ¤ç´¢ã§ããªãã¨æ°ããã¾ãªãã以ä¸ã®è¨å®ã§ä½¿ããããã«ãªãã refe2.e ã¯ãã®ããã«ä½ã£ãã®ã ã
(defun anything-c-source-static-escript (symbol desc filename &rest other-attrib) `((name . ,desc) (candidates . ,symbol) ,@other-attrib (init . (lambda () (unless (and (boundp ',symbol) ,symbol) (with-current-buffer (find-file-noselect ,filename) (setq ,symbol (split-string (buffer-string) "\n" t)))))) (action ("Eval it" . (lambda (cand) (with-temp-buffer (insert cand) (cd ,(file-name-directory filename)) (backward-sexp 1) (eval (read (current-buffer))))))))) (setq anything-c-source-refe2 (anything-c-source-static-escript 'anything-c-refe2-candidates "ReFe2" "~/compile/ruby-refm-1.9.0-dynamic/bitclust/refe2.e" '(requires-pattern . 3))) (setq anything-sources (list anything-c-source-refe2)) --><
ãã¡ãã anything-sources ã¯åèªå¥½ããªããã«è¨å®ãã¦ããã
ããã ãããããã®è¦ç´ ãããã®ã«ãåä½ã¯ããªãéããã langhelp ã® Emacs ã¤ã³ã¿ã¼ãã§ã¼ã¹é¨åã anything ã§ç½®ãæãããããªâ¦ããããã anything ã®ãããªãã®ã欲ãã㦠langhelp ãä½ã£ããã ããã
追è¨
refe2 ã³ãã³ãã¯ãå¤ããã¼ã¸ã§ã³ã¨ã® diff ãåãããã«ãããããã«ä¼´ã refe2 ãããã¡ã¯ diff-mode ã«ã