unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Two column editing
@ 2020-05-05  4:46 Jean-Christophe Helary
  2020-05-05  9:48 ` Noam Postavsky
  0 siblings, 1 reply; 7+ messages in thread
From: Jean-Christophe Helary @ 2020-05-05  4:46 UTC (permalink / raw)
  To: Emacs developers

I discovered inadvertently the existence of two columns editing mode by hitting F2 while working in emacs.

As I did not understand what I was seeing on the screen, I checked what F2 was assigned to and discovered that two-column edit mode.

The emacs manual section about two columns editing does not seem to correspond to what I am seeing, so I'd like to confirm that I'm not missing something.

1) I open a TSV file
2) I put point at the right of the TAB character that separates my two columns
3) I hit C-x 6 s

What I see (in the recent tab mode) is:

1) The name of the buffer of the original file, on the right of my tab bar
2) The newly created 2C/<original file name> buffer
3) That buffer is empty

What I expected to see:

A split window with

- A left-hand buffer that contains the left-hand column
- A right-hand buffer that contains the right-hand column

On the user list, Emanuel Berg suggested that I look at the code to find examples. I see that the code dates from 1992 and that it seems to have been included to handle bilingual aligned texts (the example is a bilingual aligned Esperanto/English explanation of the mode).

I tried the same with emacs -nw and found a similar behavior.

First question: what am I missing ?


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two column editing
  2020-05-05  4:46 Two column editing Jean-Christophe Helary
@ 2020-05-05  9:48 ` Noam Postavsky
  2020-05-05  9:53   ` Jean-Christophe Helary
  0 siblings, 1 reply; 7+ messages in thread
From: Noam Postavsky @ 2020-05-05  9:48 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: Emacs developers

On Tue, 5 May 2020 at 00:46, Jean-Christophe Helary
<jean.christophe.helary@traduction-libre.org> wrote:

> On the user list, Emanuel Berg suggested that I look at the code to find examples.

There's a minimal (one line) example in the docstring of 2C-split:

First column’s text    sSs  Second column’s text
                       \___/\
                        /    \
   5 character Separator      You type  M-5 C-x 6 s  with the point here.


> First question: what am I missing ?

I think you're missing the prefix argument.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two column editing
  2020-05-05  9:48 ` Noam Postavsky
@ 2020-05-05  9:53   ` Jean-Christophe Helary
  2020-05-05 10:13     ` Noam Postavsky
  0 siblings, 1 reply; 7+ messages in thread
From: Jean-Christophe Helary @ 2020-05-05  9:53 UTC (permalink / raw)
  To: Emacs developers



> On May 5, 2020, at 18:48, Noam Postavsky <npostavs@gmail.com> wrote:
> 
> On Tue, 5 May 2020 at 00:46, Jean-Christophe Helary
> <jean.christophe.helary@traduction-libre.org> wrote:
> 
>> On the user list, Emanuel Berg suggested that I look at the code to find examples.
> 
> There's a minimal (one line) example in the docstring of 2C-split:
> 
> First column’s text    sSs  Second column’s text
>                       \___/\
>                        /    \
>   5 character Separator      You type  M-5 C-x 6 s  with the point here.
> 
> 
>> First question: what am I missing ?
> 
> I think you're missing the prefix argument.

Yes, but, the manual says:

"F2 s or C-x 6 s looks for a column separator, which is a string that appears on each line between the two columns. You can specify the width of the separator with a numeric argument to F2 s; that many characters, before point, constitute the separator string. By default, the width is 1, so the column separator is the character before point."

So if the default is 1 my 1 character wide TAB should do the trick, shouldn't it ?

Just out or curiosity I tried M-1 C-x 6 s and the same thing happened.


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two column editing
  2020-05-05  9:53   ` Jean-Christophe Helary
@ 2020-05-05 10:13     ` Noam Postavsky
  2020-05-05 10:28       ` Jean-Christophe Helary
  0 siblings, 1 reply; 7+ messages in thread
From: Noam Postavsky @ 2020-05-05 10:13 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: Emacs developers

On Tue, 5 May 2020 at 05:53, Jean-Christophe Helary
<jean.christophe.helary@traduction-libre.org> wrote:

> So if the default is 1 my 1 character wide TAB should do the trick, shouldn't it ?
>
> Just out or curiosity I tried M-1 C-x 6 s and the same thing happened.

Hmm, you're right. Well it works for me. Can you reproduce the issue
from 'emacs -Q'? (you should probably take this to the bug list)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two column editing
  2020-05-05 10:13     ` Noam Postavsky
@ 2020-05-05 10:28       ` Jean-Christophe Helary
  2020-05-05 10:42         ` Noam Postavsky
  0 siblings, 1 reply; 7+ messages in thread
From: Jean-Christophe Helary @ 2020-05-05 10:28 UTC (permalink / raw)
  To: Emacs developers



> On May 5, 2020, at 19:13, Noam Postavsky <npostavs@gmail.com> wrote:
> 
> On Tue, 5 May 2020 at 05:53, Jean-Christophe Helary
> <jean.christophe.helary@traduction-libre.org> wrote:
> 
>> So if the default is 1 my 1 character wide TAB should do the trick, shouldn't it ?
>> 
>> Just out or curiosity I tried M-1 C-x 6 s and the same thing happened.
> 
> Hmm, you're right. Well it works for me. Can you reproduce the issue
> from 'emacs -Q'? (you should probably take this to the bug list)

Ok, with -Q it kind of works on my file.

I say kind of because one line that has a slightly longer string left-hand is not split at all even though it is a pure TSV file.

When I split based on that line, then the other lines are not split.

So, that's one bug I did not expect...

Have you tried that with the new tab-bar/line mode ?

Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two column editing
  2020-05-05 10:28       ` Jean-Christophe Helary
@ 2020-05-05 10:42         ` Noam Postavsky
  2020-05-05 13:00           ` Jean-Christophe Helary
  0 siblings, 1 reply; 7+ messages in thread
From: Noam Postavsky @ 2020-05-05 10:42 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: Emacs developers

On Tue, 5 May 2020 at 06:28, Jean-Christophe Helary
<jean.christophe.helary@traduction-libre.org> wrote:

> I say kind of because one line that has a slightly longer string left-hand is not split at all even though it is a pure TSV file.
>
> When I split based on that line, then the other lines are not split.
>
> So, that's one bug I did not expect...

The docstring says  "Only lines that have the ARG same preceding
characters at that column get split." so I think that is to be
expected.

> Have you tried that with the new tab-bar/line mode ?

I did try after doing M-x tab-bar-mode and it still worked fine. I
tried now also after M-x tab-line-mode and it works, although the tab
line messes up the alignment since it's only on the left-hand buffer.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two column editing
  2020-05-05 10:42         ` Noam Postavsky
@ 2020-05-05 13:00           ` Jean-Christophe Helary
  0 siblings, 0 replies; 7+ messages in thread
From: Jean-Christophe Helary @ 2020-05-05 13:00 UTC (permalink / raw)
  To: Emacs developers



> On May 5, 2020, at 19:42, Noam Postavsky <npostavs@gmail.com> wrote:
> 
> On Tue, 5 May 2020 at 06:28, Jean-Christophe Helary
> <jean.christophe.helary@traduction-libre.org> wrote:
> 
>> I say kind of because one line that has a slightly longer string left-hand is not split at all even though it is a pure TSV file.
>> 
>> When I split based on that line, then the other lines are not split.
>> 
>> So, that's one bug I did not expect...
> 
> The docstring says  "Only lines that have the ARG same preceding
> characters at that column get split." so I think that is to be
> expected.

Thank you Noam. I've closed the bug. The behavior was not clear by just reading the documentation.

>> Have you tried that with the new tab-bar/line mode ?
> 
> I did try after doing M-x tab-bar-mode and it still worked fine. I
> tried now also after M-x tab-line-mode and it works, although the tab
> line messes up the alignment since it's only on the left-hand buffer.

Thank you for trying. I won't be testing further because the mode is not very helpful for my use case (editing TSV files).

Now that my first question has found an answer, here come my second question.

This mode is the only one along with help to be assigned a prefix function key. F1 for help and F2 for 2C editing. The prefix is mentioned in the very first chapters of the manual and C-x 6 is mentioned at the same level as C-x 4 and C-x 5.

Since the code dates back from 92 I guess it was considered important enough at the time to get that F2 prefix. But is it widely used now ? I'm not finding a lot of references to it on the net.




Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-05-05 13:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-05  4:46 Two column editing Jean-Christophe Helary
2020-05-05  9:48 ` Noam Postavsky
2020-05-05  9:53   ` Jean-Christophe Helary
2020-05-05 10:13     ` Noam Postavsky
2020-05-05 10:28       ` Jean-Christophe Helary
2020-05-05 10:42         ` Noam Postavsky
2020-05-05 13:00           ` Jean-Christophe Helary

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).