GNU bug report logs - #23655
25.0.92; Upcasing a rectangular region of text

Previous Next

Package: emacs;

Reported by: Dani Moncayo <dmoncayo <at> gmail.com>

Date: Mon, 30 May 2016 09:19:02 UTC

Severity: normal

Tags: patch

Found in version 25.0.92

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23655 in the body.
You can then email your comments to 23655 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23655; Package emacs. (Mon, 30 May 2016 09:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dani Moncayo <dmoncayo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 30 May 2016 09:19:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: 25.0.92; Upcasing a rectangular region of text
Date: Mon, 30 May 2016 11:18:38 +0200
[Message part 1 (text/plain, inline)]
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
[test1 (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23655; Package emacs. (Mon, 30 May 2016 21:22:03 GMT) Full text and rfc822 format available.

Message #8 received at 23655 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 23655 <at> debbugs.gnu.org
Subject: Re: bug#23655: 25.0.92; Upcasing a rectangular region of text
Date: Tue, 31 May 2016 00:11:54 +0300
> 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));




Reply sent to Juri Linkov <juri <at> linkov.net>:
You have taken responsibility. (Sun, 05 Jun 2016 21:24:02 GMT) Full text and rfc822 format available.

Notification sent to Dani Moncayo <dmoncayo <at> gmail.com>:
bug acknowledged by developer. (Sun, 05 Jun 2016 21:24:02 GMT) Full text and rfc822 format available.

Message #13 received at 23655-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 23655-done <at> debbugs.gnu.org
Subject: Re: bug#23655: 25.0.92; Upcasing a rectangular region of text
Date: Mon, 06 Jun 2016 00:23:32 +0300
>> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 04 Jul 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 46 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.