From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tor Kringeland Newsgroups: gmane.emacs.bugs Subject: bug#52265: Wishlist: Behavior of rectangles when last line is short Date: Sat, 04 Dec 2021 00:06:52 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40184"; mail-complaints-to="usenet@ciao.gmane.io" To: 52265@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 04 00:08:30 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mtHfJ-000AE9-VX for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Dec 2021 00:08:30 +0100 Original-Received: from localhost ([::1]:39352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtHfI-0002f5-EP for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Dec 2021 18:08:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtHes-0002cb-Ag for bug-gnu-emacs@gnu.org; Fri, 03 Dec 2021 18:08:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40847) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mtHes-0007OH-2w for bug-gnu-emacs@gnu.org; Fri, 03 Dec 2021 18:08:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mtHer-00005e-Uz for bug-gnu-emacs@gnu.org; Fri, 03 Dec 2021 18:08:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tor Kringeland Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Dec 2021 23:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52265 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.163857282532720 (code B ref -1); Fri, 03 Dec 2021 23:08:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Dec 2021 23:07:05 +0000 Original-Received: from localhost ([127.0.0.1]:52387 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mtHdx-0008Vg-8f for submit@debbugs.gnu.org; Fri, 03 Dec 2021 18:07:05 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:40224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mtHdu-0008VX-3Q for submit@debbugs.gnu.org; Fri, 03 Dec 2021 18:07:04 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtHdt-00024P-Nr for bug-gnu-emacs@gnu.org; Fri, 03 Dec 2021 18:07:01 -0500 Original-Received: from mailgw301.it.ntnu.no ([129.241.56.179]:42806) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtHdq-0007HN-Q9 for bug-gnu-emacs@gnu.org; Fri, 03 Dec 2021 18:07:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntnu.no; i=@ntnu.no; q=dns/txt; s=s1-1909-ntnu; t=1638572815; h=from : to : subject : date : message-id : mime-version : content-type : from; bh=QaofCOdZiSLUp42x75etcNnn9VSJu1b8pc3ydbhJiWg=; b=gkuND2H/h5cTUBI0t6Libubg3vAUfyR7E7R76+nZ74OLsqbxS4dw0NzWOZkc94j9EKv7M m3jIt2ra4uzQUOFIavbvNRjTGV9u6j/R8427D0b3BMPZ7P8fq1dtvats0B22IJ3M1gmpR+7 ytsyyoaPWDABHeH7rb1Q9v+zfz9fUrAGEiFmsSQURUo1vH39MhgLv1ZS1hHIfKPn2gBICur eULNvZG6qAoh0N5S03Lg43ZOPJ+oy1HvbKk2CdJyMjANKf8noRe7h3bH+kW1VY8Zv7xzolA hmyg69R0N1pUoPCurfAB1dnkJl6WDW3aiQeZpwYQiVPC1dbvEm9JTaUl5W9w== Original-Received: from localhost (localhost [127.0.0.1]) by mailgw301.it.ntnu.no (Postfix) with ESMTP id 6D5D86829DF for ; Sat, 4 Dec 2021 00:06:55 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mailgw301.it.ntnu.no Original-Received: from mailgw301.it.ntnu.no ([127.0.0.1]) by localhost (mailgw301.it.ntnu.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S5rOT0kHHCzg for ; Sat, 4 Dec 2021 00:06:55 +0100 (CET) Original-Received: from localhost (unknown [91.219.215.154]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: takringe@ntnu.no) by mailgw301.it.ntnu.no (Postfix) with ESMTPSA id D4008680A0F for ; Sat, 4 Dec 2021 00:06:54 +0100 (CET) Received-SPF: pass client-ip=129.241.56.179; envelope-from=tor.a.s.kringeland@ntnu.no; helo=mailgw301.it.ntnu.no X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:221418 Archived-At: Suppose we have the following text text123 more text text first second third and want to turn it into text123,first more text,second text,third using rectangles. This is problematic since the last line is shorter than the two before. A solution to this [1] is to add spaces at the end of the last line until it becomes the longest, mark the last three lines with POINT being at the end of the spaces and then kill the rectangle. Since the first line is shorter than the two following, one has to add spaces here as well to make it the longest. After yanking the rectangle, we're left with text123 first more text second text third This is far along the way, but I can't think of a last step to make it into CSV format except by doing it manually. I have a few suggestions for making this better: 1. When moving POINT to the the empty line below the line containing "third" and killing the region starting on the line with "first", nothing happens. How about having the whole region killed as a rectangle in this case? 2. Having a user option or prefix argument affecting `yank-rectangle' which when active would /e.g./ prompt the user for a string to insert, instead of filling the space between the lines and the yanked rectangle with tabs/spaces. Optionally, just place the given string in front of the rectangle and put it at the end of the lines, without worrying about visual alignment (so you wouldn't have to worry about the first line being the longest). With these two items, killing the first rectangle and yanking it (with the prefix) at the end of the line would produce the desired text. - [1] https://stackoverflow.com/a/8411061