Skip to content

Instantly share code, notes, and snippets.

@lurdan
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lurdan/11146220 to your computer and use it in GitHub Desktop.
Save lurdan/11146220 to your computer and use it in GitHub Desktop.
(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