1

I have JSON files in which I am folding away some subnodes with the hideshow mode.

This works reasonably well. Now I want to create a new file or buffer with the folded content.

For example, my folded JSON buffer looks like:

{
  "type": "Helper",
  "name": "Walter",
  "skills": {...}
}

Then I want to copy exactly this text (with the three dots).

However, when I copy the buffer to the clipboard and paste it in another buffer, I get in the new buffer the expanded version:

{
  "type": "Helper",
  "name": "Walter",
  "skills": {
     "type": "list",
     "list": [ "latin", "maths" ]
  }
}

How can I tell Emacs to copy the text it displays, not the text which is in the underlying buffer?

PS: I tried origami.el as well - same problem.

Drew
  • 75,699
  • 9
  • 109
  • 225
halloleo
  • 1,215
  • 9
  • 23
  • Related: https://emacs.stackexchange.com/questions/13480/copy-text-as-it-is-rendered-by-emacs – Tobias Dec 06 '21 at 04:19
  • IIUC you want to save overlays as text: perhaps https://www.emacswiki.org/emacs/OverlaysToText helps? – NickD Dec 06 '21 at 16:47

0 Answers0