[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 054f553b9c 2/2: Fix region-extract-function compilation warning
From: |
Lars Ingebrigtsen |
Subject: |
master 054f553b9c 2/2: Fix region-extract-function compilation warning |
Date: |
Fri, 19 Aug 2022 07:06:14 -0400 (EDT) |
branch: master
commit 054f553b9ce0bec1ce698464bc4dc498b05a219d
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Fix region-extract-function compilation warning
* lisp/simple.el (region-extract-function): Clean up the logic
slightly to avoid a warning.
---
lisp/simple.el | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/lisp/simple.el b/lisp/simple.el
index 1e6e5e11e0..8fb03f3b04 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1402,15 +1402,17 @@ instead of deleted."
:version "24.1")
(setq region-extract-function
- (lambda (method)
- (when (region-beginning)
- (cond
- ((eq method 'bounds)
- (list (cons (region-beginning) (region-end))))
- ((eq method 'delete-only)
- (delete-region (region-beginning) (region-end)))
- (t
- (filter-buffer-substring (region-beginning) (region-end) method))))))
+ (lambda (method)
+ ;; This call either signals an error (if there is no region)
+ ;; or returns a number.
+ (let ((beg (region-beginning)))
+ (cond
+ ((eq method 'bounds)
+ (list (cons beg (region-end))))
+ ((eq method 'delete-only)
+ (delete-region beg (region-end)))
+ (t
+ (filter-buffer-substring beg (region-end) method))))))
(defvar region-insert-function
(lambda (lines)