好ããªã¨ãã£ã¿ã§Firefoxã«å ¥å
ãããããã¨
ãã©ã¦ã¶ã®å ¥åã¨ãªã¢ã¯ã¨ã¦ã貧弱ã§, ã¨ãã«æ®æ®µããEmacsã®ãããªé«æ©è½ã¨ãã£ã¿ã使ã£ã¦ããã, Emacsã®ãããªé«æ©è½ã¨ãã£ã¿ã®viã¨ãã¥ã¬ã¼ã·ã§ã³ã¢ã¼ãã使ã£ã¦ããããããããªå¤æ ããã«ã¨ã£ã¦, ããã¯èãé£ãè¦ç.
JavaScriptãé å¼µã£ã¦æ¸ãã¦å ¥åã¨ãªã¢ãã®ãã®ãå¼·åãããã¨ãèããããããã©, ã³ã¹ãã大ãã. ãªã«ãç°¡åãªæ¹æ³ã§, å¤é¨ã®ã¨ãã£ã¿ã¨ãã©ã¦ã¶ã®éã§ããã¨ãããããããªããã®æ¹ã楽. ãããå®ç¾ãã¦ã¿ã, ã¨ããã話.
å ·ä½çã«ã¯, ãã決ãããããã¡ã¤ã«ã«ä½ãæ¸ãè¾¼ãã¨, ããããã©ã¦ã¶ã®ã¢ã¯ãã£ããªå ¥åã¨ãªã¢ã«æ¸ãè¾¼ã¾ãã, ã¨ãããã¨ãå®ç¾ãã.
ããæ¹
ã¾ãã¯é°å²æ°ãã¤ããããã«ãã¢åç»ãè¦ã¦ã¿ãã.
Windowsã®äºº
åç»ã®éãã«ããã ãã§ä½¿ãã.
- Firefoxã¨Greasemonkeyãã¤ã³ã¹ãã¼ã«
- Windows用のインストーラããã¦ã³ãã¼ããã¦ã¤ã³ã¹ãã¼ã«
- Greasemonkey用のユーザスクリプトãã¤ã³ã¹ãã¼ã«
- ãã¹ã¯ãããã®ãããã¹ããç·¨éãã·ã§ã¼ãã«ããã好ããªã¨ãã£ã¿ã§éã
Windows以å¤(Linuxã¨ã)ã®äºº
詳細ã¯GitHubのリポジトリãåç §.
ã¤ã³ã¹ãã¼ã«
git clone git://github.com/tarao/textserver.git cd textserver git submodule update --init mkdir some-dir echo ':dir: absolute-path-to-some-dir' > textserver.yml
ã§ãªãã¸ããªã®ã³ãã¼ã¨å¿ è¦ãªã¢ã¸ã¥ã¼ã«ãå ¥ã.
Debianç³»ã®äººã¯ããã§
sudo aptitude install libinotify-ruby
ãã¦ããã¨å°ã幸ãã«ãªã(ããããªãã¨100ããªç§ãã¨ã«ãã¡ã¤ã«ã®æ´æ°ç¢ºèªãããã®ã§éå¹çç, 詳細ã¯æè¡çãªè©±ãåç §).
èµ·å
ruby textserver.rb -c textserver.yml
ã¨ããã¨ãã¼ã¢ã³ãèµ·å. ãã¨ã¯Firefoxã«Greasemonkey用のユーザスクリプトãã¤ã³ã¹ãã¼ã«ããã°ä½¿ããããã«ãªã. å ·ä½çã«ã¯, some-dir/text ã¨ãããã¡ã¤ã«(ãã¼ã¢ã³ãåããã¨åæã«ã§ããã¯ã)ãç·¨éãã¦ä¿åããã¨ãã©ã¦ã¶ã®å ¥åã¨ãªã¢ã«æ¸ãè¾¼ã¾ããããã«ãªã.
åæ¢
ãã¼ã¢ã³ãæ¢ããã¨ãã¯
ruby textserver.rb -c textserver.yml --stop
ã¨ãã.
é«åº¦ãªè¨å®
.ymlã«è¨å®å¯è½ãªé ç®ã¨ããã©ã«ãå¤ã¯ä»¥ä¸ã®éã.
:dir: /tmp/textserver :text: text :reset: reset :lock: lock :pid: /tmp/textserver/textserver.pid :logfile: /dev/stdout :loglevel: 0 :server: :BindAddress: 127.0.0.1 :Port: 18080
å¥ã®ãã¹ãã§ãã©ã¦ã¶ãåããå ´åã¯:BindAddressã0.0.0.0ã«ãã¦, ãã¼ã¢ã³ã®åãã¦ãããã¹ãã®ååhostnameã, Firefoxã®ãããã¡ã¤ã«ãã£ã¬ã¯ããªã«ããprefs.jsã«
user_pref("greasemonkey.scriptvals.http://orezdnu.org//retrieve-remote-text.TextServer:host", "hostname");
ã¨æ¸ãå ãã¦è¨å®ãã.
ããã©ã«ã以å¤(ãã¨ãã°3000)ã®å¤ã:Portã«è¨å®ããã¨ãã, prefs.jsã«
user_pref("greasemonkey.scriptvals.http://orezdnu.org//retrieve-remote-text.TextServer:textPort", 3000);
ã¨æ¸ãå ãã¦è¨å®ãã. å®ã¯ããã©ã«ãè¨å®ã®å ´åã18080çªã¨18081çªã®2ã¤ã使ã£ã¦ããã®ã§, 2ã¤é£ç¶ã§ç©ºãã¦ãããã¼ããæå®ãããã¨.
Emacsã¨ã®é£æº
Emacs用のパッケージãload-pathã®ã©ããã«ç½®ãã¦, .emacsã«
(require 'textarea) (setq textarea:dir "absolute-path-to-some-dir")
ã¨æ¸ãã¦ããã¨, M-x textarea
ã§some-dir/textã*textarea*ãããã¡ã¨ãã¦éããã¨ãã§ãã. ãã®ãããã¡ã¯æ°ç§ã§èªåä¿åããã. ããã«, M-x revert-buffer
ã§ãã©ã¦ã¶ã®å
¥åã¨ãªã¢ã®å
容ããããã¡ã«éæµããããã¨ãã§ãã. ããã¯ããã!
æè¡çãªè©±
åºæ¬çãªä»çµã¿
ãã¼ã¢ã³ã¯ããã¹ããã¡ã¤ã«ãç£è¦ãã¦ãã¦, ãã¡ã¤ã«ã«å¤æ´ããã£ãããã©ã¦ã¶å´ã«ãã®å 容ãéç¥ããã¨ããã ã.
HTTP long polling
ä»çµã¿ã®ä¸ã§ã¯ãã©ã¦ã¶ããµã¼ãã§, ãã¡ã¤ã«ã«æ¸ãè¾¼ãã å´ãã¯ã©ã¤ã¢ã³ãã«ãªãããã©, å®è£ ä¸ã¯ãã¡ã¤ã«ã®å¤æ´ãç£è¦ãã¦ãããã¼ã¢ã³ããµã¼ãã§, ãã®ãã¼ã¢ã³ã«å¯¾ãã¦XMLHttpRequestãããã©ã¦ã¶å´ãã¯ã©ã¤ã¢ã³ãã«ãªã. ããã§, ãã¡ã¤ã«ã«å¤æ´ããªãéã¯ãã¼ã¢ã³å´ãã¬ã¹ãã³ã¹ãè¿ããªãããã«ãããã¨ã§, ãã¼ã¢ã³å´ã®é½åã§ãã¼ã¿ã®æµããã¿ã¤ãã³ã°ãå¶å¾¡ãã¦ãã. ããããHTTP long polling.
ãã¡ã¤ã«ã®ç£è¦
ãã¡ã¤ã«ã®ç£è¦ãããã®ã«, ç¡éã«ã¼ããã¦æ°ããªç§ãã¨ã«ãã¡ã¤ã«ã®æçµæ´æ°æ¥æã調ã¹ããããªå®è£ ã¯ãªãã ããã¢ã. Windowsã®å ´åã¯win32-changenotifyã使ã£ã¦ãã¡ã¤ã«ã®æ´æ°ãã§ãã¯ãOSã«ä»»ãã¦ãã¾ã£ã¦, æ´æ°ãããã¾ã§OSããå¶å¾¡ãè¿ã£ã¦ããªãããã«ãã¦ãã. libinotify-rubyãå ¥ãã¦ããã¨, Linuxã®å ´åã«ãinotifyã¨ããã«ã¼ãã«ã®ãµãã·ã¹ãã ã使ã£ã¦ä¼¼ããããªæåãããããã«ãªã.
追è¨
It's All Text!ã¨ã®éã
textserverã§ã§ãã¦It's All Text!ã§ã§ããªããã¨:
- ãã¼ãã¼ãã ãã§ç·¨éãã
- æ¢ã«èµ·åãã¦ããã¨ãã£ã¿ã§ç·¨éãã
- å ¥åã¨ãªã¢ã§çºçããå¤æ´ãä»»æã®ã¿ã¤ãã³ã°ã§ã¨ãã£ã¿ã«éæµãã
- ãã©ã¦ã¶ã¨ã¯å¥ã®ãã¹ãã§åãã¦ããã¨ãã£ã¿ã§ç·¨éãã
2013-01-20T16:50+0000
- Emacsç¨ã®ããã±ã¼ã¸ãæ¸ãç´ããã®ã§è¨å®æ¹æ³ãä¿®æ£