Browse Source

do not query same word twice

pull/1/head
10sr 10 years ago
parent
commit
c800851662
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      emacs.el

+ 8
- 0
emacs.el View File

@@ -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


Loading…
Cancel
Save