mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-22 08:04:20 +01:00
emacs-rofi: make Emacs reuse the same frame
Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
parent
eacd15086c
commit
93eb258159
|
@ -16,22 +16,29 @@ It is possible to make a fake rofi, from emacs ~completing-read~. This file faci
|
|||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defvar completing-read-frame nil)
|
||||
|
||||
(defun completing-read-frame-popup (prompt collection &rest args)
|
||||
""
|
||||
(let ((frame (make-frame `((minibuffer . only)
|
||||
(name . "emacs-completing-read-float")
|
||||
(unsplittable . t)
|
||||
(no-other-frame . t)
|
||||
(width . ,width)
|
||||
(height . ,height)
|
||||
(left . 0.5)
|
||||
(top . 0.5)))))
|
||||
(with-selected-frame frame
|
||||
(unwind-protect
|
||||
(let ((selection (apply #'completing-read prompt collection args)))
|
||||
(delete-frame frame)
|
||||
selection)
|
||||
(delete-frame frame)))))
|
||||
(unless completing-read-frame
|
||||
(setq completing-read-frame
|
||||
(make-frame `((minibuffer . only)
|
||||
(name . "emacs-completing-read-float")
|
||||
(unsplittable . t)
|
||||
(no-other-frame . t)
|
||||
(width . ,width)
|
||||
(height . ,height)
|
||||
(left . 0.5)
|
||||
(top . 0.5))))
|
||||
(make-frame-invisible completing-read-frame))
|
||||
(make-frame-visible completing-read-frame)
|
||||
(raise-frame completing-read-frame)
|
||||
(with-selected-frame completing-read-frame
|
||||
(unwind-protect
|
||||
(let ((selection (apply #'completing-read prompt collection args)))
|
||||
(make-frame-invisible completing-read-frame)
|
||||
selection)
|
||||
(make-frame-invisible completing-read-frame))))
|
||||
#+end_src
|
||||
|
||||
Next a bash helper is needed.
|
||||
|
|
Loading…
Reference in a new issue