GNU bug report logs - #20070
24.3; have commands such as downcase-region act on a rectangle region

Previous Next

Package: emacs;

Reported by: Pål Grønås Drange <paal.drange <at> gmail.com>

Date: Tue, 10 Mar 2015 02:20:02 UTC

Severity: normal

Merged with 19829, 20626

Found in versions 24.3, 25.0.50

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Pål Grønås Drange <paal.drange <at> gmail.com>, 20070 <at> debbugs.gnu.org
Subject: bug#20070: 24.3; have commands such as downcase-region act on a rectangle region
Date: Tue, 17 Mar 2015 21:38:06 +0200
>> A list of pairs would be much cleaner, indeed.  The problem is that
>> there are 2 arguments already in region-handling commands: BEG and END.
>> Using one of them for a list of pairs, and leaving another unused
>> is not a nice thing to do.
>
> I think this "lack of niceness" is not strong enough to override the
> advantage of using a list of pairs.

I still have doubts about the API, but anyway here is the implementation
that (ab)uses the first arg BEG:

diff --git a/src/casefiddle.c b/src/casefiddle.c
index 8755353..b77a0e6 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -306,14 +306,25 @@
   return Qnil;
 }
 
-DEFUN ("downcase-region", Fdowncase_region, Sdowncase_region, 2, 2, "r",
+DEFUN ("downcase-region", Fdowncase_region, Sdowncase_region, 2, 2,
+       "(list (funcall region-extract-function 'positions) nil)",
        doc: /* Convert the region to lower 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.  */)
   (Lisp_Object beg, Lisp_Object end)
 {
-  casify_region (CASE_DOWN, beg, end);
+  if (CONSP (beg))
+    {
+      while (CONSP (beg))
+	{
+	  casify_region (CASE_DOWN, XCAR (XCAR (beg)), XCDR (XCAR (beg)));
+	  beg = XCDR (beg);
+	}
+    }
+  else
+    casify_region (CASE_DOWN, beg, end);
+
   return Qnil;
 }
 




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

Previous Next


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