summaryrefslogtreecommitdiff
path: root/lisp/pdf-view.el
diff options
context:
space:
mode:
authorVedang Manerikar <ved.manerikar@gmail.com>2022-11-29 11:43:45 +0530
committerVedang Manerikar <ved.manerikar@gmail.com>2022-11-29 11:43:45 +0530
commit1885cefc24883c220cdd4acafdf1d14f290a6979 (patch)
tree676d9983dccdd29c4f012e3da5aaf74a38c095fa /lisp/pdf-view.el
parentd6980bc3273e1cf1a73feee6bb523d1568405685 (diff)
parent997467ad3bcd23de22624c538d14863479b27cba (diff)
Merge branch 'feature/emacs-26.3'v1.0.0
Creating a merge commit in order to create a 1.0.0 tag. Note that this merge has breaking changes, as described in the NEWS section. * feature/emacs-26.3: autobuild: Recognize NetBSD and install packages via pkgin Bump the minimum Emacs version to 26.3! 🎉🤞 Extend docker testing framework to test against Emacs versions Update and cleanup the Install section Make sure pkg-config is correctly set in autobuild Add support for Alpine Linux to autobuild Render crisp images for HiDPI screens by default Remove Emacs 24.4 guards for cua-mode Remove compatibility function for image-mode-winprops Remove pdf-util-window-pixel-width, fallback to window-body-width Remove macro / function re-definitions Remove bugfix for imenu in Emacs 24.3 and below Remove guards in `pdf-virtual` tests and code. Explicitly declare documentation files as Org files Add a byteclean target in the Makefile
Diffstat (limited to 'lisp/pdf-view.el')
-rw-r--r--lisp/pdf-view.el37
1 files changed, 14 insertions, 23 deletions
diff --git a/lisp/pdf-view.el b/lisp/pdf-view.el
index 0820e8f..849be6a 100644
--- a/lisp/pdf-view.el
+++ b/lisp/pdf-view.el
@@ -86,7 +86,7 @@ FIXME: Explain dis-/advantages of imagemagick and png."
:group 'pdf-view
:type 'boolean)
-(defcustom pdf-view-use-scaling nil
+(defcustom pdf-view-use-scaling t
"Whether images should be allowed to be scaled for rendering.
This variable affects both the reuse of higher-resolution images
@@ -374,14 +374,6 @@ PNG images in Emacs buffers."
;; Enable transient-mark-mode, so region deactivation when quitting
;; will work.
(setq-local transient-mark-mode t)
- ;; In Emacs >= 24.4, `cua-copy-region' should have been advised when
- ;; loading pdf-view.el so as to make it work with
- ;; pdf-view-mode. Disable cua-mode if that is not the case.
- ;; FIXME: cua-mode is a global minor-mode, but setting cua-mode to
- ;; nil seems to do the trick.
- (when (and (bound-and-true-p cua-mode)
- (version< emacs-version "24.4"))
- (setq-local cua-mode nil))
(add-hook 'window-configuration-change-hook
'pdf-view-redisplay-some-windows nil t)
@@ -403,16 +395,15 @@ PNG images in Emacs buffers."
(pdf-view-check-incompatible-modes buffer)))
(current-buffer)))
-(unless (version< emacs-version "24.4")
- (advice-add 'cua-copy-region
- :before-until
- #'cua-copy-region--pdf-view-advice)
- (defun cua-copy-region--pdf-view-advice (&rest _)
- "If the current buffer is in `pdf-view' mode, call
-`pdf-view-kill-ring-save'."
- (when (eq major-mode 'pdf-view-mode)
- (pdf-view-kill-ring-save)
- t)))
+(advice-add 'cua-copy-region
+ :before-until
+ #'cua-copy-region--pdf-view-advice)
+
+(defun cua-copy-region--pdf-view-advice (&rest _)
+ "If the current buffer is in `pdf-view' mode, call `pdf-view-kill-ring-save'."
+ (when (eq major-mode 'pdf-view-mode)
+ (pdf-view-kill-ring-save)
+ t))
(defun pdf-view-check-incompatible-modes (&optional buffer)
"Check BUFFER for incompatible modes, maybe issue a warning."
@@ -964,9 +955,9 @@ See also `pdf-view-use-imagemagick'."
(let* ((size (pdf-view-desired-image-size page window))
(data (pdf-cache-renderpage
page (car size)
- (if (not pdf-view-use-scaling)
- (car size)
- (* 2 (car size)))))
+ (if pdf-view-use-scaling
+ (* 2 (car size))
+ (car size))))
(hotspots (pdf-view-apply-hotspot-functions
window page size)))
(pdf-view-create-image data
@@ -1135,7 +1126,7 @@ If WINDOW is t, redisplay pages in all windows."
(let* ((pagesize (pdf-cache-pagesize
(or page (pdf-view-current-page window))))
(slice (pdf-view-current-slice window))
- (width-scale (/ (/ (float (pdf-util-window-pixel-width window))
+ (width-scale (/ (/ (float (window-body-width window t))
(or (nth 2 slice) 1.0))
(float (car pagesize))))
(height (- (nth 3 (window-inside-pixel-edges window))