From 2d396a48f5a2f889706ed9b4d08a53a7635b79d2 Mon Sep 17 00:00:00 2001 From: vindarel Date: Wed, 15 Jul 2020 18:27:59 +0200 Subject: [PATCH 1/2] emacs: evaluate sexp before point with C-x C-e (not C-c) --- emacs-ide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs-ide.md b/emacs-ide.md index 22c8eb24..1672cebd 100644 --- a/emacs-ide.md +++ b/emacs-ide.md @@ -238,8 +238,8 @@ running `M-x slime-compile-region`. Compile a **defun** by putting the cursor inside the "test-format" defun and pressing `C-c C-c`. -Compile the **sexp** before the point by putting the cursor after the -closing paren of `(test-format)` and pressing `C-c C-e`. +Evaluate the **sexp** before the point by putting the cursor after the +closing paren of `(test-format)` and pressing `C-x C-e`. To **evaluate** rather than compile: - evaluate a region with `C-c C-r`, From cb3981e7ac23e902773a52b5889e6eb7284a17c7 Mon Sep 17 00:00:00 2001 From: vindarel Date: Wed, 15 Jul 2020 18:30:42 +0200 Subject: [PATCH 2/2] emacs: when eval is useful --- emacs-ide.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/emacs-ide.md b/emacs-ide.md index 1672cebd..a37574e3 100644 --- a/emacs-ide.md +++ b/emacs-ide.md @@ -252,9 +252,25 @@ See also other commands in the menu. There are a couple of pragmatic differences when choosing between compiling or evaluating. In general, it is better to *compile* top-level forms, for two reasons: -* Compiling a top-level form highlights warnings and errors in the editor, evaluation does not. -* SLIME keeps track of line-numbers of compiled forms; when a top-level form is evaluated, the file line number information is lost. -That's problematic for code navigation afterwards. + +* Compiling a top-level form highlights warnings and errors in the editor, whereas evaluation does not. +* SLIME keeps track of line-numbers of compiled forms, but when a top-level form is evaluated, the file line number information is lost. That's problematic for code navigation afterwards. + +`eval` is still useful to observe results from individual non top-level forms. For example, say you have this function: + + +~~~lisp +(defun foo () + (let ((f (open "/home/marian/test.lisp"))) + ...)) +~~~ + +Go to the end of the OPEN expression and evaluate it (`C-x C-e`), to observe the result: + +``` +=> # +``` + ---