From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs 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 Organization: LINKOV.NET Message-ID: <87zj7b5s9t.fsf@mail.linkov.net> References: <87bnjyf29d.fsf@mail.linkov.net> <87h9tmov9h.fsf@mail.linkov.net> <877fugr6yn.fsf@mail.linkov.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1426621293 8375 80.91.229.3 (17 Mar 2015 19:41:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Mar 2015 19:41:33 +0000 (UTC) Cc: =?UTF-8?Q?P=C3=A5l_?= =?UTF-8?Q?Gr=C3=B8n=C3=A5s?= Drange , 20070@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 17 20:41:22 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YXxMb-0000L4-15 for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Mar 2015 20:41:17 +0100 Original-Received: from localhost ([::1]:56777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXxMa-0006Ge-AA for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Mar 2015 15:41:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXxMR-0006Bo-Qi for bug-gnu-emacs@gnu.org; Tue, 17 Mar 2015 15:41:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXxMM-0005SK-Rh for bug-gnu-emacs@gnu.org; Tue, 17 Mar 2015 15:41:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXxMM-0005SG-Nw for bug-gnu-emacs@gnu.org; Tue, 17 Mar 2015 15:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YXxMM-00085G-3p for bug-gnu-emacs@gnu.org; Tue, 17 Mar 2015 15:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Mar 2015 19:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20070 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20070-submit@debbugs.gnu.org id=B20070.142662123331030 (code B ref 20070); Tue, 17 Mar 2015 19:41:01 +0000 Original-Received: (at 20070) by debbugs.gnu.org; 17 Mar 2015 19:40:33 +0000 Original-Received: from localhost ([127.0.0.1]:50370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YXxLt-00084Q-7y for submit@debbugs.gnu.org; Tue, 17 Mar 2015 15:40:33 -0400 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:57986 helo=homiemail-a11.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YXxLr-00084I-Hv for 20070@debbugs.gnu.org; Tue, 17 Mar 2015 15:40:32 -0400 Original-Received: from homiemail-a11.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTP id B7AE76E072; Tue, 17 Mar 2015 12:40:30 -0700 (PDT) Original-Received: from localhost.linkov.net (82.131.98.6.cable.starman.ee [82.131.98.6]) (Authenticated sender: jurta@jurta.org) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTPA id A07A96E071; Tue, 17 Mar 2015 12:40:29 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Mon, 16 Mar 2015 18:08:28 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:100603 Archived-At: >> 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; }