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'" (defvar isdcv-sdcv-command "sdcv -n '%s'"
"Command of sdcv.") "Command of sdcv.")
(setq isdcv-sdcv-command "sdcv -n -u jmdict-en-ja '%s'")


(defvar isdcv-buffer nil (defvar isdcv-buffer nil
"Pointer to incremental sdcv buffer.") "Pointer to incremental sdcv buffer.")
@@ -2395,6 +2396,9 @@ Freeze current input and show next prompt."
(defvar isdcv--timer nil (defvar isdcv--timer nil
"Idle timer object for isdcv.") "Idle timer object for isdcv.")


(defvar isdcv--last-input nil
"Last input queryed.")

(defun isdcv--timer-add () (defun isdcv--timer-add ()
"Entry idle timer for isdcv." "Entry idle timer for isdcv."
(and (eq isdcv-buffer (and (eq isdcv-buffer
@@ -2440,12 +2444,16 @@ This function insert newline if required."
(let ((input (isdcv--get-input)) (let ((input (isdcv--get-input))
(outpoint (isdcv--get-output-start))) (outpoint (isdcv--get-output-start)))
(and input (and input
;; do not query same word twice
(not (eq isdcv--last-input
input))
outpoint outpoint
isdcv-sdcv-command isdcv-sdcv-command
(save-excursion (save-excursion
(goto-char outpoint) (goto-char outpoint)
(delete-region (point) (delete-region (point)
(point-max)) (point-max))
(setq isdcv--last-input input)
(call-process-shell-command (format isdcv-sdcv-command (call-process-shell-command (format isdcv-sdcv-command
input) input)
nil nil


Loading…
Cancel
Save