« Demo: Dynamic Law Replacement |Main| Re: 先頭から2文字ずつ取る »

« Demo: Dynamic Law Replacement | GRINEdit | GRINEditの頂点をMeadowで編集 »

MeadowからGRINEditを操作する

odz buffer - coLinux で Emacs の kill-ring の内容をWindowsのクリップボードと同期するを参考に、とりあえず試してみました。 単に選択範囲の文字列をGRINEdit上に出すだけですが。

使用前

使用後

Emacs側

(defvar GRINEDITPY "grinedit.py"
  "*The command to send query to grinedit")

(defun grinedit (beg end)
  (interactive "r")
  (call-process-region 
   beg 
   end 
   GRINEDITPY))

(define-key global-map "\C-cg" 'grinedit)
call-process-regionでgrinedit.pyを呼んでいます。 選択されたリージョンは標準入力に流し込まれているみたいでした。 環境によって違ったりするのかも知れません。EmacsLispは詳しくないので。

grinedit.py

import xmlrpclib, sys
text = sys.stdin.read()
server = xmlrpclib.Server("http://localhost:8080/RPC2")
g = server.grinedit
g.initGraph()
for line in text.split("\n"):
    g.addVertex("BoxVertex", {"label": line})
grinedit.pyは標準入力に流し込まれた文字列を改行で区切ってGRINEditにXML-RPCでクエリを投げるだけ。

合計でも20行いらなかったですね。 後は個人的にはMeadowで箇条書きを書くとGRINEdit上にマインドマップ状のものが生成されるようにしたいところです。まぁ今回試したこれが動くのなら、技術的には難しくなさそうです。

トラックバック(Trackback)

Trackback URL: http://www.nishiohirokazu.org/mt/mt-tb.cgi/437

ご意見・ご感想をお送りください(フィードバック)

(フィードバックはメールで送信され、基本的に表示されませんが、内容によっては公開させていただくこともございます。ご了承ください。Your comment doesn't appear the page immediately. If the comment has value to other people, it will be put on the page or subsequent entries. Thank you.)

上の情報は、いずれも未記入でかまいません。 All of above questions are optional.