Massive refactor. Refactor all the things
This commit is contained in:
parent
03514fc09d
commit
f234be68a4
56 changed files with 792 additions and 831 deletions
|
@ -13,9 +13,8 @@
|
|||
|
||||
;;;###autoload (autoload 'narf:build "defuns-quickrun" nil t)
|
||||
(evil-define-command narf:build (arg)
|
||||
"Call a build command in the current directory.
|
||||
If ARG is nil this function calls `recompile', otherwise it calls
|
||||
`compile' passing ARG as build command."
|
||||
"Call a build command in the current directory. If ARG is nil this function calls
|
||||
`recompile', otherwise it calls `compile' passing ARG as build command."
|
||||
(interactive "<sh>")
|
||||
(when (null narf--build-command)
|
||||
(user-error "No build command was set"))
|
||||
|
@ -34,6 +33,7 @@ If ARG is nil this function calls `recompile', otherwise it calls
|
|||
;;;; Code running ;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;###autoload (autoload 'narf:eval-buffer "defuns-quickrun" nil t)
|
||||
(evil-define-command narf:eval-buffer ()
|
||||
"Evaluate the whole buffer."
|
||||
:move-point nil :repeat nil
|
||||
(interactive)
|
||||
(cond ((eq major-mode 'emacs-lisp-mode)
|
||||
|
@ -42,26 +42,27 @@ If ARG is nil this function calls `recompile', otherwise it calls
|
|||
|
||||
;;;###autoload (autoload 'narf:eval-region "defuns-quickrun" nil t)
|
||||
(evil-define-operator narf:eval-region (beg end)
|
||||
"Evaluate a region and, if large enough, prints its output to a popup buffer (if an
|
||||
elisp buffer). Otherwise forward the region to Quickrun."
|
||||
:move-point nil :repeat nil
|
||||
(interactive "<r>")
|
||||
(cond ((eq major-mode 'emacs-lisp-mode)
|
||||
(require 'pp)
|
||||
(let* ((pp-escape-newlines nil)
|
||||
(out (s-trim (pp-to-string (eval (read (buffer-substring-no-properties beg end))))))
|
||||
(out (pp-to-string (eval (read (buffer-substring-no-properties beg end)))))
|
||||
(lines (length (s-lines out))))
|
||||
(if (< lines 5)
|
||||
(princ out t)
|
||||
(let ((buf (get-buffer-create "*eval*")))
|
||||
(with-current-buffer buf
|
||||
(read-only-mode -1)
|
||||
(emacs-lisp-mode)
|
||||
(setq-local scroll-margin 0)
|
||||
(erase-buffer)
|
||||
(insert out)
|
||||
(goto-char (point-min))
|
||||
(read-only-mode 1)
|
||||
(narf|hide-mode-line)
|
||||
(narf/popup-buffer buf))))))
|
||||
(with-current-buffer (get-buffer-create "*eval*")
|
||||
;; (rename-buffer (buffer-name old-buf))
|
||||
(read-only-mode -1)
|
||||
(setq-local scroll-margin 0)
|
||||
(emacs-lisp-mode)
|
||||
(erase-buffer)
|
||||
(insert out)
|
||||
(read-only-mode 1)
|
||||
(goto-char (point-min))
|
||||
(narf/popup-buffer (current-buffer))))))
|
||||
(t (quickrun-region beg end))))
|
||||
|
||||
;;;###autoload (autoload 'narf:eval-region-and-replace "defuns-quickrun" nil t)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue