From c800851662913bf644c29d6fd6d3099f0d50a1be Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 18 Jan 2014 22:19:01 +0900 Subject: [PATCH] do not query same word twice --- emacs.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/emacs.el b/emacs.el index 8cc8d9b..17266ac 100644 --- a/emacs.el +++ b/emacs.el @@ -2388,6 +2388,7 @@ Freeze current input and show next prompt." (defvar isdcv-sdcv-command "sdcv -n '%s'" "Command of sdcv.") +(setq isdcv-sdcv-command "sdcv -n -u jmdict-en-ja '%s'") (defvar isdcv-buffer nil "Pointer to incremental sdcv buffer.") @@ -2395,6 +2396,9 @@ Freeze current input and show next prompt." (defvar isdcv--timer nil "Idle timer object for isdcv.") +(defvar isdcv--last-input nil + "Last input queryed.") + (defun isdcv--timer-add () "Entry idle timer for isdcv." (and (eq isdcv-buffer @@ -2440,12 +2444,16 @@ This function insert newline if required." (let ((input (isdcv--get-input)) (outpoint (isdcv--get-output-start))) (and input + ;; do not query same word twice + (not (eq isdcv--last-input + input)) outpoint isdcv-sdcv-command (save-excursion (goto-char outpoint) (delete-region (point) (point-max)) + (setq isdcv--last-input input) (call-process-shell-command (format isdcv-sdcv-command input) nil