[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master ad29e14: * lisp/simple.el (region-bounds): New func
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] master ad29e14: * lisp/simple.el (region-bounds): New function. |
Date: |
Sat, 21 Jan 2017 23:19:04 +0000 (UTC) |
branch: master
commit ad29e145b16cf2966e3a9df884cbc234f1ae3e51
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>
* lisp/simple.el (region-bounds): New function.
(region-noncontiguous-p): Use it.
http://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00044.html
---
etc/NEWS | 5 +++++
lisp/simple.el | 6 +++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/etc/NEWS b/etc/NEWS
index 95d03a3..ca66df6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -787,6 +787,11 @@ of an arbitrary function. This generalizes 'subr-arity'
for functions
that are not built-in primitives. We recommend using this new
function instead of 'subr-arity'.
+** New function 'region-bounds' can be used in the interactive spec
+to provide region boundaries (for rectangular regions more than one)
+to an interactively callable function as a single argument instead of
+two separate arguments region-beginning and region-end.
+
+++
** 'parse-partial-sexp' state has a new element. Element 10 is
non-nil when the last character scanned might be the first character
diff --git a/lisp/simple.el b/lisp/simple.el
index f798cd4..bdc6abd 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5410,11 +5410,15 @@ also checks the value of `use-empty-active-region'."
;; region is active when there's no mark.
(progn (cl-assert (mark)) t)))
+(defun region-bounds ()
+ "Return the boundaries of the region as a list of (START . END) positions."
+ (funcall region-extract-function 'bounds))
+
(defun region-noncontiguous-p ()
"Return non-nil if the region contains several pieces.
An example is a rectangular region handled as a list of
separate contiguous regions for each line."
- (> (length (funcall region-extract-function 'bounds)) 1))
+ (> (length (region-bounds)) 1))
(defvar redisplay-unhighlight-region-function
(lambda (rol) (when (overlayp rol) (delete-overlay rol))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master ad29e14: * lisp/simple.el (region-bounds): New function.,
Juri Linkov <=