aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2021-10-21 22:13:09 +0300
committerEli Zaretskii2021-10-21 22:13:09 +0300
commitee6bdd6eef329434427c6a7b22613bd33249d00a (patch)
tree2961986b762342cb81e1aeb50fa9bbf60a0f17e0
parent2b7655ca0e36a3de40c0a94eed701277a12ba146 (diff)
downloademacs-ee6bdd6eef329434427c6a7b22613bd33249d00a.tar.gz
emacs-ee6bdd6eef329434427c6a7b22613bd33249d00a.zip
Fix non-interactive behavior of 'kill-region'
* lisp/simple.el (kill-region): Actually ignore BEG and END when REGION is non-nil. Doc fix. (Bug#51320)
-rw-r--r--lisp/simple.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index bec4aa4738e..4aa373d6701 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5285,11 +5285,12 @@ Lisp programs should use this function for killing text.
5285Supply two arguments, character positions BEG and END indicating the 5285Supply two arguments, character positions BEG and END indicating the
5286 stretch of text to be killed. If the optional argument REGION is 5286 stretch of text to be killed. If the optional argument REGION is
5287 non-nil, the function ignores BEG and END, and kills the current 5287 non-nil, the function ignores BEG and END, and kills the current
5288 region instead." 5288 region instead. Interactively, REGION is always non-nil, and so
5289 this command always kills the current region."
5289 ;; Pass mark first, then point, because the order matters when 5290 ;; Pass mark first, then point, because the order matters when
5290 ;; calling `kill-append'. 5291 ;; calling `kill-append'.
5291 (interactive (list (mark) (point) 'region)) 5292 (interactive (list (mark) (point) 'region))
5292 (unless (and beg end) 5293 (unless (or region (and beg end))
5293 (user-error "The mark is not set now, so there is no region")) 5294 (user-error "The mark is not set now, so there is no region"))
5294 (condition-case nil 5295 (condition-case nil
5295 (let ((string (if region 5296 (let ((string (if region