Skip to content

Instantly share code, notes, and snippets.

@sabof
Created November 7, 2013 22:35
Show Gist options
  • Save sabof/7363048 to your computer and use it in GitHub Desktop.
Save sabof/7363048 to your computer and use it in GitHub Desktop.
es-make-minibuffer-frame
(defun es-make-minibuffer-frame ()
(interactive)
(let* (( last-recursion-depth )
( frame (make-frame '((width . 60)
(height . 4)
(minibuffer . only)
(title . "Emacs-Minibuffer"))))
( enable-recursive-minibuffers t)
;; Runs when going down a level, or when entering a prompt. Not ideal
( minibuffer-exit-hook (list (lambda ()
(cond ( (or (= (recursion-depth) 1)
(and last-recursion-depth
(= (recursion-depth)
last-recursion-depth)))
(run-with-timer 2 nil 'top-level))
( t (setq last-recursion-depth
(recursion-depth))))
))))
(unwind-protect
(with-selected-frame frame
(call-interactively 'eval-expression)
(sit-for 1))
(delete-frame frame))))
;; Can be evoked with
;;
;; $ emacsclient -a '' --eval "(es-make-minibuffer-frame)"&
;;
;; Since enable-recursive-minibuffers is set to t, it's possible to use M-x in
;; the new frame. It's also possible to execute a M-x command that prompts the
;; user once.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment