SKKの単語登録まで待たされる問題を解決

SKKで単語登録するまでに時間がかかりすぎる。2秒とか待たされる。

http://mail.ring.gr.jp/skk/200704/msg00007.html

http://mail.ring.gr.jp/skk/200704/msg00014.html

どういう副作用があるのかわかってないですが (accept-process-output (get-buffer-process (current-buffer))) のようにプロセスを限定すると1回の応答待ちになりました。

だからskk-search-server-1を再定義する。

(defun skk-search-server-1 (file limit)
  "skk-search-server のサブルーチン。"
  (let ((key
	 (if skk-use-numeric-conversion
	     (skk-num-compute-henkan-key skk-henkan-key)
	   skk-henkan-key))
	;; バッファローカル値の受け渡しのため、別名の一時変数に取る。
	(okurigana (or skk-henkan-okurigana
		       skk-okuri-char)))
    (cond
     ((skk-server-live-p (skk-open-server))
      (with-current-buffer skkserv-working-buffer
	(let ((cont t)
	      (count 0)
	      l)
	  (erase-buffer)
	  (process-send-string skkserv-process (concat "1" key " "))
	  (while (and cont (skk-server-live-p))
	    (accept-process-output skkserv-process)
	    (setq count (1+ count))
	    (when (> (buffer-size) 0)
	      (if (eq (char-after 1) ?1) ;?1
		  ;; found key successfully, so check if a whole line
		  ;; is received.
		  (when (eq (char-after (1- (point-max)))
			    ?\n) ;?\n
		    (setq cont nil))
		;; not found or error, so exit
		(setq cont nil))))
	  (goto-char (point-min))
	  (when skk-server-report-response
	    (skk-message "%d 回 SKK サーバーの応答待ちをしました"
			 "Waited for server response %d times"
			 count))
	  (when (eq (following-char) ?1) ;?1
	    (forward-char 2)
	    (setq l (skk-compute-henkan-lists okurigana))
	    (when l
	      (cond ((and okurigana
			  skk-henkan-okuri-strictly)
		     ;; 送り仮名が同一のエントリのみを返す。
		     (nth 2 l))
		    ((and okurigana
			  skk-henkan-strict-okuri-precedence)
		     (skk-nunion (nth 2 l) (car l)))
		    (t
		     (car l))))))))
     (t
      ;; server is not active, so search file instead
      (skk-search-jisyo-file file limit)))))
(byte-compile 'skk-search-server-1)