Skip to content

Commit

Permalink
Remove compatibility function for image-mode-winprops
Browse files Browse the repository at this point in the history
Relates to: #26
  • Loading branch information
vedang committed Oct 10, 2022
1 parent 3af6141 commit 05c4259
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions lisp/pdf-util.el
Original file line number Diff line number Diff line change
Expand Up @@ -38,53 +38,6 @@
(declare-function pdf-view-image-type "pdf-view")



;; * ================================================================== *
;; * Compatibility with older Emacssen (< 25.1)
;; * ================================================================== *

;; In Emacs 24.3 image-mode-winprops leads to infinite recursion.
(unless (or (> emacs-major-version 24)
(and (= emacs-major-version 24)
(>= emacs-minor-version 4)))
(require 'image-mode)
(defvar image-mode-winprops-original-function
(symbol-function 'image-mode-winprops))
(defvar image-mode-winprops-alist)
(eval-after-load "image-mode"
'(defun image-mode-winprops (&optional window cleanup)
(if (not (eq major-mode 'pdf-view-mode))
(funcall image-mode-winprops-original-function
window cleanup)
(cond ((null window)
(setq window
(if (eq (current-buffer) (window-buffer)) (selected-window) t)))
((eq window t))
((not (windowp window))
(error "Not a window: %s" window)))
(when cleanup
(setq image-mode-winprops-alist
(delq nil (mapcar (lambda (winprop)
(let ((w (car-safe winprop)))
(if (or (not (windowp w)) (window-live-p w))
winprop)))
image-mode-winprops-alist))))
(let ((winprops (assq window image-mode-winprops-alist)))
;; For new windows, set defaults from the latest.
(if winprops
;; Move window to front.
(setq image-mode-winprops-alist
(cons winprops (delq winprops image-mode-winprops-alist)))
(setq winprops (cons window
(copy-alist (cdar image-mode-winprops-alist))))
;; Add winprops before running the hook, to avoid inf-loops if the hook
;; triggers window-configuration-change-hook.
(setq image-mode-winprops-alist
(cons winprops image-mode-winprops-alist))
(run-hook-with-args 'image-mode-new-window-functions winprops))
winprops)))))



;; * ================================================================== *
;; * Transforming coordinates
Expand Down

0 comments on commit 05c4259

Please sign in to comment.