Skip to content

Instantly share code, notes, and snippets.

@priyadarshan
Forked from katspaugh/ido-config.el
Created March 11, 2014 15:09
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 priyadarshan/9487786 to your computer and use it in GitHub Desktop.
Save priyadarshan/9487786 to your computer and use it in GitHub Desktop.
(require 'ido-at-point)
(defun ido-at-point-x-prompt (prompt choices &optional display-fn)
"Display choices in a x-window prompt."
(when (and window-system choices)
(let ((chosen
(let (menu d) ;; d for display
(dolist (c choices)
(setq d (or (and display-fn (funcall display-fn c))
c))
(cond ((stringp d)
(push (cons (concat " " d) c) menu))
((listp d)
(push (car d) menu))))
(setq menu (list prompt (push "title" menu)))
(x-popup-menu (if (fboundp 'posn-at-point)
(let ((x-y (posn-x-y (posn-at-point (point)))))
(list (list (+ (car x-y) 10)
(+ (cdr x-y) 20))
(selected-window)))
t)
menu))))
(or chosen
(keyboard-quit)))))
(defun ido-at-point-read (completions common)
(ido-at-point-x-prompt "Completions" completions))
(ido-at-point-mode t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment