[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pdf-tools 5b58c6bcc3 3/8: Add command and submenu to switc
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pdf-tools 5b58c6bcc3 3/8: Add command and submenu to switch between selection styles |
Date: |
Sat, 10 Jun 2023 16:02:07 -0400 (EDT) |
branch: elpa/pdf-tools
commit 5b58c6bcc3744c9ad984ba60448f8e98b994f913
Author: Augusto Stoffel <arstoffel@gmail.com>
Commit: Vedang Manerikar <ved.manerikar@gmail.com>
Add command and submenu to switch between selection styles
Make it possible to set `pdf-view-selection-style` from Easy Menu.
Closes: #190
---
lisp/pdf-misc.el | 13 +++++++++++++
lisp/pdf-view.el | 14 ++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/lisp/pdf-misc.el b/lisp/pdf-misc.el
index b6bb896d1a..bcba8aeabc 100644
--- a/lisp/pdf-misc.el
+++ b/lisp/pdf-misc.el
@@ -143,6 +143,19 @@
["Copy region" pdf-view-kill-ring-save
:keys "\\[kill-ring-save]"
:active (pdf-view-active-region-p)]
+ ("Selection style"
+ ["Glyph" (pdf-view-set-selection-style 'glyph)
+ :style radio
+ :selected (eq pdf-view-selection-style 'glyph)
+ :help "When dragging the mouse, select individual characters."]
+ ["Word" (pdf-view-set-selection-style 'word)
+ :style radio
+ :selected (eq pdf-view-selection-style 'word)
+ :help "When dragging the mouse, select entire words."]
+ ["Line" (pdf-view-set-selection-style 'line)
+ :style radio
+ :selected (eq pdf-view-selection-style 'line)
+ :help "When dragging the mouse, select entire lines."])
"--"
["Isearch document" isearch-forward
:visible (bound-and-true-p pdf-isearch-minor-mode)]
diff --git a/lisp/pdf-view.el b/lisp/pdf-view.el
index c1fc21b754..9253721e7a 100644
--- a/lisp/pdf-view.el
+++ b/lisp/pdf-view.el
@@ -1624,6 +1624,20 @@ the `convert' program is used."
(dolist (f (cons result images))
(when (file-exists-p f)
(delete-file f))))))
+
+(defun pdf-view-set-selection-style (&optional style)
+ "Set `pdf-view-selection-style' to STYLE in the current buffer.
+
+When called interactively or without an argument, cycle between
+the selection styles."
+ (interactive)
+ (unless style
+ (setq style (or (cadr (memq pdf-view-selection-style '(glyph word line)))
+ 'glyph))
+ (message "Setting selection style to `%s'." style))
+ (pdf-view-deactivate-region)
+ (setq-local pdf-view-selection-style style))
+
;; * ================================================================== *
;; * Bookmark + Register Integration
- [nongnu] elpa/pdf-tools updated (a9c9a12c3e -> 70865fb38d), ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools 70865fb38d 8/8: Fix: Keep cursor on the same line when reopening list of annots, ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools fb6616c15e 2/8: Add an FAQ on re-compiling epdfinfo, ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools c451c0e3db 1/8: Auto enable pdf-view-dark-minor-mode if the theme is dark, ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools 154e31dc3c 4/8: Display a header line when editing annotation contents, ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools 0822f438de 7/8: Update NEWS with recent contributions, ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools 5b58c6bcc3 3/8: Add command and submenu to switch between selection styles,
ELPA Syncer <=
- [nongnu] elpa/pdf-tools 6a86b29140 5/8: Use 'C-c C-k' to abandon edits of annotation contents, ELPA Syncer, 2023/06/10
- [nongnu] elpa/pdf-tools 97cffdd1b2 6/8: Allow creation of markup annotations without a text selection, ELPA Syncer, 2023/06/10