1

When reading PDF documents, I frequently find typos and sometimes more serious errors. I try to keep track of those findings with the intention of sending them to the authors or publishers, but doing it by hand just takes too much time. How to automate the process?

1 Answer 1

1

I wrote a bit of Elisp code that creates a skeletal errata entry for me and places it in the kill-ring:

(defun prepare-errata-entry ()
  "Prepare an errata entry based on pdf-mode selection and place
it in the kill-ring."
  (interactive)
  (if (equal major-mode 'pdf-view-mode)
      (let ((page (pdf-view-current-page))
        (text (replace-regexp-in-string
           "\n" " " (car (pdf-view-active-region-text)))))
    (pdf-view-deactivate-region)
    (kill-new (format "Page %d: %s -> %s" page text text)))
    (message "Not in pdf-view mode!")))

It's pretty self-explanatory. Given a region marked in the PDF, it extracts the text and page number, creates a skeletal entry, deactivates the region and kills the newly formed string. If the function is called outside of pdf-view-mode, a warning message is displayed. Having the entry at hand, I can quickly jump to where I'm storing such things (Org-mode document in my case) and add the entry, fixing the typo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.