]> code.delx.au - gnu-emacs/blobdiff - src/casefiddle.c
Don't install keyboard hook when debugged on MS-Windows
[gnu-emacs] / src / casefiddle.c
index 348215e532a488b5a4ce5c06fc0d29f8b243a731..6114a6f7857a83efa236ccfe22ef12745d075a86 100644 (file)
@@ -7,8 +7,8 @@ This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -196,7 +196,7 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
   ptrdiff_t start_byte;
 
   /* Position of first and last changes.  */
-  ptrdiff_t first = -1, last IF_LINT (= 0);
+  ptrdiff_t first = -1, last;
 
   ptrdiff_t opoint = PT;
   ptrdiff_t opoint_byte = PT_BYTE;
@@ -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;
 }