What I'm trying to achieve
I'm trying to create a popup that runs an elisp funtion I've written which searches my library directory for pdfs, gets the user to choose an option (using completing read) and opens the selected pdf.
What I've done
Because I want it available as a keybinding in my desktop env, I'm running it through a wrapper using emacsclient. I'm calling:
emacsclient --eval "(mwe-pdf-lookup-and-quit)" -a ""
Which points to the function:
(defun mwe-pdf-lookup-and-quit () (make-frame '((width . 80) (height . 25) (minibuffer . only) (name . "lookup"))) (sleep-for 0.01) (select-frame-by-name "lookup") (select-frame-set-input-focus (selected-frame)) (message (completing-read ; This is where my pdf search function goes "Choose: " '("Option 1" "Option 2"))) (delete-frame))
Works perfectly if I choose a file. The pdf is opened and the frame is deleted. The problem is, if I decide I don't want to open a file anymore and press C-g, the frame displays "Quit emacsclient request" and hangs around. I would like to know how I can delete the minibuffer frame instead.