[Date Prev] [Date Index] [Date Next]
[Thread Prev] [Thread Index] [Thread Next]

[xyzzy:01238] 辞書引きマクロ



亀井さん、みなさんさん、こんにちは。suda@SOHO です。

今回はちょっと傑作ですよ。
9,800 円のシェアウエアにしようかな。
(じょーだんだってば)

xyzzy の edict が必要です。
edict.l も必要です。
あと、xyzzy も(^^;

マウスの左ダブルクリックで word を範囲指定するか、
左プレスあんどドラッグで範囲指定してから、S-左ボタン
で、単語の意味がポップアップします。

仕事がなくてひまだー。
求お金になる翻訳!
よろしくm(__)m
---------------------------------------------
(require 'edict)

(defvar *dictionary-popup-menu* nil)

(setq *dictionary-popup-menu* (create-popup-menu nil))

(defun edict-popup ()
  (interactive)
  (delete-menu *dictionary-popup-menu* 'edict)
  (set-window *last-mouse-window*)
  (continue-pre-selection)
  (let ((string (edict-lookup-selection #'lookup-e2j-dictionary-and-popup)))
    (add-menu-item *dictionary-popup-menu* 'edict
		   string
		   #'(lambda ()
		       (interactive)
		       (insert string))))
  (track-popup-menu *dictionary-popup-menu*))

(defun lookup-e2j-dictionary-and-popup (from to)
  (interactive "r")
  (edict-lookup-dictionary-and-popup from to "xyzzye2j" nil))

(defun edict-lookup-dictionary-and-popup (from to dic dic2)
  (let* ((s (buffer-substring from to))
	 (r (lookup-dictionary *edict-dictionary-path* "xyzzydic" dic s)))
    (unless r
      (plain-error "登録されていません: ~A" s))
    (write-to-string
      (long-operation
	(if dic2
	    (dolist (x (sort r #'string<))
	      (format nil "  ~{~A~^,~}~%~%"
		      (lookup-dictionary *edict-dictionary-path* "xyzzydic" dic2 x)))
	  (format nil "  ~{~A~^,~}~%" r))))))

(global-set-key #\S-LBtnDown 'edict-popup)
------------------------------------------------------------

ポップアップしたところに " " と ・のごみが出るのですが、
どうすればきれいになりますか? > 亀井さん

-------- 
須田誠也
EZU11330@xxxxxxxxxxx

Index Home