unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23655: 25.0.92; Upcasing a rectangular region of text
@ 2016-05-30  9:18 Dani Moncayo
  2016-05-30 21:11 ` Juri Linkov
  0 siblings, 1 reply; 3+ messages in thread
From: Dani Moncayo @ 2016-05-30  9:18 UTC (permalink / raw)
  To: 23655

[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]

0.  emacs -Q
1.  Eval: (put 'upcase-region 'disabled nil)
          (put 'downcase-region 'disabled nil)
2.  Visit the attached file.
3.  Move point to just after the comma.
4.  Define a *rectanguar* region: C-x <SPC> C-n C-e
5.  Downcase the rectangular region: C-x C-l
6.  Repeat steps #3 to #5, but this time for upcasing the region
    instead of downcasing it ('C-x C-u' instead of 'C-x C-l').

The upcased text in the last step is not only the one marked by the
rectangular region.  The upcasing command acts as if a linear
(i.e. non-rectangular) region was active at that moment.



In GNU Emacs 25.0.92.1 (i686-pc-mingw32)
 of 2016-04-22 built on LEG570
Repository revision: 2b31a0c21e51d39a82572a32d2d31b5a2aa174a3
Windowing system distributor 'Microsoft Corp.', version 6.1.7601
Configured using:
 'configure --host=i686-pc-mingw32'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS

Important settings:
  value of $LANG: ESN
  locale-coding-system: cp1252


-- 
Dani Moncayo

[-- Attachment #2: test1 --]
[-- Type: application/octet-stream, Size: 41 bytes --]

Hello, This little file
is an Example.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#23655: 25.0.92; Upcasing a rectangular region of text
  2016-05-30  9:18 bug#23655: 25.0.92; Upcasing a rectangular region of text Dani Moncayo
@ 2016-05-30 21:11 ` Juri Linkov
  2016-06-05 21:23   ` Juri Linkov
  0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2016-05-30 21:11 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 23655

> 0.  emacs -Q
> 1.  Eval: (put 'upcase-region 'disabled nil)
>           (put 'downcase-region 'disabled nil)
> 2.  Visit the attached file.
> 3.  Move point to just after the comma.
> 4.  Define a *rectanguar* region: C-x <SPC> C-n C-e
> 5.  Downcase the rectangular region: C-x C-l
> 6.  Repeat steps #3 to #5, but this time for upcasing the region
>     instead of downcasing it ('C-x C-u' instead of 'C-x C-l').
>
> The upcased text in the last step is not only the one marked by the
> rectangular region.  The upcasing command acts as if a linear
> (i.e. non-rectangular) region was active at that moment.

Thanks for the request.  Since we were unable to find a way to support
rectangular regions for all region-selecting commands en masse, here
is a patch to implement this individually for ‘upcase-region’:

diff --git a/src/casefiddle.c b/src/casefiddle.c
index c5bfa36..0a237d5 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -294,15 +294,31 @@
     }
 }
 
-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 @@ STRING that was matched (the original STRING itself is not altered).
 
   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));





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#23655: 25.0.92; Upcasing a rectangular region of text
  2016-05-30 21:11 ` Juri Linkov
@ 2016-06-05 21:23   ` Juri Linkov
  0 siblings, 0 replies; 3+ messages in thread
From: Juri Linkov @ 2016-06-05 21:23 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 23655-done

>> 0.  emacs -Q
>> 1.  Eval: (put 'upcase-region 'disabled nil)
>>           (put 'downcase-region 'disabled nil)
>> 2.  Visit the attached file.
>> 3.  Move point to just after the comma.
>> 4.  Define a *rectanguar* region: C-x <SPC> C-n C-e
>> 5.  Downcase the rectangular region: C-x C-l
>> 6.  Repeat steps #3 to #5, but this time for upcasing the region
>>     instead of downcasing it ('C-x C-u' instead of 'C-x C-l').
>>
>> The upcased text in the last step is not only the one marked by the
>> rectangular region.  The upcasing command acts as if a linear
>> (i.e. non-rectangular) region was active at that moment.
>
> Thanks for the request.  Since we were unable to find a way to support
> rectangular regions for all region-selecting commands en masse, here
> is a patch to implement this individually for ‘upcase-region’:

Pushed to master.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-05 21:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-30  9:18 bug#23655: 25.0.92; Upcasing a rectangular region of text Dani Moncayo
2016-05-30 21:11 ` Juri Linkov
2016-06-05 21:23   ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).