emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 66d5c75: * src/casefiddle.c (Fupcase_region): Add


From: Juri Linkov
Subject: [Emacs-diffs] master 66d5c75: * src/casefiddle.c (Fupcase_region): Add arg ‘region-noncontiguous-p’.
Date: Sun, 5 Jun 2016 21:23:29 +0000 (UTC)

branch: master
commit 66d5c75e2dd9f4204b51a5d3299456ecc4ea6842
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * 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.
---
 src/casefiddle.c |   22 +++++++++++++++++++---
 src/search.c     |    3 ++-
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/casefiddle.c b/src/casefiddle.c
index 34a65ed..6114a6f 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;
 }
 
diff --git a/src/search.c b/src/search.c
index f39df67..7cb18a2 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2691,7 +2691,8 @@ since only regular expressions have distinguished 
subexpressions.  */)
 
   if (case_action == all_caps)
     Fupcase_region (make_number (search_regs.start[sub]),
-                   make_number (newpoint));
+                   make_number (newpoint),
+                   Qnil);
   else if (case_action == cap_initial)
     Fupcase_initials_region (make_number (search_regs.start[sub]),
                             make_number (newpoint));



reply via email to

[Prev in Thread] Current Thread [Next in Thread]