From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Deletion immediately after insertion should leave org-mode tables unaltered but it doesn't Date: Sun, 19 Nov 2017 00:37:56 +0100 Message-ID: <874lprp38r.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGCgW-0000vE-Mh for emacs-orgmode@gnu.org; Sat, 18 Nov 2017 18:38:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGCgS-0007iF-N3 for emacs-orgmode@gnu.org; Sat, 18 Nov 2017 18:38:04 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:43869) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eGCgS-0007hj-Gl for emacs-orgmode@gnu.org; Sat, 18 Nov 2017 18:38:00 -0500 In-Reply-To: (Ruy Exel's message of "Sat, 18 Nov 2017 11:38:55 -0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Ruy Exel Cc: emacs-orgmode@gnu.org Hello, Ruy Exel writes: > Given a simple table such as > > | Name | Age | > |-------+-----| > | John | 20 | > | Peter | 25 | > |-------+-----| > > place the cursor in the cell containing 'Age', insert two columns pressing > 'M-S-right' each time and, immediately after that, delete two columns with > "M-S-left". One would expect the table to return to its original state, > but is doesn't. In reality the table becomes > > | | Age | > |---+-----| > | | 20 | > | | 25 | > |---+-----| > > because the second deletion actually kills the column labeled "Name". > > Contrast this with the behaviour of inserting and deleting characters in > text-mode and you will see that the above behaviour is counter intuitive. > > I believe this is due to the fact that 'M-S-right' inserts a column at the > cursor, placing the cursor within the inserted column, while, after > deletion, the cursor is placed in the column to the LEFT of the deleted > column (except after deleting the leftmost column). > > A possible solution is to place the column to the RIGHT of the deleted > column after deletion (except after deleting the rightmost column). The deletion is triggered by pressing the arrow. Your suggestion would make the point move right. This is not optimal either. Maybe the other way is better. Since column creation is triggered by pressing arrow, we might create it to the right of the current column, and point would move into it. WDYT? Regards, -- Nicolas Goaziou