Lazy load popup rules + def-popup!
This commit is contained in:
parent
3e4373022e
commit
bf81fdeba9
18 changed files with 135 additions and 94 deletions
|
@ -10,11 +10,10 @@
|
|||
(defun doom/popup-p (&optional window)
|
||||
"Whether WINDOW is a shackle popup window or not."
|
||||
(and doom-popup-windows
|
||||
(-any? (lambda (w)
|
||||
(if (window-live-p w) t (doom/popup-remove w) nil))
|
||||
doom-popup-windows)
|
||||
(--any? (if (window-live-p it) t (doom/popup-remove it) nil)
|
||||
doom-popup-windows)
|
||||
(if window
|
||||
(-any? (lambda (w) (eq window w)) doom-popup-windows)
|
||||
(--any? (eq window it) doom-popup-windows)
|
||||
t)))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -122,5 +121,10 @@
|
|||
(setq-local doom-popup-protect t)
|
||||
(setq doom-last-popup (current-buffer))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom*save-popup (orig-fun &rest args)
|
||||
"Prevents messing up a popup buffer on window changes"
|
||||
(doom/popup-save (apply orig-fun args)))
|
||||
|
||||
(provide 'defuns-popups)
|
||||
;;; defuns-popups.el ends here
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
(evil-define-command doom:repl (&optional bang command)
|
||||
:repeat nil
|
||||
(interactive "<!><a>")
|
||||
(if (and doom--repl-buffer (buffer-live-p doom--repl-buffer))
|
||||
(doom/popup-buffer doom--repl-buffer)
|
||||
(if (and doom-repl-buffer (buffer-live-p doom-repl-buffer))
|
||||
(doom/popup-buffer doom-repl-buffer)
|
||||
(rtog/toggle-repl (if (use-region-p) 4))
|
||||
(setq doom--repl-buffer (current-buffer))
|
||||
(setq doom-repl-buffer (current-buffer))
|
||||
(when command
|
||||
(with-current-buffer doom--repl-buffer
|
||||
(with-current-buffer doom-repl-buffer
|
||||
(insert command)
|
||||
(unless bang (comint-send-input))))))
|
||||
|
||||
|
@ -22,12 +22,12 @@
|
|||
(selection (s-trim (buffer-substring-no-properties beg end))))
|
||||
(doom:repl bang)
|
||||
(when (and region-p beg end)
|
||||
(let* ((buf doom--repl-buffer)
|
||||
(let* ((buf doom-repl-buffer)
|
||||
(win (get-buffer-window buf)))
|
||||
(unless (eq buf (doom/popup-p (get-buffer-window buf)))
|
||||
(doom/popup-buffer buf))
|
||||
(when (and doom--repl-buffer (buffer-live-p doom--repl-buffer))
|
||||
(with-current-buffer doom--repl-buffer
|
||||
(when (and doom-repl-buffer (buffer-live-p doom-repl-buffer))
|
||||
(with-current-buffer doom-repl-buffer
|
||||
(goto-char (point-max))
|
||||
(insert selection)))))))
|
||||
|
||||
|
|
8
core/defuns/macros-popups.el
Normal file
8
core/defuns/macros-popups.el
Normal file
|
@ -0,0 +1,8 @@
|
|||
;;; macros-popups.el
|
||||
|
||||
;;;###autoload
|
||||
(defmacro def-popup! (&rest params)
|
||||
`(push ',params shackle-rules))
|
||||
|
||||
(provide 'macros-popups)
|
||||
;;; macros-popups.el ends here
|
Loading…
Add table
Add a link
Reference in a new issue