From: Juri Linkov <juri@linkov.net>
To: 59350@debbugs.gnu.org
Subject: bug#59350: 29.0.50; Eval region or buffer
Date: Fri, 18 Nov 2022 09:44:39 +0200 [thread overview]
Message-ID: <86y1s8btaw.fsf@mail.linkov.net> (raw)
'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.
```
next reply other threads:[~2022-11-18 7:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-18 7:44 Juri Linkov [this message]
2022-11-18 8:49 ` bug#59350: 29.0.50; Eval region or buffer 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86y1s8btaw.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=59350@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.