aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJuri Linkov2015-11-14 01:28:03 +0200
committerJuri Linkov2015-11-14 01:28:03 +0200
commit31f6e939334180add7bc11240343615a2e6350f6 (patch)
tree376d0c9d5290a69187be11d71fffc692d31a53c0 /src
parentf103a2771bc8691f00b331ec25aa5c0477c2089a (diff)
downloademacs-31f6e939334180add7bc11240343615a2e6350f6.tar.gz
emacs-31f6e939334180add7bc11240343615a2e6350f6.zip
Support rectangular regions for more commands
* lisp/simple.el (region-extract-function): Handle the arg value ‘bounds’. (region-insert-function): New function. (shell-command-on-region): Add arg ‘region-noncontiguous-p’. If non-nil, operate on multiple chunks. (region-noncontiguous-p): New function. * lisp/rect.el: Add function rectangle--insert-region around region-insert-function. (extract-rectangle-bounds): New function. (rectangle--extract-region): Handle the arg value ‘bounds’. (rectangle--insert-region): New function. * lisp/emulation/cua-rect.el: Add function cua--insert-rectangle around region-insert-function. (cua--extract-rectangle-bounds): New function. (cua--rectangle-region-extract): Handle the arg value ‘bounds’. * lisp/replace.el (query-replace, query-replace-regexp): Add arg ‘region-noncontiguous-p’. Use ‘use-region-p’. (query-replace-regexp-eval, map-query-replace-regexp) (replace-string, replace-regexp): Use ‘use-region-p’. (keep-lines, flush-lines, how-many): Use ‘use-region-p’. (perform-replace): Add arg ‘region-noncontiguous-p’. If non-nil, operate on multiple chunks. * src/casefiddle.c (Fdowncase_region): Add arg ‘region-noncontiguous-p’. If non-nil, operate on multiple chunks. (Bug#19829)
Diffstat (limited to 'src')
-rw-r--r--src/casefiddle.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/casefiddle.c b/src/casefiddle.c
index b94ea8e212e..6a2983ef018 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -306,14 +306,30 @@ See also `capitalize-region'. */)
306 return Qnil; 306 return Qnil;
307} 307}
308 308
309DEFUN ("downcase-region", Fdowncase_region, Sdowncase_region, 2, 2, "r", 309DEFUN ("downcase-region", Fdowncase_region, Sdowncase_region, 2, 3,
310 "(list (region-beginning) (region-end) (region-noncontiguous-p))",
310 doc: /* Convert the region to lower case. In programs, wants two arguments. 311 doc: /* Convert the region to lower case. In programs, wants two arguments.
311These arguments specify the starting and ending character numbers of 312These arguments specify the starting and ending character numbers of
312the region to operate on. When used as a command, the text between 313the region to operate on. When used as a command, the text between
313point and the mark is operated on. */) 314point and the mark is operated on. */)
314 (Lisp_Object beg, Lisp_Object end) 315 (Lisp_Object beg, Lisp_Object end, Lisp_Object region_noncontiguous_p)
315{ 316{
316 casify_region (CASE_DOWN, beg, end); 317 Lisp_Object bounds = Qnil;
318
319 if (!NILP (region_noncontiguous_p))
320 {
321 bounds = call1 (Fsymbol_value (intern ("region-extract-function")),
322 intern ("bounds"));
323
324 while (CONSP (bounds))
325 {
326 casify_region (CASE_DOWN, XCAR (XCAR (bounds)), XCDR (XCAR (bounds)));
327 bounds = XCDR (bounds);
328 }
329 }
330 else
331 casify_region (CASE_DOWN, beg, end);
332
317 return Qnil; 333 return Qnil;
318} 334}
319 335