Skip to content

Instantly share code, notes, and snippets.

@yoshinari-nomura
Created October 19, 2011 02:18
Show Gist options
  • Save yoshinari-nomura/1297331 to your computer and use it in GitHub Desktop.
Save yoshinari-nomura/1297331 to your computer and use it in GitHub Desktop.
(add-private-load-path "auto-complete")
(require 'popup)
(defun dic-at-point ()
(interactive)
(let* ((word (word-at-point))
(desc (and word (shell-command-to-string (format "dic '%s'" word)))))
(when (and desc (null popup-instances))
(popup-tip desc :margin t))))
(defvar dic-timer nil)
(defvar dic-delay 1.0)
(defvar dic-tip-point nil)
(defun dic-timer ()
(when (and (not (eq dic-tip-point (point)))
(not (minibufferp)))
(setq dic-tip-point (point))
(dic-at-point)))
(defun dic-start-popup ()
(interactive)
(setq dic-timer (run-with-idle-timer dic-delay dic-delay 'dic-timer)))
(defun dic-stop-popup ()
(interactive)
(cancel-timer dic-timer)
(setq dic-timer nil))
(provide 'dic-at-point)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment