about summary refs log tree commit diff
path: root/users/wpcarro/emacs/.emacs.d
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2022-02-02T20·15-0800
committerclbot <clbot@tvl.fyi>2022-02-02T20·19+0000
commitd0e30ed23a53f965f3003d9aa7282190fe3df088 (patch)
treed51fd35cea2c2645a31fa782f1940de297c36b2c /users/wpcarro/emacs/.emacs.d
parent41faf1cf912363159fbc5acdb7779e457043fc57 (diff)
feat(wpcarro/emacs): Define KBD to copy result of elisp evaluation r/3747
I've wanted this for awhile...

Change-Id: Ic010fee6a7adc0aa793e4ca2179b90f4463d1eec
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5197
Tested-by: BuildkiteCI
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Diffstat (limited to 'users/wpcarro/emacs/.emacs.d')
-rw-r--r--users/wpcarro/emacs/.emacs.d/wpc/wpc-lisp.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/wpc-lisp.el b/users/wpcarro/emacs/.emacs.d/wpc/wpc-lisp.el
index 4984e5dccddd..599d42620419 100644
--- a/users/wpcarro/emacs/.emacs.d/wpc/wpc-lisp.el
+++ b/users/wpcarro/emacs/.emacs.d/wpc/wpc-lisp.el
@@ -100,10 +100,18 @@
   :config
   (general-add-hook 'emacs-lisp-mode #'ielm-mode))
 
+(defun wpc-lisp-copy-elisp-eval-output ()
+  "Copy the output of the elisp evaluation"
+  (interactive)
+  (call-interactively 'eval-last-sexp)
+  (clipboard-copy (current-message)
+                  :message (format "%s - copied!" (current-message))))
+
 (general-define-key
  :keymaps 'emacs-lisp-mode-map
  :prefix "<SPC>"
  :states 'normal
+ "c" #'wpc-lisp-copy-elisp-eval-output
  "x" #'eval-defun
  "X" #'eval-buffer
  "d" (lambda ()