Subject: bug#59350: closed (Re: bug#59350: 29.0.50; Eval region or buffer)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 20 Nov 2022 18:12:03 +0000

Your bug report

#59350: 29.0.50; Eval region or buffer

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
59350: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59350
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#59350: 29.0.50; Eval region or buffer
From: Juri Linkov <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked]
Date: Sun, 20 Nov 2022 20:11:16 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

>>> Maybe then better to rename it to 'elisp-eval-region-or-buffer',
>>> then explain in the docstring it's for Transient Mark only.
>>
>> Rename elisp-eval-buffer, you mean?  That's a possibility, yes.
>
> This patch renames elisp-eval-buffer:

The renamed command is pushed now, and closed.

Subject: 29.0.50; Eval region or buffer
From: Juri Linkov <[email-masked]>
To: [email-masked]
Date: Fri, 18 Nov 2022 09:44:39 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

'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.
```