Created
October 19, 2011 02:18
-
-
Save yoshinari-nomura/1297331 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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