9

I use several modes that display Unicode characters in my code without changing the underlying file. For example, in Haskell mode, the following code:

foo :: forall a. Eq a => a -> a -> a

gets displayed as

foo ∷ ∀ a. Eq a ⇒ a → a → a

This is implemented with compose-region, which can replace a region with a character without changing the actual buffer text.

When I copy the code, however, it copies the underlying text without the Unicode. Most of the time this is the desired behavior, but sometimes I want to copy the displayed characters instead—I had to type up the second version of my example myself!

How can I copy the result of character substitutions like this rather than the underlying text? (In fact, I'm not sure this is possible at all!)

Tikhon Jelvis
  • 6,152
  • 2
  • 27
  • 40
  • 2
    If somebody could swoop in and provide some sort of generic `copy-visible` function, that would be awesome. – nispio Oct 15 '14 at 18:29

1 Answers1

4

I tried to do this myself and did not find a good solution. It seems like it CAN be done by manually composing the buffer's text based on the composition property and the composition function table.

In the past I have solved this by running emacs in a terminal and and using my mouse to select and copy the text displayed.

Clearly not a good solution, but it works in times of need, you can then paste "visible" text back in by doing an OS paste into the terminal.

Jordon Biondo
  • 12,332
  • 2
  • 41
  • 62