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#23655: 25.0.92; Upcasing a rectangular region of text Date: Tue, 31 May 2016 00:11:54 +0300 Organization: LINKOV.NET Message-ID: <87inxv1c9x.fsf@mail.linkov.net> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1464643371 5157 80.91.229.3 (30 May 2016 21:22:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 30 May 2016 21:22:51 +0000 (UTC) Cc: 23655@debbugs.gnu.org To: Dani Moncayo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 30 23:22:36 2016 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 1b7Udv-0003Tz-05 for geb-bug-gnu-emacs@m.gmane.org; Mon, 30 May 2016 23:22:35 +0200 Original-Received: from localhost ([::1]:33231 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7Udr-0005AJ-3N for geb-bug-gnu-emacs@m.gmane.org; Mon, 30 May 2016 17:22:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7UdX-00053v-Vv for bug-gnu-emacs@gnu.org; Mon, 30 May 2016 17:22:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7UdP-0000o3-FL for bug-gnu-emacs@gnu.org; Mon, 30 May 2016 17:22:10 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7UdP-0000nz-C5 for bug-gnu-emacs@gnu.org; Mon, 30 May 2016 17:22:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1b7UdP-0008DL-83 for bug-gnu-emacs@gnu.org; Mon, 30 May 2016 17:22:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 May 2016 21:22:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23655 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23655-submit@debbugs.gnu.org id=B23655.146464330931528 (code B ref 23655); Mon, 30 May 2016 21:22:03 +0000 Original-Received: (at 23655) by debbugs.gnu.org; 30 May 2016 21:21:49 +0000 Original-Received: from localhost ([127.0.0.1]:47812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b7UdB-0008CS-6E for submit@debbugs.gnu.org; Mon, 30 May 2016 17:21:49 -0400 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:50098 helo=homiemail-a11.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b7UdA-0008CL-7E for 23655@debbugs.gnu.org; Mon, 30 May 2016 17:21:48 -0400 Original-Received: from homiemail-a11.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTP id 3C6AF6E06C; Mon, 30 May 2016 14:21:45 -0700 (PDT) Original-Received: from localhost.linkov.net (85.253.58.75.cable.starman.ee [85.253.58.75]) (Authenticated sender: jurta@jurta.org) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTPA id 7067D6E06A; Mon, 30 May 2016 14:21:44 -0700 (PDT) In-Reply-To: (Dani Moncayo's message of "Mon, 30 May 2016 11:18:38 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:118874 Archived-At: > 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 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 =E2=80=98upcase-region=E2=80= =99: 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 @@ } } =20 -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 =3D Qnil; + + if (!NILP (region_noncontiguous_p)) + { + bounds =3D call1 (Fsymbol_value (intern ("region-extract-function"= )), + intern ("bounds")); + + while (CONSP (bounds)) + { + casify_region (CASE_UP, XCAR (XCAR (bounds)), XCDR (XCAR (bounds))); + bounds =3D XCDR (bounds); + } + } + else + casify_region (CASE_UP, beg, end); + return Qnil; } =20 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). =20 if (case_action =3D=3D all_caps) Fupcase_region (make_number (search_regs.start[sub]), - make_number (newpoint)); + make_number (newpoint), + Qnil); else if (case_action =3D=3D cap_initial) Fupcase_initials_region (make_number (search_regs.start[sub]), make_number (newpoint));