Replace popwin with shackle; refactor window/buffer defuns

This commit is contained in:
Henrik Lissner 2015-12-21 05:44:44 -05:00
parent 6b38183786
commit fca83ffc19
10 changed files with 508 additions and 282 deletions

View file

@ -55,7 +55,7 @@ If ARG is nil this function calls `recompile', otherwise it calls
(insert out)
(goto-char (point-min))
(read-only-mode 1)
(narf/popup-open buf))))))
(narf/popup-buffer buf))))))
(t (quickrun-region beg end))))
;;;###autoload (autoload 'narf:eval-region-and-replace "defuns-quickrun" nil t)
@ -70,35 +70,5 @@ If ARG is nil this function calls `recompile', otherwise it calls
(insert (current-kill 0)))))
(t (quickrun-replace-region beg end))))
(defvar narf--repl-buffer nil)
;;;###autoload (autoload 'narf:repl "defuns-quickrun" nil t)
(evil-define-command narf:repl (&optional bang)
:repeat nil
(interactive "<!>")
(if (and narf--repl-buffer (buffer-live-p narf--repl-buffer))
(if (popwin:popup-window-live-p)
(popwin:select-popup-window)
(popwin:pop-to-buffer narf--repl-buffer))
(rtog/toggle-repl (if (use-region-p) 4))
(setq narf--repl-buffer (current-buffer))))
;;;###autoload (autoload 'narf:repl-eval "defuns-quickrun" nil t)
(evil-define-operator narf:repl-eval (&optional beg end bang)
:type inclusive
:repeat nil
(interactive "<r><!>")
(let ((region-p (use-region-p))
(selection (s-trim (buffer-substring-no-properties beg end))))
(narf:repl bang)
(when (and region-p beg end)
(let* ((buf narf--repl-buffer)
(win (get-buffer-window buf)))
(unless (eq buf popwin:popup-buffer)
(popwin:pop-to-buffer buf nil t))
(when (and narf--repl-buffer (buffer-live-p narf--repl-buffer))
(with-current-buffer narf--repl-buffer
(goto-char (point-max))
(insert selection)))))))
(provide 'defuns-quickrun)
;;; defuns-quickrun.el ends here