Last active
August 29, 2015 14:00
-
-
Save lurdan/11146220 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
(defun lookup-at-point () | |
(interactive) | |
(lookup-at-point-pos-tip (lookup-current-word)) | |
) | |
;(global-set-key (kbd "C-,") 'lookup-at-point) | |
(defcustom lookup-at-point-pos-tip-color nil | |
"" | |
:type 'strqing | |
:group 'lookup) | |
(defcustom lookup-at-point-pos-tip-timeout 0 | |
"" | |
:type 'number | |
:group 'lookup) | |
(defcustom lookup-at-point-pos-tip-module "default" | |
"" | |
:type 'string | |
:group 'lookup) | |
(defun lookup-at-point-pos-tip (word) | |
(let ((current-prefix-arg nil) | |
(entry (car (lookup-dictionary-search | |
(car (lookup-module-dictionaries (lookup-get-module lookup-at-point-pos-tip-module))) | |
(lookup-parse-pattern word))))) | |
(with-current-buffer (lookup-get-buffer (lookup-content-buffer)) | |
(let ((inhibit-read-only t)) | |
(erase-buffer) | |
(let ((content (lookup-get-property entry 'content))) | |
(if (and content lookup-enable-format (not lookup-force-update)) | |
(insert content) | |
(lookup-with-message (format "Inserting `%s'" (lookup-entry-heading entry)) | |
(insert (lookup-entry-content entry)) | |
(when lookup-enable-format | |
(lookup-arrange-content entry) | |
(lookup-put-property entry 'content (buffer-string))))) | |
(if lookup-enable-format (lookup-adjust-content entry))) | |
;; arrange functions might change the buffer mode | |
(lookup-content-mode) | |
(set-buffer-modified-p nil)) | |
(setq lookup-content-entry entry) | |
(setq lookup-content-line-heading (lookup-entry-heading entry)) | |
(pos-tip-show (buffer-string) lookup-at-point-pos-tip-color nil nil lookup-at-point-pos-tip-timeout nil nil nil nil) | |
))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment