summaryrefslogtreecommitdiff
path: root/src/casefiddle.c
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2016-06-06 00:23:21 +0300
committerJuri Linkov <juri@linkov.net>2016-06-06 00:23:21 +0300
commit66d5c75e2dd9f4204b51a5d3299456ecc4ea6842 (patch)
tree167eaba896127f2c9ddb01c914e003893291b2ec /src/casefiddle.c
parentefde23dcdd110ae9d85449a04a66408d5e8a2b23 (diff)
downloademacs-66d5c75e2dd9f4204b51a5d3299456ecc4ea6842.tar.gz
* src/casefiddle.c (Fupcase_region): Add arg ‘region-noncontiguous-p’.
If non-nil, operate on multiple chunks. (Bug#23655) * src/search.c (Freplace_match): Use Qnil for new arg of Fupcase_region.
Diffstat (limited to 'src/casefiddle.c')
-rw-r--r--src/casefiddle.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 34a65edd008..6114a6f7857 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -294,15 +294,31 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
}
}
-DEFUN ("upcase-region", Fupcase_region, Supcase_region, 2, 2, "r",
+DEFUN ("upcase-region", Fupcase_region, Supcase_region, 2, 3,
+ "(list (region-beginning) (region-end) (region-noncontiguous-p))",
doc: /* Convert the region to upper case. In programs, wants two arguments.
These arguments specify the starting and ending character numbers of
the region to operate on. When used as a command, the text between
point and the mark is operated on.
See also `capitalize-region'. */)
- (Lisp_Object beg, Lisp_Object end)
+ (Lisp_Object beg, Lisp_Object end, Lisp_Object region_noncontiguous_p)
{
- casify_region (CASE_UP, beg, end);
+ Lisp_Object bounds = Qnil;
+
+ if (!NILP (region_noncontiguous_p))
+ {
+ bounds = call1 (Fsymbol_value (intern ("region-extract-function")),
+ intern ("bounds"));
+
+ while (CONSP (bounds))
+ {
+ casify_region (CASE_UP, XCAR (XCAR (bounds)), XCDR (XCAR (bounds)));
+ bounds = XCDR (bounds);
+ }
+ }
+ else
+ casify_region (CASE_UP, beg, end);
+
return Qnil;
}