pdf-tools
pdf-tools copied to clipboard
Keep the selection while copying and highlighting
When I make a comment in a pdf file using pdf-tools I first select the text and then operate on it, using one of the highlight options. If I want to copy text I do the same. However, many times I would like both to highlight and copy at the same time, but if I perform either a copy or highlight the text is thereafter immediately deselected. I would like to change this behavior, so that selection persists. Is this possible?
Currently this is not supported. It is relatively easy to add this as a feature to the copy command, and slightly more difficult to add it as a feature to the annot commands.
I will happily accept a PR for this which introduces a flag to control the desired behaviour.
I have a customized function to do copy and then org-capture and then a default highlight style. You may try to remove the org-capture and bind this new function to a key shortcut.
(defun capture-notes-as-highlighting()
(interactive)
(kill-new (replace-regexp-in-string "-\n" "" (car (pdf-view-active-region-text))))
(org-capture 1 "Q")
(org-capture-finalize)
(pdf-annot-add-highlight-markup-annotation (pdf-view-active-region t) "yellow")
)
This works when you bind a key to it. Ideally one would also like to integrate it with the right click menu.