+eval-and-replcae from crux

This commit is contained in:
2023-08-17 19:12:54 +02:00
parent 9c693f5d65
commit 9024301edd
2 changed files with 12 additions and 1 deletions

View File

@@ -189,7 +189,17 @@ Returns t if version changed, nil otherwise."
(set-window-dedicated-p (selected-window) t)
(set-background-color "azure"))))
;; from prelude and crux, comes in handy when I need to do an ad hoc
;; calc
(defun eval-and-replace ()
"Replace the preceding sexp with its value."
(interactive)
(backward-kill-sexp)
(condition-case nil
(prin1 (eval (read (current-kill 0)))
(current-buffer))
(error (message "Invalid expression")
(insert (current-kill 0)))))
(provide 'init-elisp)
;;; init-elisp.el ends here

View File

@@ -12,6 +12,7 @@
:init
;; I'm not using any of th lsp commands, but better define a prefix
;; than being unable to reach it
;; FIXME: add at least lsp-find-definition
(setq lsp-keymap-prefix "C-c C-l")
:commands lsp)