Skip to content

Instantly share code, notes, and snippets.

@lurdan lurdan/lookup-at-point.el

Last active Aug 29, 2015
What would you like to do?
(defun lookup-at-point ()
(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))
(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
(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
You can’t perform that action at this time.