--- diclookup-mule-2.3.4/diclookup-mule.el~ 2002-09-21 08:11:01 +0000 +++ diclookup-mule-2.3.4/diclookup-mule.el 2011-04-21 07:03:24 +0000 @@ -143,6 +143,10 @@ (require 'outline) (require 'ndtp) +(eval-when-compile + (if (fboundp 'char-bytes) nil + (defmacro char-bytes (char) 1))) + ;; Please customize the following variables for your local site. (defvar dserver-server-list '("dserver" "localhost") @@ -457,6 +461,22 @@ "*Define the dictionary selected when invoking online-dictionary.") (defvar od-default-jisyo-ispell od-default-jisyo-english "*Dictionary used when looking up a word with ispell.") +(defvar od-default-jisyo-alias-alist nil + "*Alist of aliases and real dictionary names that ndtpd recognizes. +If you use a new ndtp server that ebnetd provides (it doesn't support +alias-eiwa, alias-waei, and alias-kojien), you have to set it as: + +\(setq od-default-jisyo-alias-alist + '((\"eiwa\" . \"shin_eiwa_waei_tyujiten/eiwa\") + (\"waei\" . \"shin_eiwa_waei_tyujiten/waei\") + (\"kojien\" . \"kojien/koujien\") + (\"kojien-furoku\" . \"kojien/furoku\"))) + +To see the real dictionary names, connect to ndtpd using telnet like: + +telnet ndtp-server ndtp-port + +And type `t' (`Q' to quit).") ;;; Variables and functions which absorb some differences between Mule @@ -480,7 +500,7 @@ (set-buffer-multibyte nil) (insert (ccl-execute-on-string ccl-prog status str contin t)) (goto-char (point-min)) - (let (comp-bytepos-list comp-start case-fold-search) + (let (comp-bytepos-list comp-start comp-end str case-fold-search) (while (search-forward "\200" nil t) (delete-char -1) (setq comp-start (point)) @@ -500,11 +520,25 @@ (forward-char bytes))))) (setq comp-bytepos-list (cons (cons comp-start (point)) comp-bytepos-list))) + (setq comp-bytepos-list (nreverse comp-bytepos-list)) + (setq str (buffer-string)) + (erase-buffer) (set-buffer-multibyte t) + (setq comp-end 0) (while comp-bytepos-list - (compose-region (byte-to-position (car (car comp-bytepos-list))) - (byte-to-position (cdr (car comp-bytepos-list)))) + (setq comp-start (1- (car (car comp-bytepos-list)))) + (insert (decode-coding-string + (substring str comp-end comp-start) 'emacs-mule)) + (setq comp-end (1- (cdr (car comp-bytepos-list)))) + (compose-region (point) + (progn + (insert (decode-coding-string + (substring str comp-start comp-end) + 'emacs-mule)) + (point))) (setq comp-bytepos-list (cdr comp-bytepos-list))) + (insert (decode-coding-string + (substring str comp-end) 'emacs-mule)) (buffer-string)))))))) (defalias 'od-make-char @@ -542,6 +576,9 @@ 'string-bytes 'length)) +(defalias 'od-sref + (if (fboundp 'sref) 'sref 'aref)) + ;;;(defmacro od-char-ascii-p (char) ;;; (if (fboundp 'char-leading-char) ;;; (` (= (char-leading-char (, char)) 0)) @@ -1252,7 +1289,11 @@ (setq dict (car dict-list)) (if dict (if (string= (ndtp-command-result - (ndtp-get-dictionary dict new-dic)) + (ndtp-get-dictionary + dict + (or (cdr (assoc new-dic + od-default-jisyo-alias-alist)) + new-dic))) "$*") (setq new-dict dict dserver-current-server (car dserver-list) @@ -1377,7 +1418,7 @@ (let ((bytes (od-string-bytes pat)) (i 0) kana alpha kanji first char-list) (while (< i bytes) - (let ((c (sref pat i))) + (let ((c (od-sref pat i))) (setq char-list (cons (cond ((or (= ?* c) (= ?* c)) @@ -2231,7 +2272,10 @@ (and od-dict-compute-fill-prefix-func (funcall od-dict-compute-fill-prefix-func)))) (fill-region-as-paragraph (point) end justify-flag)) - (goto-char end)))))) + (goto-char end)))) + (goto-char (point-min)) + (while (search-forward "\n" nil t) + (set-text-properties (1- (point)) (point) nil)))) (defun od-insert-frames (fno &optional ofs double-stop) (let* ((ticket (od-request-frame fno))