This is a mess

I'm sorry.  I really wanted to improve my commit discipline.  I know.  I can't
be fucked to comb this diff and split it into 8 properly-ordered commits, like I
know I should.  I'm not having a good time right now.  We'll do better moving
forward.
This commit is contained in:
Madeleine Sydney
2025-01-31 16:45:37 -07:00
parent f247599853
commit d59c79a8d4
16 changed files with 721 additions and 33 deletions

View File

@@ -2,6 +2,7 @@
(require 'syd-handle-repl)
(require 'syd-handle-lookup)
(require 'syd-handle-eval)
;; (require 'handle)
;; Don't `use-package' `ielm', since it's loaded by Emacs. You'll get weird
@@ -37,6 +38,31 @@
(set-repl-handler! 'emacs-lisp-mode
#'syd/open-emacs-lisp-repl)
;;;###autoload
(defun syd-emacs-lisp-eval (beg end)
"Evaluate a region and print it to the echo area (if one line long), otherwise
to a pop up buffer."
(syd-eval-display-results
(string-trim-right
(let ((buffer (generate-new-buffer " *eval-output*"))
(debug-on-error t))
(unwind-protect
(condition-case-unless-debug e
(progn (eval-region beg end buffer load-read-function)
(with-current-buffer buffer
(let ((pp-max-width nil))
(require 'pp)
(pp-buffer)
(replace-regexp-in-string
"\\\\n" "\n" (string-trim-left (buffer-string))))))
(error (format "ERROR: %s" e)))
(kill-buffer buffer))))
:source-buffer (current-buffer)
:force-popup current-prefix-arg))
(set-eval-handler! 'emacs-lisp-mode
#'syd-emacs-lisp-eval)
(defun syd-emacs-set-handlers ()
(setq-local syd-lookup-documentation-handlers
(list #'syd-emacs-lisp-lookup-documentation)))