vedang / pdf-tools

Emacs support library for PDF files.
https://pdftools.wiki
GNU General Public License v3.0
619 stars 89 forks source link

Add command and submenu to switch between selection styles #190

Closed astoff closed 1 year ago

astoff commented 1 year ago

It might also make sense to find a keybinding to this new command, but I would leave that up to you to choose.

Incidentally, I wish it was possible to momentarily switch to a different selection style, say while holding shift, say with this command:

(defun pdf-view-finegrained-mouse-set-region ()
  (interactive)
  (let ((pdf-view-selection-style 'glyph)))
    (call-interactively #'pdf-view-mouse-set-region)))

But this doesn't work because pdf-view-active-region stores the area physically traced by the mouse, and the conversion so characters/words/lines is done only when using the region (e.g. to add an annotation).

I think it would make sense to store the selection style used for each selection, in the same vein of pdf-view--have-rectangle-region.

vedang commented 1 year ago

Merging this in, thanks for the contribution!