From ddaedd037d689af3e11bf2d86b7e4d32bd981c4d Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 24 Oct 2021 00:09:58 +0100 Subject: el-spice is too intrusive, let's keep only the good bits --- init.org | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/init.org b/init.org index 7eed54f..ff51dc3 100644 --- a/init.org +++ b/init.org @@ -2225,18 +2225,59 @@ #+begin_src emacs-lisp (use-package edit-list :ensure t) (use-package package-lint :ensure t) - (use-package el-spice - :ensure t - - :init (setq el-spice-lighter "") - :config - (add-hook 'emacs-lisp-mode-hook 'el-spice-mode) - (add-hook 'lisp-interaction-mode-hook 'el-spice-mode) - (define-key el-spice-mode-map (kbd "C-c C-c") nil) - (define-key el-spice-mode-map (kbd "C-c C-l") nil) - (define-key el-spice-mode-map (kbd "C-c l") nil) - (define-key el-spice-mode-map (kbd "C-c C-z") nil)) + (defun elisp-disassemble (function) + (interactive (list (function-called-at-point))) + (disassemble function)) + + (defun elisp-pp (sexp) + (with-output-to-temp-buffer "*Pp Eval Output*" + (pp sexp) + (with-current-buffer standard-output + (emacs-lisp-mode)))) + + (defun elisp-macroexpand (form) + (interactive (list (form-at-point 'sexp))) + (elisp-pp (macroexpand form))) + + (defun elisp-macroexpand-all (form) + (interactive (list (form-at-point 'sexp))) + (elisp-pp (cl-macroexpand-all form))) + + (defun elisp-find-definition (name) + (interactive (list (thing-at-point 'symbol))) + (cond (name + (let ((symbol (intern-soft name)) + (search (lambda (fun sym) + (let* ((r (save-excursion (funcall fun sym))) + (buffer (car r)) + (point (cdr r))) + (cond ((not point) + (error "Found no definition for %s in %s" + name buffer)) + (t + (switch-to-buffer buffer) + (goto-char point) + (recenter 1))))))) + (cond ((fboundp symbol) + (xref-push-marker-stack) + (funcall search 'find-function-noselect symbol)) + ((boundp symbol) + (xref-push-marker-stack) + (funcall search 'find-variable-noselect symbol)) + (t + (message "Symbol not bound: %S" symbol))))) + (t (message "No symbol at point")))) + + (use-package emacs-lisp + :bind (:map emacs-lisp-mode-map + (("C-c C-m" . elisp-macroexpand) + ("C-c C-M" . elisp-macroexpand-all) + ("C-c C-k" . elisp-bytecompile-and-load) + ("C-c C-p" . pp-eval-last-sexp) + ("M-." . elisp-find-definition) + ("M-," . pop-tag-mark) + ("C-c <" . lc-show-package-summary)))) #+end_src *** Erlang #+begin_src emacs-lisp -- cgit v1.2.3