Problem with copy and paste in math formulas

When I try to copy and paste subformulas in texmacs in a document it is not working many times. It doesn’t copy or it doesn’t paste. This is my first article I like to write in texmacs. What am I doing wrong?

Thanks
Jan

Hi and welcome to the forum!

Are you using the emacs look and feel? In that case it happened to me as well, and it might be a bug, worth reporting—I did not yet check if it is already in the Savannah bug tracker. I would like to hear someone else too in this case, as there might be something that both I and you have missed (partially because of that, instead of the emacs look and feel I am using the default look and feel in Ubuntu, on which I did not experience the malfunctioning).

Could you please give a few more details to help identify the issue?

I am using texmacs for the first time. Before I used lyx. I am using ubuntu 20.04 and I think the latest texmacs. I thought that there was but one look and feel. I just checked my texmacs program and it was the default look and feel. I am not an emacs user but this default look and feel looks like emacs.I have now tried another one (gnome, kde, macos) and did some little tests and copy and paste of subformulas seems to work. Which look and feel do you use?

Thanks

I use the default look and feel on ubuntu 20.10 (TeXmacs 1.99.19, static binary install), but in my copy of the software it looks like the Windows one (ctrl-c is bound to copy and so on).
I have experienced the same malfunctioning you cited (copy sometimes not working in my case) when I had the emacs look and feel (meta-w bound to copy, which turned out with my layout to be esc-w, instead of the alt-w I was expecting!).

I do not know why in my system the default is different from yours, and I “sort of” recall that I have had an emacs default in the past. I have played a bit with some of the TeXmacs configuration files, but I do not think that I changed the defaults there.

Said this

  • I am happy that changing “look and feel” makes copy-pasting work for you
  • I will inquire in the mailing list about copy-pasting with the emacs look and feel, let you know if there is any information

The copy and paste did sometimes work and also sometimes not. I thought it was perhaps an incorrect semantics formula.

For me too. My impression was that it was the copy that wasn’t working. Let me update you from the mailing list in case I get information there.

One could activate some debugging output via the Develop menu to see if the keystrokes are received correctly. Also it is interesting to understand better if one can make the problem reproducible (maybe some previous keystroke affects the processing).

I did it through Debugging tool, with the options auto and keyboard enabled and the Emacs look and feel. The following is the output when pressing esc-w with the string “ciao” selected; it results on “ciwao”. Other examples follow where I obtained different behaviour in the same session with the same document—hopefully you are able to make sense of the information.

TeXmacs] debug-keyboard, Got focus at 366038
TeXmacs] debug-keyboard, Lost focus at 368288
TeXmacs] debug-keyboard, Got focus at 369168
TeXmacs] debug-keyboard, Pressed escape at 370269
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape -> escape -> M-
TeXmacs] debug-keyboard, Pressed escape at 370770
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape escape -> escape escape -> A-
TeXmacs] debug-keyboard, Pressed escape at 370863
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape escape escape -> escape escape escape -> C-
TeXmacs] debug-keyboard, Pressed escape at 370933
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape escape escape escape -> escape escape escape escape -> noop
TeXmacs] debug-keyboard, Pressed escape at 370933
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape escape escape escape escape -> escape escape escape escape escape -> noop M-
TeXmacs] debug-keyboard, escape -> escape -> M-
TeXmacs] debug-keyboard, Pressed escape at 371150
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape escape -> escape escape -> A-
TeXmacs] debug-keyboard, Pressed escape at 371150
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape escape escape -> escape escape escape -> C-
TeXmacs] debug-keyboard, Pressed escape at 371150
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape escape escape escape -> escape escape escape escape -> noop
TeXmacs] debug-keyboard, Pressed w at 371150
TeXmacs] debug-keyboard,   Codes 119
TeXmacs] debug-keyboard, escape escape escape escape w -> escape escape escape escape w -> noop w
TeXmacs] debug-keyboard, w -> w -> w
TeXmacs] debug-keyboard, Lost focus at 372480

In this other occasion (same document, same session), esc-w acted as cut:

TeXmacs] debug-keyboard, Got focus at 878833
TeXmacs] debug-keyboard, Pressed escape at 882454
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape -> escape -> M-
TeXmacs] debug-keyboard, Pressed escape at 882956
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape escape -> escape escape -> A-
TeXmacs] debug-keyboard, Pressed escape at 883006
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape escape escape -> escape escape escape -> C-
TeXmacs] debug-keyboard, Pressed escape at 883056
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape escape escape escape -> escape escape escape escape -> noop
TeXmacs] debug-keyboard, Pressed escape at 883107
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape escape escape escape escape -> escape escape escape escape escape -> noop M-
TeXmacs] debug-keyboard, escape -> escape -> M-
TeXmacs] debug-keyboard, Pressed escape at 883157
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape escape -> escape escape -> A-
TeXmacs] debug-keyboard, Pressed escape at 883207
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape escape escape -> escape escape escape -> C-
TeXmacs] debug-keyboard, Pressed w at 883214
TeXmacs] debug-keyboard,   Codes 119
TeXmacs] debug-keyboard, escape escape escape w -> escape escape escape w -> C-w
TeXmacs] debug-keyboard, Lost focus at 884434
TeXmacs] debug-keyboard, Got focus at 886280
TeXmacs] debug-keyboard, Pressed C-y at 889598
TeXmacs] debug-keyboard,   Codes 67 45 121
TeXmacs] debug-keyboard, escape escape escape w C-y -> escape escape escape w C-y -> C-w C-y
TeXmacs] debug-keyboard, C-y -> C-y -> C-y
TeXmacs] debug-keyboard, Lost focus at 890466

I saw only a few times the behaviour “copy”. Here is one case.

TeXmacs] debug-keyboard, Got focus at 1010665
TeXmacs] debug-keyboard, Lost focus at 1012800
TeXmacs] debug-keyboard, Got focus at 1126272
TeXmacs] debug-keyboard, Pressed r at 1132079
TeXmacs] debug-keyboard,   Codes 114
TeXmacs] debug-keyboard, escape escape escape w r -> escape escape escape w r -> C-w r
TeXmacs] debug-keyboard, r -> r -> r
TeXmacs] debug-keyboard, Pressed o at 1132199
TeXmacs] debug-keyboard,   Codes 111
TeXmacs] debug-keyboard, o -> o -> o
TeXmacs] debug-keyboard, Pressed c at 1132474
TeXmacs] debug-keyboard,   Codes 99
TeXmacs] debug-keyboard, c -> c -> c
TeXmacs] debug-keyboard, Pressed k at 1132551
TeXmacs] debug-keyboard,   Codes 107
TeXmacs] debug-keyboard, k -> k -> k
TeXmacs] debug-keyboard, Pressed s at 1132711
TeXmacs] debug-keyboard,   Codes 115
TeXmacs] debug-keyboard, s -> s -> s
TeXmacs] debug-keyboard, Pressed escape at 1136039
TeXmacs] debug-keyboard,   Codes 101 115 99 97 112 101
TeXmacs] debug-keyboard, escape -> escape -> M-
TeXmacs] debug-keyboard, Pressed w at 1136479
TeXmacs] debug-keyboard,   Codes 119
TeXmacs] debug-keyboard, escape w -> escape w -> M-w
TeXmacs] debug-keyboard, Lost focus at 1140065
TeXmacs] debug-keyboard, Got focus at 1150343
TeXmacs] debug-keyboard, Pressed return at 1152511
TeXmacs] debug-keyboard,   Codes 114 101 116 117 114 110
TeXmacs] debug-keyboard, return -> return -> return
TeXmacs] debug-keyboard, Pressed C-y at 1153287
TeXmacs] debug-keyboard,   Codes 67 45 121
TeXmacs] debug-keyboard, return C-y -> return C-y -> return C-y
TeXmacs] debug-keyboard, C-y -> C-y -> C-y
TeXmacs] debug-keyboard, Lost focus at 1154215

It seems that TeXmacs thinks you pressed escape several times, resulting in it cycling through the alternatives “M-” “A-” “C-” and “noop”. In each case you pressed Esc only once, right?

Yes, but I wonder if that happens because with esc I am slower to press also the w key.
EDIT: after testing it, it is because I am slower. I will re-map the key, in fact I prefer alt-w for copying.

It may be that the reason why @jan cannot copy is a different one, it would be interesting to hear.

Note that the Esc key is not a modifier key so the right key combination is that you press Esc and then (without keeping Esc pressed) you press other keys, e.g. W, so Esc should be recorded only once. I do not understand why it fires repeatedly.

I had not understood this :slight_smile:
The multiple firing came from me trying to use esc as a modifier key and being slow to reach the w while keeping esc pressed.
Perhaps I could get used to esc-w for copying—although as far as I know it is alt-w for emacs, so I am keeping that :wink:

I don’t use the keyboard for copy and paste. I use the mouse and the menu: “Edit ->Copy” and “Edit->Paste”. So perhaps could it be the “look and feel” that is wrong; I use now another one. Is it possible that nothing has been copied? IThen why?

Perhaps in this case the output of the debugging tool could be helpful—if you are able to get the malfunctioning to happen at least some times.
To activate it, go to tools and click on “Debugging tool”; then you will have a new entry in the menu, Debug; from that, select the submenu qt; I do not know if you have to select other submenus as well, perhaps @mgubi and @jeroen do; I am leaving the entry “auto” selected as well.
Start TeXmacs from the terminal (with texmacs &), where you will see debugging output that looks like this


(it is the debug output of copy-paste on a formula with the emacs look and feel, TeXmacs 1.99.19 on Ubuntu 20.10).
Looking forward to some info, then we will see if we can figure out the reason for the malfunctioning you observe or it needs to be reported in the bug tracker.

A tool like GPaste can also be useful to see if the clipboard is really altered after copying.

Also some more context and a precise description of the sequence of actions would be useful to track down the problem. Sometime I experience problems with copy and paste on the Mac but usually depends on the target program: i.e. sometimes pasting from TeXmacs to program X does not work but if I try with program Y it does work. (take e.g. X=Mail and Y=TextEdit).