From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 59350@debbugs.gnu.org
Subject: bug#59350: 29.0.50; Eval region or buffer
Date: Sun, 20 Nov 2022 10:17:20 +0200 [thread overview]
Message-ID: <86a64mxcof.fsf@mail.linkov.net> (raw)
In-Reply-To: <83o7t27msw.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Nov 2022 21:43:11 +0200")
[-- Attachment #1: Type: text/plain, Size: 239 bytes --]
>> 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:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: elisp-eval-region-or-buffer.patch --]
[-- Type: text/x-diff, Size: 2150 bytes --]
diff --git a/etc/NEWS b/etc/NEWS
index 8a34afe8d2..9345cb06f5 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1464,8 +1464,8 @@ This command visits the file on the current line with EWW.
** Elisp
---
-*** New command 'elisp-eval-buffer' (bound to 'C-c C-e').
-This command evals the forms in the current buffer.
+*** New command 'elisp-eval-region-or-buffer' (bound to 'C-c C-e').
+This command evals the forms in the active region or in the whole buffer.
---
*** New commands 'elisp-byte-compile-file' and 'elisp-byte-compile-buffer'.
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 44c8ca7cb9..7c470de195 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -52,7 +52,7 @@ emacs-lisp-mode-map
:parent lisp-mode-shared-map
"M-TAB" #'completion-at-point
"C-M-x" #'eval-defun
- "C-c C-e" #'elisp-eval-buffer
+ "C-c C-e" #'elisp-eval-region-or-buffer
"C-c C-f" #'elisp-byte-compile-file
"C-c C-b" #'elisp-byte-compile-buffer
"C-M-q" #'indent-pp-sexp)
@@ -1234,7 +1234,7 @@ lisp-interaction-mode-map
:parent lisp-mode-shared-map
"C-M-x" #'eval-defun
"C-M-q" #'indent-pp-sexp
- "C-c C-e" #'elisp-eval-buffer
+ "C-c C-e" #'elisp-eval-region-or-buffer
"C-c C-b" #'elisp-byte-compile-buffer
"M-TAB" #'completion-at-point
"C-j" #'eval-print-last-sexp)
@@ -2212,11 +2212,17 @@ elisp-flymake--batch-compile-for-flymake
(terpri)
(pp collected)))
-(defun elisp-eval-buffer ()
- "Evaluate the forms in the current buffer."
+(defun elisp-eval-region-or-buffer ()
+ "Evaluate the forms in the active region or the whole current buffer.
+In Transient Mark mode when the mark is active, call `eval-region'.
+Otherwise, call `eval-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 prev parent reply other threads:[~2022-11-20 8:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=86a64mxcof.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=59350@debbugs.gnu.org \
--cc=eliz@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.