1

It's similar problem Copy and Paste From PDF to Emacs as Plain Text When I copy text from pdf and yank to org mode I have to run manually unfill-paragraph function to remove unnecessary newlines & spaces. How I can automate the process?

I think condition would look like this -> If text is copied from pdf on yank run unfill-paragraph.

  • 1
    Does this answer your question? Binding a series of commands to a key – Tyler Mar 11 at 21:10
  • I think this is a duplicate of another question. The other question is about different commands, but the solution applies here just as well: create a new function that includes both of the commands you want to run (yank and unfill-paragraph), and bind that function to a new keybinding. – Tyler Mar 11 at 21:12
  • 1
    But I need to apply this functionality only to text copied from pdf. A that's makes a difference. – slk500 Mar 11 at 22:36
  • 1
    I don’t believe it is possible for Emacs to determine where some text originated. Your best bet would be a custom key binding for your own “paste and reformat” command. – glucas Mar 12 at 9:54
  • Ok, that's more involved. I think you can do this by applying a text property to the text as you copy it from the pdf, and setting up a yank-handler to check for that property and call fill-paragraph when you paste it. I'll need some time to look into that; maybe someone else can answer faster! – Tyler Mar 12 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.