* lisp/simple.el (region-bounds): New function.
(region-noncontiguous-p): Use it. http://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00044.html
This commit is contained in:
parent
07d1516427
commit
ad29e145b1
2 changed files with 10 additions and 1 deletions
5
etc/NEWS
5
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
|
||||
|
|
|
@ -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))))
|
||||
|
|
Loading…
Add table
Reference in a new issue