GNU bug report logs - #59350
29.0.50; Eval region or buffer

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Fri, 18 Nov 2022 07:47:02 UTC

Severity: normal

Found in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Juri Linkov <juri <at> linkov.net>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#59350: closed (29.0.50; Eval region or buffer)
Date: Sun, 20 Nov 2022 18:12:03 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 20 Nov 2022 20:11:16 +0200
with message-id <86cz9hv6m3.fsf <at> mail.linkov.net>
and subject line Re: bug#59350: 29.0.50; Eval region or buffer
has caused the debbugs.gnu.org bug report #59350,
regarding 29.0.50; Eval region or buffer
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
59350: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59350
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Eval region or buffer
Date: Fri, 18 Nov 2022 09:44:39 +0200
'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.
```


[Message part 3 (message/rfc822, inline)]
From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59350-done <at> debbugs.gnu.org
Subject: Re: bug#59350: 29.0.50; Eval region or buffer
Date: Sun, 20 Nov 2022 20:11:16 +0200
>>> 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.


This bug report was last modified 2 years and 261 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.