From e9b71b628fbd6ca6e4d4a450105fb0f6138a4e42 Mon Sep 17 00:00:00 2001 From: Andrew Whatson Date: Wed, 27 May 2020 09:41:20 +1000 Subject: Factor out macros to ensure they're visible in pdf-cache.el --- lisp/pdf-cache.el | 1 + lisp/pdf-macs.el | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ lisp/pdf-util.el | 1 + lisp/pdf-view.el | 24 +----------------------- 4 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 lisp/pdf-macs.el diff --git a/lisp/pdf-cache.el b/lisp/pdf-cache.el index 9ed7241..e9a7ca5 100644 --- a/lisp/pdf-cache.el +++ b/lisp/pdf-cache.el @@ -23,6 +23,7 @@ ;;; Code: ;; +(require 'pdf-macs) (require 'pdf-info) (require 'pdf-util) diff --git a/lisp/pdf-macs.el b/lisp/pdf-macs.el new file mode 100644 index 0000000..e4ac6ea --- /dev/null +++ b/lisp/pdf-macs.el @@ -0,0 +1,51 @@ +;;; pdf-macs.el --- Macros for pdf-tools. -*- lexical-binding:t -*- + +;; Copyright (C) 2013 Andreas Politz + +;; Author: Andreas Politz +;; Keywords: files, doc-view, pdf + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: +;; +;;; Code: +;; + +(defmacro pdf-view-current-page (&optional window) + ;;TODO: write documentation! + `(image-mode-window-get 'page ,window)) + +(defmacro pdf-view-current-overlay (&optional window) + ;;TODO: write documentation! + `(image-mode-window-get 'overlay ,window)) + +(defmacro pdf-view-current-image (&optional window) + ;;TODO: write documentation! + `(image-mode-window-get 'image ,window)) + +(defmacro pdf-view-current-slice (&optional window) + ;;TODO: write documentation! + `(image-mode-window-get 'slice ,window)) + +(defmacro pdf-view-current-window-size (&optional window) + ;;TODO: write documentation! + `(image-mode-window-get 'window-size ,window)) + +(defmacro pdf-view-window-needs-redisplay (&optional window) + `(image-mode-window-get 'needs-redisplay ,window)) + +(provide 'pdf-macs) + +;;; pdf-macs.el ends here diff --git a/lisp/pdf-util.el b/lisp/pdf-util.el index 0b7b544..c6d996b 100644 --- a/lisp/pdf-util.el +++ b/lisp/pdf-util.el @@ -25,6 +25,7 @@ ;;; Code: +(require 'pdf-macs) (require 'cl-lib) (require 'format-spec) (require 'faces) diff --git a/lisp/pdf-view.el b/lisp/pdf-view.el index b701652..451946c 100644 --- a/lisp/pdf-view.el +++ b/lisp/pdf-view.el @@ -25,6 +25,7 @@ ;;; Code: (require 'image-mode) +(require 'pdf-macs) (require 'pdf-util) (require 'pdf-info) (require 'pdf-cache) @@ -222,29 +223,6 @@ regarding display of the region in the later function.") (defvar-local pdf-view-register-alist nil "Local, dedicated register for PDF positions.") -(defmacro pdf-view-current-page (&optional window) - ;;TODO: write documentation! - `(image-mode-window-get 'page ,window)) - -(defmacro pdf-view-current-overlay (&optional window) - ;;TODO: write documentation! - `(image-mode-window-get 'overlay ,window)) - -(defmacro pdf-view-current-image (&optional window) - ;;TODO: write documentation! - `(image-mode-window-get 'image ,window)) - -(defmacro pdf-view-current-slice (&optional window) - ;;TODO: write documentation! - `(image-mode-window-get 'slice ,window)) - -(defmacro pdf-view-current-window-size (&optional window) - ;;TODO: write documentation! - `(image-mode-window-get 'window-size ,window)) - -(defmacro pdf-view-window-needs-redisplay (&optional window) - `(image-mode-window-get 'needs-redisplay ,window)) - (defun pdf-view-current-pagelabel (&optional window) (nth (1- (pdf-view-current-page window)) (pdf-info-pagelabels))) -- cgit v1.0