aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2022-11-20 20:10:45 +0200
committerJuri Linkov2022-11-20 20:10:45 +0200
commit4bc9fe33afa4a2dc063e7c25d6098ad98fcb0208 (patch)
treea932a6eb7118a4b05d9e533f90dc9c87ef7abb1f
parent5c709bd605d39032362a2850321615faed4d1eb3 (diff)
downloademacs-4bc9fe33afa4a2dc063e7c25d6098ad98fcb0208.tar.gz
emacs-4bc9fe33afa4a2dc063e7c25d6098ad98fcb0208.zip
Rename 'elisp-eval-buffer' to 'elisp-eval-region-or-buffer' (bug#59350)
* lisp/progmodes/elisp-mode.el (elisp-eval-region-or-buffer): Rename recently added command 'elisp-eval-buffer' to support active region. (emacs-lisp-mode-map, lisp-interaction-mode-map): Rebind 'C-c C-e' from elisp-eval-buffer to elisp-eval-region-or-buffer.
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/progmodes/elisp-mode.el18
2 files changed, 14 insertions, 8 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 8a34afe8d29..9345cb06f5e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1464,8 +1464,8 @@ This command visits the file on the current line with EWW.
1464** Elisp 1464** Elisp
1465 1465
1466--- 1466---
1467*** New command 'elisp-eval-buffer' (bound to 'C-c C-e'). 1467*** New command 'elisp-eval-region-or-buffer' (bound to 'C-c C-e').
1468This command evals the forms in the current buffer. 1468This command evals the forms in the active region or in the whole buffer.
1469 1469
1470--- 1470---
1471*** New commands 'elisp-byte-compile-file' and 'elisp-byte-compile-buffer'. 1471*** 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 44c8ca7cb9d..7c470de195f 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -52,7 +52,7 @@ All commands in `lisp-mode-shared-map' are inherited by this map."
52 :parent lisp-mode-shared-map 52 :parent lisp-mode-shared-map
53 "M-TAB" #'completion-at-point 53 "M-TAB" #'completion-at-point
54 "C-M-x" #'eval-defun 54 "C-M-x" #'eval-defun
55 "C-c C-e" #'elisp-eval-buffer 55 "C-c C-e" #'elisp-eval-region-or-buffer
56 "C-c C-f" #'elisp-byte-compile-file 56 "C-c C-f" #'elisp-byte-compile-file
57 "C-c C-b" #'elisp-byte-compile-buffer 57 "C-c C-b" #'elisp-byte-compile-buffer
58 "C-M-q" #'indent-pp-sexp) 58 "C-M-q" #'indent-pp-sexp)
@@ -1234,7 +1234,7 @@ All commands in `lisp-mode-shared-map' are inherited by this map."
1234 :parent lisp-mode-shared-map 1234 :parent lisp-mode-shared-map
1235 "C-M-x" #'eval-defun 1235 "C-M-x" #'eval-defun
1236 "C-M-q" #'indent-pp-sexp 1236 "C-M-q" #'indent-pp-sexp
1237 "C-c C-e" #'elisp-eval-buffer 1237 "C-c C-e" #'elisp-eval-region-or-buffer
1238 "C-c C-b" #'elisp-byte-compile-buffer 1238 "C-c C-b" #'elisp-byte-compile-buffer
1239 "M-TAB" #'completion-at-point 1239 "M-TAB" #'completion-at-point
1240 "C-j" #'eval-print-last-sexp) 1240 "C-j" #'eval-print-last-sexp)
@@ -2212,11 +2212,17 @@ Runs in a batch-mode Emacs. Interactively use variable
2212 (terpri) 2212 (terpri)
2213 (pp collected))) 2213 (pp collected)))
2214 2214
2215(defun elisp-eval-buffer () 2215(defun elisp-eval-region-or-buffer ()
2216 "Evaluate the forms in the current buffer." 2216 "Evaluate the forms in the active region or the whole current buffer.
2217In Transient Mark mode when the mark is active, call `eval-region'.
2218Otherwise, call `eval-buffer'."
2217 (interactive) 2219 (interactive)
2218 (eval-buffer) 2220 (if (use-region-p)
2219 (message "Evaluated the %s buffer" (buffer-name))) 2221 (eval-region (region-beginning) (region-end))
2222 (eval-buffer))
2223 (message "Evaluated the %s%s buffer"
2224 (if (use-region-p) "region in the " "")
2225 (buffer-name)))
2220 2226
2221(defun elisp-byte-compile-file (&optional load) 2227(defun elisp-byte-compile-file (&optional load)
2222 "Byte compile the file the current buffer is visiting. 2228 "Byte compile the file the current buffer is visiting.