all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#59350: 29.0.50; Eval region or buffer
@ 2022-11-18  7:44 Juri Linkov
  2022-11-18  8:49 ` Eli Zaretskii
  2022-11-18 16:48 ` Drew Adams
  0 siblings, 2 replies; 7+ messages in thread
From: Juri Linkov @ 2022-11-18  7:44 UTC (permalink / raw)
  To: 59350

'elisp-eval-buffer' is a nice new command that evaluates the current buffer
with a convenient keybinding 'C-c C-e'.  It would be nicer also to react on
the currently active region:

```
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 6bdaa7a37a..9b8a66c243 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -2213,10 +2213,14 @@ elisp-flymake--batch-compile-for-flymake
     (pp collected)))
 
 (defun elisp-eval-buffer ()
-  "Evaluate the forms in the current buffer."
+  "Evaluate the forms in the active region or the whole current buffer."
   (interactive)
-  (eval-buffer)
-  (message "Evaluated the %s buffer" (buffer-name)))
+  (if (use-region-p)
+      (eval-region (region-beginning) (region-end))
+    (eval-buffer))
+  (message "Evaluated the %s%s buffer"
+           (if (use-region-p) "region in the " "")
+           (buffer-name)))
 
 (defun elisp-byte-compile-file (&optional load)
   "Byte compile the file the current buffer is visiting.
```





^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-11-20 18:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-18  7:44 bug#59350: 29.0.50; Eval region or buffer Juri Linkov
2022-11-18  8:49 ` Eli Zaretskii
2022-11-19 18:59   ` Juri Linkov
2022-11-19 19:43     ` Eli Zaretskii
2022-11-20  8:17       ` Juri Linkov
2022-11-20 18:11         ` Juri Linkov
2022-11-18 16:48 ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.