Skip to content

Commit

Permalink
Remove pdf-util-window-pixel-width, fallback to window-body-width
Browse files Browse the repository at this point in the history
`window-body-width` is available for us to use in Emacs 26.3

Relates to: vedang#26
  • Loading branch information
vedang committed Oct 10, 2022
1 parent ce5ed34 commit 3af6141
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
10 changes: 0 additions & 10 deletions lisp/pdf-util.el
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,6 @@
;; * Compatibility with older Emacssen (< 25.1)
;; * ================================================================== *

;; In Emacs 24.3 window-width does not have a PIXELWISE argument.
(defmacro pdf-util-window-pixel-width (&optional window)
"Return the width of WINDOW in pixel."
(if (< (cdr (subr-arity (symbol-function 'window-body-width))) 2)
(let ((window* (make-symbol "window")))
`(let ((,window* ,window))
(* (window-body-width ,window*)
(frame-char-width (window-frame ,window*)))))
`(window-body-width ,window t)))

;; In Emacs 24.3 image-mode-winprops leads to infinite recursion.
(unless (or (> emacs-major-version 24)
(and (= emacs-major-version 24)
Expand Down
2 changes: 1 addition & 1 deletion lisp/pdf-view.el
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,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))
Expand Down

0 comments on commit 3af6141

Please sign in to comment.