From ee6bdd6eef329434427c6a7b22613bd33249d00a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 21 Oct 2021 22:13:09 +0300 Subject: [PATCH] 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) --- lisp/simple.el | 5 +++-- 1 file 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. Supply two arguments, character positions BEG and END indicating the stretch of text to be killed. If the optional argument REGION is non-nil, the function ignores BEG and END, and kills the current - region instead." + region instead. Interactively, REGION is always non-nil, and so + this command always kills the current region." ;; Pass mark first, then point, because the order matters when ;; calling `kill-append'. (interactive (list (mark) (point) 'region)) - (unless (and beg end) + (unless (or region (and beg end)) (user-error "The mark is not set now, so there is no region")) (condition-case nil (let ((string (if region -- 2.39.2