emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/pdf-tools c5e6be6908 2/6: Indentation and code-quality fix


From: ELPA Syncer
Subject: [nongnu] elpa/pdf-tools c5e6be6908 2/6: Indentation and code-quality fixes
Date: Fri, 31 Dec 2021 00:58:29 -0500 (EST)

branch: elpa/pdf-tools
commit c5e6be69086b45af05b2f58f6df23167b6a5da79
Author: Vedang Manerikar <ved.manerikar@gmail.com>
Commit: Vedang Manerikar <ved.manerikar@gmail.com>

    Indentation and code-quality fixes
    
    - Remove :group arguments from `defcustom` declarations
      - `defcustom` picks up `defgroup` names from the same file, so
        specifying the group is not necessary
    - Ensure that all function-names are properly quoted using #'
    - Add an explicit header-option setting lexical-binding to t
    - Ensure that cl-check-type uses `satisfies` for filenames
    - Replace all `defadvice` with `advice-add`
    - Replace `(list ...)` patterns with `\`(...)` patterns
    
    Fixes: #62
    Fixes: #32
    Partially Fixes: #24
---
 lisp/pdf-annot.el      |  85 +++++++++++++------------------
 lisp/pdf-cache.el      |  33 ++++++------
 lisp/pdf-history.el    |   8 +--
 lisp/pdf-info.el       | 136 +++++++++++++++++++++++--------------------------
 lisp/pdf-misc.el       |  11 ++--
 lisp/pdf-occur.el      |  70 ++++++++++++-------------
 lisp/pdf-outline.el    |  65 +++++++++++------------
 lisp/pdf-sync.el       |  50 +++++++-----------
 lisp/pdf-tools.el      |  16 +++---
 lisp/pdf-util.el       | 134 +++++++++++++++++++++++++-----------------------
 lisp/pdf-view.el       |  17 +++----
 lisp/pdf-virtual.el    |   1 +
 test/pdf-cache-test.el |   3 +-
 test/pdf-sync-test.el  |   2 +-
 test/pdf-tools-test.el |   2 +-
 test/pdf-util-test.el  |   2 +-
 test/test-helper.el    |   9 +++-
 17 files changed, 303 insertions(+), 341 deletions(-)

diff --git a/lisp/pdf-annot.el b/lisp/pdf-annot.el
index c306ce95f9..7217622be9 100644
--- a/lisp/pdf-annot.el
+++ b/lisp/pdf-annot.el
@@ -53,17 +53,14 @@ called.
 
 This hook is meant to allow for custom annotations.  FIXME:
 Implement and describe basic org example."
-  :group 'pdf-annot
   :type 'hook)
 
 (defcustom pdf-annot-default-text-annotation-properties nil
   "Alist of initial properties for new text annotations."
-  :group 'pdf-annot
   :type '(alist :key-type symbol :value-type sexp))
 
 (defcustom pdf-annot-default-markup-annotation-properties nil
   "Alist of initial properties for new markup annotations."
-  :group 'pdf-annot
   :type '(alist :key-type symbol :value-type sexp))
 
 (make-obsolete-variable 'pdf-annot-default-text-annotation-properties
@@ -107,7 +104,6 @@ would use a green color for highlight and a red one for 
other
 annotations.  Additionally the label for all annotations is set
 to \"Joe\"."
 
-  :group 'pdf-annot
   :type (let* ((label '(cons :tag "Label" (const label) string))
                (contents '(cons :tag "Contents" (const contents) string))
                (color '(cons :tag "Color" (const color) color))
@@ -147,7 +143,6 @@ will be used.
 
 If all of them return nil, the default function
 `pdf-annot-print-annotation-default' is used."
-  :group 'pdf-annot
   :type 'hook)
 
 (defcustom pdf-annot-latex-string-predicate
@@ -157,7 +152,6 @@ If all of them return nil, the default function
 
 It receives a string and should return non-nil, if string is a
 LaTeX fragment."
-  :group 'pdf-annot
   :type 'function)
 
 (defcustom pdf-annot-latex-header
@@ -166,7 +160,6 @@ LaTeX fragment."
   "Header used when latex compiling annotations.
 The default value is `org-format-latex-header' +
 \"\\n\\\\setlength{\\\\textwidth}{12cm}\"."
-  :group 'pdf-annot
   :type 'string)
 
 (defcustom pdf-annot-tweak-tooltips t
@@ -179,17 +172,14 @@ order to display text properties;
 
 `tooltip-hide-delay' is set to infinity, in order to not being
 annoyed while reading the annotations."
-  :group 'pdf-annot
   :type 'boolean)
 
 (defcustom pdf-annot-activate-created-annotations nil
   "Whether to activate (i.e. edit) created annotations."
-  :group 'pdf-annot
   :type 'boolean)
 
 (defcustom pdf-annot-attachment-display-buffer-action nil
   "The display action used when displaying attachments."
-  :group 'pdf-annot
   :type display-buffer--action-custom-type)
 
 (defconst pdf-annot-annotation-types
@@ -204,7 +194,6 @@ annoyed while reading the annotations."
       (list 'text 'file 'squiggly 'highlight 'underline 'strike-out)
     (list 'text 'file))
   "A list of annotation types displayed in the list buffer."
-  :group 'pdf-annot
   :type `(set ,@(mapcar (lambda (type)
                           (list 'const type))
                         pdf-annot-annotation-types)))
@@ -293,25 +282,24 @@ current buffer, because that won't run the hooks 
properly."
   "The prefix to use for `pdf-annot-minor-mode-map'.
 
 Setting this after the package was loaded has no effect."
-  :group 'pdf-annot
   :type 'key-sequence)
 
 (defvar pdf-annot-minor-mode-map
   (let ((kmap (make-sparse-keymap))
         (smap (make-sparse-keymap)))
     (define-key kmap pdf-annot-minor-mode-map-prefix smap)
-    (define-key smap "l" 'pdf-annot-list-annotations)
+    (define-key smap "l" #'pdf-annot-list-annotations)
     ;; (define-key smap "d" 'pdf-annot-toggle-display-annotations)
-    (define-key smap "a" 'pdf-annot-attachment-dired)
+    (define-key smap "a" #'pdf-annot-attachment-dired)
     (when (pdf-info-writable-annotations-p)
-      (define-key smap "D" 'pdf-annot-delete)
-      (define-key smap "t" 'pdf-annot-add-text-annotation)
+      (define-key smap "D" #'pdf-annot-delete)
+      (define-key smap "t" #'pdf-annot-add-text-annotation)
       (when (pdf-info-markup-annotations-p)
-        (define-key smap "m" 'pdf-annot-add-markup-annotation)
-        (define-key smap "s" 'pdf-annot-add-squiggly-markup-annotation)
-        (define-key smap "u" 'pdf-annot-add-underline-markup-annotation)
-        (define-key smap "o" 'pdf-annot-add-strikeout-markup-annotation)
-        (define-key smap "h" 'pdf-annot-add-highlight-markup-annotation)))
+        (define-key smap "m" #'pdf-annot-add-markup-annotation)
+        (define-key smap "s" #'pdf-annot-add-squiggly-markup-annotation)
+        (define-key smap "u" #'pdf-annot-add-underline-markup-annotation)
+        (define-key smap "o" #'pdf-annot-add-strikeout-markup-annotation)
+        (define-key smap "h" #'pdf-annot-add-highlight-markup-annotation)))
     kmap)
   "Keymap used for `pdf-annot-minor-mode'.")
 
@@ -331,14 +319,14 @@ Setting this after the package was loaded has no effect."
       (setq tooltip-hide-delay 3600))
     (pdf-view-add-hotspot-function 'pdf-annot-hotspot-function 9)
     (add-hook 'pdf-info-close-document-hook
-              'pdf-annot-attachment-delete-base-directory nil t)
+              #'pdf-annot-attachment-delete-base-directory nil t)
     (when (featurep 'savehist)
       (add-to-list 'savehist-minibuffer-history-variables
                    'pdf-annot-color-history)))
    (t
     (pdf-view-remove-hotspot-function 'pdf-annot-hotspot-function)
     (remove-hook 'pdf-info-close-document-hook
-                 'pdf-annot-attachment-delete-base-directory t)))
+                 #'pdf-annot-attachment-delete-base-directory t)))
   (pdf-view-redisplay t))
 
 (defun pdf-annot-create-context-menu (a)
@@ -539,7 +527,7 @@ the variable is nil and this function is called again."
             (run-hook-with-args
              'pdf-annot-modified-functions closure)
           (setq pdf-annot-delayed-modified-annotations nil)
-          (apply 'pdf-view-redisplay-pages pages))))))
+          (apply #'pdf-view-redisplay-pages pages))))))
 
 (defun pdf-annot-equal (a1 a2)
   "Return non-nil, if annotations A1 and A2 are equal.
@@ -905,11 +893,11 @@ i.e. a non mouse-movement event is read."
 
 (defun pdf-annot-hotspot-function (page size)
   "Create image hotspots for page PAGE of size SIZE."
-  (apply 'nconc (mapcar (lambda (a)
-                          (unless (eq (pdf-annot-get a 'type)
-                                      'link)
-                            (pdf-annot-create-hotspots a size)))
-                        (pdf-annot-getannots page))))
+  (apply #'nconc (mapcar (lambda (a)
+                           (unless (eq (pdf-annot-get a 'type)
+                                       'link)
+                             (pdf-annot-create-hotspots a size)))
+                         (pdf-annot-getannots page))))
 
 (defun pdf-annot-create-hotspots (a size)
   "Return a list of image hotspots for annotation A."
@@ -1037,7 +1025,7 @@ Return the new annotation."
   (when (and (eq type 'text)
              (> (length edges) 1))
     (error "Edges argument should be a single edge-list for text annotations"))
-  (let* ((a (apply 'pdf-info-addannot
+  (let* ((a (apply #'pdf-info-addannot
                    page
                    (if (eq type 'text)
                        (car edges)
@@ -1236,7 +1224,7 @@ Suppresses successive duplicate entries of keys after the 
first
 occurrence in ALISTS."
 
   (let (merged)
-    (dolist (elt (apply 'append alists))
+    (dolist (elt (apply #'append alists))
       (unless (assq (car elt) merged)
         (push elt merged)))
     (nreverse merged)))
@@ -1300,7 +1288,7 @@ property."
           (t
            (format "%s"
                    (mapconcat
-                    'identity
+                    #'identity
                     (mapcar
                      (lambda (property)
                        (pdf-annot-print-property
@@ -1400,7 +1388,6 @@ is about to be edited in this buffer.
 The default value turns on `latex-mode' if
 `pdf-annot-latex-string-predicate' returns non-nil on the
 annotation's contents and otherwise `text-mode'. "
-  :group 'pdf-annot
   :type 'function)
 
 (defcustom pdf-annot-edit-contents-display-buffer-action
@@ -1409,14 +1396,13 @@ annotation's contents and otherwise `text-mode'. "
     (inhibit-same-window . t)
     (window-height . 0.25))
   "Display action when showing the edit buffer."
-  :group 'pdf-annot
   :type display-buffer--action-custom-type)
 
 (defvar pdf-annot-edit-contents-minor-mode-map
   (let ((kmap (make-sparse-keymap)))
     (set-keymap-parent kmap text-mode-map)
-    (define-key kmap (kbd "C-c C-c") 'pdf-annot-edit-contents-commit)
-    (define-key kmap (kbd "C-c C-q") 'pdf-annot-edit-contents-abort)
+    (define-key kmap (kbd "C-c C-c") #'pdf-annot-edit-contents-commit)
+    (define-key kmap (kbd "C-c C-q") #'pdf-annot-edit-contents-abort)
     kmap))
 
 (define-minor-mode pdf-annot-edit-contents-minor-mode
@@ -1506,7 +1492,6 @@ annotation's contents and otherwise `text-mode'. "
      display-buffer-pop-up-window)
     (inhibit-same-window . t))
   "Display action used when displaying the list buffer."
-  :group 'pdf-annot
   :type display-buffer--action-custom-type)
 
 (defcustom pdf-annot-list-format
@@ -1526,12 +1511,10 @@ Currently supported properties are page, type, label, 
date and contents."
              (type (integer :value 10 :tag "Column Width" ))
              (label (integer :value 24 :tag "Column Width"))
              (date (integer :value 24 :tag "Column Width"))
-             (contents (integer :value 56 :tag "Column Width")))
-  :group 'pdf-annot)
+             (contents (integer :value 56 :tag "Column Width"))))
 
 (defcustom pdf-annot-list-highlight-type nil
   "Whether to highlight \"Type\" column annotation list with annotation color."
-  :group 'pdf-annot
   :type 'boolean)
 
 (defvar-local pdf-annot-list-buffer nil)
@@ -1540,8 +1523,8 @@ Currently supported properties are page, type, label, 
date and contents."
 
 (defvar pdf-annot-list-mode-map
   (let ((km (make-sparse-keymap)))
-    (define-key km (kbd "C-c C-f") 'pdf-annot-list-follow-minor-mode)
-    (define-key km (kbd "SPC") 'pdf-annot-list-display-annotation-from-id)
+    (define-key km (kbd "C-c C-f") #'pdf-annot-list-follow-minor-mode)
+    (define-key km (kbd "SPC") #'pdf-annot-list-display-annotation-from-id)
     km))
 
 (defun pdf-annot-property-completions (property)
@@ -1575,10 +1558,10 @@ belong to the same page and A1 is displayed above/left 
of A2."
 (defun pdf-annot-list-entries ()
   (unless (buffer-live-p pdf-annot-list-document-buffer)
     (error "No PDF document associated with this buffer"))
-  (mapcar 'pdf-annot-list-create-entry
+  (mapcar #'pdf-annot-list-create-entry
           (sort (pdf-annot-getannots nil pdf-annot-list-listed-types
                                      pdf-annot-list-document-buffer)
-                'pdf-annot-compare-annotations)))
+                #'pdf-annot-compare-annotations)))
 
 (defun pdf-annot--make-entry-formatter (a)
   (lambda (fmt)
@@ -1664,7 +1647,7 @@ belong to the same page and A1 is displayed above/left of 
A2."
         (tabulated-list-print)
         (setq tablist-context-window-function
               (lambda (id) (pdf-annot-list-context-function id buffer))
-              tablist-operations-function 'pdf-annot-list-operation-function)
+              tablist-operations-function #'pdf-annot-list-operation-function)
         (let ((list-buffer (current-buffer)))
           (with-current-buffer buffer
             (setq pdf-annot-list-buffer list-buffer))))
@@ -1675,9 +1658,9 @@ belong to the same page and A1 is displayed above/left of 
A2."
       (tablist-move-to-major-column)
       (tablist-display-context-window))
     (add-hook 'pdf-info-close-document-hook
-              'pdf-annot-list-update nil t)
+              #'pdf-annot-list-update nil t)
     (add-hook 'pdf-annot-modified-functions
-              'pdf-annot-list-update nil t)))
+              #'pdf-annot-list-update nil t)))
 
 (defun pdf-annot-list-goto-annotation (a)
   (with-current-buffer (pdf-annot-get-buffer a)
@@ -1725,7 +1708,7 @@ belong to the same page and A1 is displayed above/left of 
A2."
        (when (buffer-live-p pdf-annot-list-document-buffer)
          (with-current-buffer pdf-annot-list-document-buffer
            (pdf-annot-with-atomic-modifications
-             (dolist (a (mapcar 'pdf-annot-getannot ids))
+             (dolist (a (mapcar #'pdf-annot-getannot ids))
                (pdf-annot-delete a)))))))
     (find-entry
      (cl-destructuring-bind (id)
@@ -1775,17 +1758,17 @@ belong to the same page and A1 is displayed above/left 
of A2."
   ""
   :group 'pdf-annot
   (unless (derived-mode-p 'pdf-annot-list-mode)
-    (error "No in pdf-annot-list-mode."))
+    (error "Not in pdf-annot-list-mode"))
   (cond
    (pdf-annot-list-follow-minor-mode
     (add-hook 'tablist-selection-changed-functions
-              'pdf-annot-list-display-annotation-from-id nil t)
+              #'pdf-annot-list-display-annotation-from-id nil t)
     (let ((id (tabulated-list-get-id)))
       (when id
         (pdf-annot-list-display-annotation-from-id id))))
    (t
     (remove-hook 'tablist-selection-changed-functions
-                 'pdf-annot-list-display-annotation-from-id t))))
+                 #'pdf-annot-list-display-annotation-from-id t))))
 
 (provide 'pdf-annot)
 ;;; pdf-annot.el ends here
diff --git a/lisp/pdf-cache.el b/lisp/pdf-cache.el
index 954c6b6326..37e79f738a 100644
--- a/lisp/pdf-cache.el
+++ b/lisp/pdf-cache.el
@@ -65,13 +65,13 @@ be prefetched and their order."
 (defun pdf-cache--initialize ()
   (unless pdf-cache--data
     (setq pdf-cache--data (make-hash-table))
-    (add-hook 'pdf-info-close-document-hook 'pdf-cache-clear-data nil t)
+    (add-hook 'pdf-info-close-document-hook #'pdf-cache-clear-data nil t)
     (add-hook 'pdf-annot-modified-functions
-              'pdf-cache--clear-data-of-annotations
+              #'pdf-cache--clear-data-of-annotations
               nil t)))
 
 (defun pdf-cache--clear-data-of-annotations (fn)
-  (apply 'pdf-cache-clear-data-of-pages
+  (apply #'pdf-cache-clear-data-of-pages
          (mapcar (lambda (a)
                    (cdr (assq 'page a)))
                  (funcall fn t))))
@@ -195,7 +195,7 @@ Does not modify the cache.  See also `pdf-cache-get-image'."
                      (list page min-width max-width hash)
                      pdf-cache--image-cache
                      :test (lambda (spec image)
-                             (apply 'pdf-cache--image-match image spec))))))
+                             (apply #'pdf-cache--image-match image spec))))))
     (and image
          (pdf-cache--image/data image))))
 
@@ -229,9 +229,9 @@ the HASH argument.
 
 This function always returns nil."
   (unless pdf-cache--image-cache
-    (add-hook 'pdf-info-close-document-hook 'pdf-cache-clear-images nil t)
+    (add-hook 'pdf-info-close-document-hook #'pdf-cache-clear-images nil t)
     (add-hook 'pdf-annot-modified-functions
-              'pdf-cache--clear-images-of-annotations nil t))
+              #'pdf-cache--clear-images-of-annotations nil t))
   (push (pdf-cache--make-image page width data hash)
         pdf-cache--image-cache)
   ;; Forget old image(s).
@@ -267,7 +267,7 @@ from the cache."
 
 
 (defun pdf-cache--clear-images-of-annotations (fn)
-  (apply 'pdf-cache-clear-images-of-pages
+  (apply #'pdf-cache-clear-images-of-pages
          (mapcar (lambda (a)
                    (cdr (assq 'page a)))
                  (funcall fn t))))
@@ -298,13 +298,13 @@ If such an image is not available in the cache, call
 See also `pdf-info-renderpage-text-regions' and
 `pdf-cache-renderpage'."
   (if pdf-cache-image-inihibit
-      (apply 'pdf-info-renderpage-text-regions
+      (apply #'pdf-info-renderpage-text-regions
              page width single-line-p nil selection)
     (let ((hash (sxhash
                  (format "%S" (cons 'renderpage-text-regions
                                     (cons single-line-p selection))))))
       (or (pdf-cache-get-image page width width hash)
-          (let ((data (apply 'pdf-info-renderpage-text-regions
+          (let ((data (apply #'pdf-info-renderpage-text-regions
                              page width single-line-p nil selection)))
             (pdf-cache-put-image page width data hash)
             data)))))
@@ -315,13 +315,13 @@ See also `pdf-info-renderpage-text-regions' and
 See also `pdf-info-renderpage-highlight' and
 `pdf-cache-renderpage'."
   (if pdf-cache-image-inihibit
-      (apply 'pdf-info-renderpage-highlight
+      (apply #'pdf-info-renderpage-highlight
              page width nil regions)
     (let ((hash (sxhash
                  (format "%S" (cons 'renderpage-highlight
                                     regions)))))
       (or (pdf-cache-get-image page width width hash)
-          (let ((data (apply 'pdf-info-renderpage-highlight
+          (let ((data (apply #'pdf-info-renderpage-highlight
                              page width nil regions)))
             (pdf-cache-put-image page width data hash)
             data)))))
@@ -344,14 +344,14 @@ See also `pdf-info-renderpage-highlight' and
   (cond
    (pdf-cache-prefetch-minor-mode
     (pdf-util-assert-pdf-buffer)
-    (add-hook 'pre-command-hook 'pdf-cache--prefetch-stop nil t)
+    (add-hook 'pre-command-hook #'pdf-cache--prefetch-stop nil t)
     ;; FIXME: Disable the time when the buffer is killed or it's
     ;; major-mode changes.
     (setq pdf-cache--prefetch-timer
-          (run-with-idle-timer (or pdf-cache-prefetch-delay 1)
-              t 'pdf-cache--prefetch-start (current-buffer))))
+          (run-with-idle-timer (or pdf-cache-prefetch-delay 1) t
+                               #'pdf-cache--prefetch-start (current-buffer))))
    (t
-    (remove-hook 'pre-command-hook 'pdf-cache--prefetch-stop t))))
+    (remove-hook 'pre-command-hook #'pdf-cache--prefetch-stop t))))
 
 (defun pdf-cache-prefetch-pages-function-default ()
   (let ((page (pdf-view-current-page)))
@@ -413,7 +413,8 @@ See also `pdf-info-renderpage-highlight' and
                           (message "Prefetched page %s." page))
                         ;; Avoid max-lisp-eval-depth
                         (run-with-timer
-                            0.001 nil 'pdf-cache--prefetch-pages window 
image-width)))))))
+                         0.001 nil
+                         #'pdf-cache--prefetch-pages window image-width)))))))
           (condition-case err
               (pdf-info-renderpage page image-width)
             (error
diff --git a/lisp/pdf-history.el b/lisp/pdf-history.el
index df01b72cd3..abb9cf2c84 100644
--- a/lisp/pdf-history.el
+++ b/lisp/pdf-history.el
@@ -38,8 +38,8 @@
 
 (defvar pdf-history-minor-mode-map
   (let ((kmap (make-sparse-keymap)))
-    (define-key kmap (kbd "B") 'pdf-history-backward)
-    (define-key kmap (kbd "N") 'pdf-history-forward)
+    (define-key kmap (kbd "B") #'pdf-history-backward)
+    (define-key kmap (kbd "N") #'pdf-history-forward)
     kmap)
   "Keymap used in `pdf-history-minor-mode'.")
 
@@ -59,10 +59,10 @@ may be navigated with the following keys.
    (pdf-history-minor-mode
     (pdf-history-push)
     (add-hook 'pdf-view-after-change-page-hook
-              'pdf-history-before-change-page-hook nil t))
+              #'pdf-history-before-change-page-hook nil t))
    (t
     (remove-hook 'pdf-view-after-change-page-hook
-                 'pdf-history-before-change-page-hook t))))
+                 #'pdf-history-before-change-page-hook t))))
 
 (defun pdf-history-before-change-page-hook ()
   "Push a history item, before leaving this page."
diff --git a/lisp/pdf-info.el b/lisp/pdf-info.el
index 0c345a25c2..d3fdaa0f87 100644
--- a/lisp/pdf-info.el
+++ b/lisp/pdf-info.el
@@ -85,14 +85,12 @@
           ;; Fall back to epdfinfo in the directory of this file.
           (expand-file-name executable))))
   "Filename of the epdfinfo executable."
-  :group 'pdf-info
   :type 'file)
 
 (defcustom pdf-info-epdfinfo-error-filename nil
   "Filename for error output of the epdfinfo executable.
 
 If nil, discard any error messages.  Useful for debugging."
-  :group 'pdf-info
   :type `(choice (const :tag "None" nil)
                  ,@(when (file-directory-p "/tmp/")
                      '((const "/tmp/epdfinfo.log")))
@@ -103,14 +101,12 @@ If nil, discard any error messages.  Useful for 
debugging."
 
 If this is non-nil, all communication with the epdfinfo program
 will be logged to the buffer \"*pdf-info-log*\"."
-  :group 'pdf-info
   :type 'boolean)
 
 (defcustom pdf-info-log-entry-max 512
   "Maximum number of characters in a single log entry.
 
 This variable has no effect if `pdf-info-log' is nil."
-  :group 'pdf-info
   :type 'integer)
 
 (defcustom pdf-info-restart-process-p 'ask
@@ -123,7 +119,6 @@ ask -- ask whether to restart or not.
 
 If it is `ask', the server quits and you answer no, this variable
 is set to nil."
-  :group 'pdf-info
   :type '(choice (const :tag "Do nothing" nil)
                  (const :tag "Restart silently" t)
                  (const :tag "Always ask" ask)))
@@ -133,7 +128,6 @@ is set to nil."
 
 The hook is run in the documents buffer, if it exists. Otherwise
 in a `with-temp-buffer' form."
-  :group 'pdf-info
   :type 'hook)
 
 
@@ -311,41 +305,41 @@ error."
       (setq pdf-info--queue (tq-create proc))))
   pdf-info--queue)
 
-(defadvice tq-process-buffer (around bugfix activate)
+(advice-add 'tq-process-buffer :around #'pdf-info--tq-workaround)
+(defun pdf-info--tq-workaround (orig-fun tq &rest args)
   "Fix a bug in trunk where the wrong callback gets called."
   ;; FIXME: Make me iterative.
-  (let ((tq (ad-get-arg 0)))
-    (if (not (equal (car (process-command (tq-process tq)))
-                    pdf-info-epdfinfo-program))
-        ad-do-it
-      (let ((buffer (tq-buffer tq))
-            done)
-        (when (buffer-live-p buffer)
-          (set-buffer buffer)
-          (while (and (not done)
-                      (> (buffer-size) 0))
-            (setq done t)
-            (if (tq-queue-empty tq)
-                (let ((buf (generate-new-buffer "*spurious*")))
-                  (copy-to-buffer buf (point-min) (point-max))
-                  (delete-region (point-min) (point))
-                  (pop-to-buffer buf nil)
-                  (error "Spurious communication from process %s, see buffer 
%s"
-                         (process-name (tq-process tq))
-                         (buffer-name buf)))
-              (goto-char (point-min))
-              (when (re-search-forward (tq-queue-head-regexp tq) nil t)
-                (setq done nil)
-                (let ((answer (buffer-substring (point-min) (point)))
-                      (fn (tq-queue-head-fn tq))
-                      (closure (tq-queue-head-closure tq)))
-                  (delete-region (point-min) (point))
-                  (tq-queue-pop tq)
-                  (condition-case-unless-debug err
-                      (funcall fn closure answer)
-                    (error
-                     (message "Error while processing tq callback: %s"
-                              (error-message-string err)))))))))))))
+  (if (not (equal (car (process-command (tq-process tq)))
+                  pdf-info-epdfinfo-program))
+      (apply orig-fun tq args)
+    (let ((buffer (tq-buffer tq))
+          done)
+      (when (buffer-live-p buffer)
+        (set-buffer buffer)
+        (while (and (not done)
+                    (> (buffer-size) 0))
+          (setq done t)
+          (if (tq-queue-empty tq)
+              (let ((buf (generate-new-buffer "*spurious*")))
+                (copy-to-buffer buf (point-min) (point-max))
+                (delete-region (point-min) (point))
+                (pop-to-buffer buf nil)
+                (error "Spurious communication from process %s, see buffer %s"
+                       (process-name (tq-process tq))
+                       (buffer-name buf)))
+            (goto-char (point-min))
+            (when (re-search-forward (tq-queue-head-regexp tq) nil t)
+              (setq done nil)
+              (let ((answer (buffer-substring (point-min) (point)))
+                    (fn (tq-queue-head-fn tq))
+                    (closure (tq-queue-head-closure tq)))
+                (delete-region (point-min) (point))
+                (tq-queue-pop tq)
+                (condition-case-unless-debug err
+                    (funcall fn closure answer)
+                  (error
+                   (message "Error while processing tq callback: %s"
+                            (error-message-string err))))))))))))
 
 
 ;; * ================================================================== *
@@ -357,8 +351,9 @@ error."
   (pdf-info-process-assert-running)
   (unless (symbolp cmd)
     (setq cmd (intern cmd)))
-  (let* ((query (concat (mapconcat 'pdf-info-query--escape
-                                   (cons cmd args) ":") "\n"))
+  (let* ((query (concat (mapconcat #'pdf-info-query--escape
+                                   (cons cmd args) ":")
+                        "\n"))
          (callback
           (lambda (closure response)
             (cl-destructuring-bind (status &rest result)
@@ -483,7 +478,7 @@ interrupted."
      (mapcar (lambda (elt)
                (cl-assert (= 1 (length (cadr elt))) t)
                `(,(aref (cadr elt) 0)
-                 ,(mapcar 'string-to-number
+                 ,(mapcar #'string-to-number
                           (split-string (car elt) " " t))))
              response))
     (regexp-flags
@@ -499,7 +494,7 @@ interrupted."
                      (pdf-util-highlight-regexp-in-string
                       (regexp-quote (nth 1 r)) (nth 2 r))))
           (edges . ,(mapcar (lambda (m)
-                              (mapcar 'string-to-number
+                              (mapcar #'string-to-number
                                       (split-string m " " t)))
                             (cddr (cdr r))))))
       response))
@@ -511,7 +506,7 @@ interrupted."
     (pagelinks
      (mapcar (lambda (r)
                `((edges .
-                        ,(mapcar 'string-to-number ;area
+                        ,(mapcar #'string-to-number ;area
                                  (split-string (pop r) " " t)))
                  ,@(pdf-info-query--transform-action r)))
              response))
@@ -534,10 +529,10 @@ interrupted."
      (or (caar response) ""))
     (getselection
      (mapcar (lambda (line)
-               (mapcar 'string-to-number
+               (mapcar #'string-to-number
                        (split-string (car line) " " t)))
              response))
-    (features (mapcar 'intern (car response)))
+    (features (mapcar #'intern (car response)))
     (pagesize
      (setq response (car response))
      (cons (round (string-to-number (car response)))
@@ -545,15 +540,15 @@ interrupted."
     ((getannot editannot addannot)
      (pdf-info-query--transform-annotation (car response)))
     (getannots
-     (mapcar 'pdf-info-query--transform-annotation response))
+     (mapcar #'pdf-info-query--transform-annotation response))
     (getattachments
-     (mapcar 'pdf-info-query--transform-attachment response))
+     (mapcar #'pdf-info-query--transform-attachment response))
     ((getattachment-from-annot)
      (pdf-info-query--transform-attachment (car response)))
     (boundingbox
-     (mapcar 'string-to-number (car response)))
+     (mapcar #'string-to-number (car response)))
     (synctex-forward-search
-     (let ((list (mapcar 'string-to-number (car response))))
+     (let ((list (mapcar #'string-to-number (car response))))
        `((page . ,(car list))
          (edges . ,(cdr list)))))
     (synctex-backward-search
@@ -575,7 +570,7 @@ interrupted."
            (push value options)
            (push key options)))
        options))
-    (pagelabels (mapcar 'car response))
+    (pagelabels (mapcar #'car response))
     (ping (caar response))
     (t response)))
 
@@ -604,7 +599,7 @@ interrupted."
       (cl-destructuring-bind (page edges type id flags color contents modified 
&rest rest)
           a
         (setq a1 `((page . ,(string-to-number page))
-                   (edges . ,(mapcar 'string-to-number
+                   (edges . ,(mapcar #'string-to-number
                                      (split-string edges " " t)))
                    (type . ,(intern type))
                    (id . ,(intern id))
@@ -623,7 +618,7 @@ interrupted."
                                   (and o (string-to-number o))))
                     (popup-edges . ,(let ((p (not-empty popup-edges)))
                                       (when p
-                                        (mapcar 'string-to-number
+                                        (mapcar #'string-to-number
                                                 (split-string p " " t)))))
                     (popup-is-open . ,(equal popup-is-open "1"))
                     (created . ,(pdf-info-parse-pdf-date (not-empty 
created)))))
@@ -639,7 +634,7 @@ interrupted."
                     '(squiggly highlight underline strike-out))
               (setq a3 `((markup-edges
                           . ,(mapcar (lambda (r)
-                                       (mapcar 'string-to-number
+                                       (mapcar #'string-to-number
                                                (split-string r " " t)))
                                      rest)))))))))
       (append a1 a2 a3))))
@@ -851,9 +846,8 @@ i.e. `pdf-info-asynchronous' is non-nil, transparently.
                ;; Let-bind responses corresponding to their variables,
                ;; i.e. keys in alist RESULTS.
                (let (,@(mapcar (lambda (var)
-                                 (list var (list 'cdr (list 'assq (list 'quote 
var)
-                                                            results))))
-                               (mapcar 'car let-forms)))
+                                 `(,var (cdr (assq ',var ,results))))
+                               (mapcar #'car let-forms)))
                  (setq ,status (not (not ,first-error))
                        ,response (or ,first-error
                                      (with-current-buffer ,buffer
@@ -920,7 +914,7 @@ restart it."
         (tq-close pdf-info--queue))
       (set (make-local-variable 'pdf-info--queue) nil)
       (pdf-info-process-assert-running t)
-      (add-hook 'kill-buffer-hook 'pdf-info-kill-local-server nil t)
+      (add-hook 'kill-buffer-hook #'pdf-info-kill-local-server nil t)
       pdf-info--queue)))
 
 (defun pdf-info-kill-local-server (&optional buffer)
@@ -1259,7 +1253,7 @@ Return the text contained in the selection."
    'gettext
    (pdf-info--normalize-file-or-buffer file-or-buffer)
    page
-   (mapconcat 'number-to-string edges " ")
+   (mapconcat #'number-to-string edges " ")
    (cl-case selection-style
      (glyph 0)
      (word 1)
@@ -1278,7 +1272,7 @@ aforementioned function, when called with the same 
arguments."
    'getselection
    (pdf-info--normalize-file-or-buffer file-or-buffer)
    page
-   (mapconcat 'number-to-string edges " ")
+   (mapconcat #'number-to-string edges " ")
    (cl-case selection-style
      (glyph 0)
      (word 1)
@@ -1314,7 +1308,7 @@ contains at most one element."
    'charlayout
    (pdf-info--normalize-file-or-buffer file-or-buffer)
    page
-   (mapconcat 'number-to-string edges-or-pos " ")))
+   (mapconcat #'number-to-string edges-or-pos " ")))
 
 (defun pdf-info-pagesize (page &optional file-or-buffer)
   "Return the size of PAGE as a cons \(WIDTH . HEIGHT\)
@@ -1428,7 +1422,7 @@ returns."
     (push file-or-buffer markup-edges)
     (setq file-or-buffer nil))
   (apply
-   'pdf-info-query
+   #'pdf-info-query
    'addannot
    (pdf-info--normalize-file-or-buffer file-or-buffer)
    page
@@ -1488,11 +1482,11 @@ The server must support modifying annotations for this 
to work."
               (t
                (list (car elt) (cdr elt)))))
           modifications)))
-    (apply 'pdf-info-query
+    (apply #'pdf-info-query
            'editannot
            (pdf-info--normalize-file-or-buffer file-or-buffer)
            id
-           (apply 'append edits))))
+           (apply #'append edits))))
 
 (defun pdf-info-save (&optional file-or-buffer)
   "Save FILE-OR-BUFFER.
@@ -1590,7 +1584,7 @@ Return the data of the corresponding PNG image."
   (when (keywordp file-or-buffer)
     (push file-or-buffer commands)
     (setq file-or-buffer nil))
-  (apply 'pdf-info-query
+  (apply #'pdf-info-query
     'renderpage
     (pdf-info--normalize-file-or-buffer file-or-buffer)
     page
@@ -1602,7 +1596,7 @@ Return the data of the corresponding PNG image."
           (setq value
                 (cl-case kw
                   ((:crop-to :highlight-line :highlight-region :highlight-text)
-                   (mapconcat 'number-to-string value " "))
+                   (mapconcat #'number-to-string value " "))
                   ((:foreground :background)
                    (pdf-util-hexcolor value))
                   (:alpha
@@ -1636,9 +1630,9 @@ Return the data of the corresponding PNG image."
     (push file-or-buffer regions)
     (setq file-or-buffer nil))
 
-  (apply 'pdf-info-renderpage
+  (apply #'pdf-info-renderpage
     page width file-or-buffer
-    (apply 'append
+    (apply #'append
       (mapcar (lambda (elt)
                 `(:foreground ,(pop elt)
                   :background ,(pop elt)
@@ -1668,9 +1662,9 @@ Return the data of the corresponding PNG image."
     (push file-or-buffer regions)
     (setq file-or-buffer nil))
 
-  (apply 'pdf-info-renderpage
+  (apply #'pdf-info-renderpage
     page width file-or-buffer
-    (apply 'append
+    (apply #'append
       (mapcar (lambda (elt)
                 `(:background ,(pop elt)
                   :foreground ,(pop elt)
@@ -1701,7 +1695,7 @@ Returns a list \(LEFT TOP RIGHT BOT\)."
     (setq file-or-buffer nil))
   (unless (= (% (length options) 2) 0)
     (error "Missing a option value"))
-  (apply 'pdf-info-query
+  (apply #'pdf-info-query
     'setoptions
     (pdf-info--normalize-file-or-buffer file-or-buffer)
     (let (soptions)
diff --git a/lisp/pdf-misc.el b/lisp/pdf-misc.el
index c0548ad9da..a472262d23 100644
--- a/lisp/pdf-misc.el
+++ b/lisp/pdf-misc.el
@@ -1,4 +1,4 @@
-;;; pdf-misc.el --- Miscellaneous commands for PDF buffer.
+;;; pdf-misc.el --- Miscellaneous commands for PDF buffer.  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2013, 2014  Andreas Politz
 
@@ -187,8 +187,8 @@
   :group 'pdf-misc
   (pdf-util-assert-pdf-buffer))
 
-(defun pdf-misc-popup-context-menu (event)
-  "Popup a context menu at position determined by EVENT."
+(defun pdf-misc-popup-context-menu ()
+  "Popup a context menu at position."
   (interactive "@e")
   (popup-menu
    (cons 'keymap
@@ -208,8 +208,7 @@
              (pad (apply' max (mapcar (lambda (d)
                                         (length (symbol-name (car d))))
                                       md)))
-             (fmt (format "%%%ds:%%s\n" pad))
-             window)
+             (fmt (format "%%%ds:%%s\n" pad)))
         (erase-buffer)
         (setq header-line-format (buffer-name buffer)
               buffer-read-only t)
@@ -280,7 +279,7 @@ use when printing the PDF. Optionally, save the choice"
 (defun pdf-misc-print-document (filename &optional interactive-p)
   (interactive
    (list (pdf-view-buffer-file-name) t))
-  (cl-check-type filename (and string file-readable))
+  (cl-check-type filename (and string (satisfies file-readable-p)))
   (let ((program (pdf-misc-print-program interactive-p))
         (args (append pdf-misc-print-program-args (list filename))))
     (unless program
diff --git a/lisp/pdf-occur.el b/lisp/pdf-occur.el
index 9fe099ae64..723ea65e7d 100644
--- a/lisp/pdf-occur.el
+++ b/lisp/pdf-occur.el
@@ -46,25 +46,21 @@
 
 (defface pdf-occur-document-face
   '((default (:inherit font-lock-string-face)))
-  "Face used to highlight documents in the list buffer."
-  :group 'pdf-occur)
+  "Face used to highlight documents in the list buffer.")
 
 (defface pdf-occur-page-face
   '((default (:inherit font-lock-type-face)))
-  "Face used to highlight page numbers in the list buffer."
-  :group 'pdf-occur)
+  "Face used to highlight page numbers in the list buffer.")
 
 (defcustom pdf-occur-search-batch-size 16
   "Maximum number of pages searched in one query.
 
 Lower numbers will make Emacs more responsive when searching at
 the cost of slightly increased search time."
-  :group 'pdf-occur
   :type 'integer)
 
 (defcustom pdf-occur-prefer-string-search nil
   "If non-nil, reverse the meaning of the regexp-p prefix-arg."
-  :group 'pdf-occur
   :type 'boolean)
 
 (defvar pdf-occur-history nil
@@ -92,15 +88,15 @@ search.  See `pdf-info-normalize-page-range' for it's 
format.")
 (defvar pdf-occur-buffer-mode-map
   (let ((kmap (make-sparse-keymap)))
     (set-keymap-parent kmap tablist-mode-map)
-    (define-key kmap (kbd "RET") 'pdf-occur-goto-occurrence)
-    (define-key kmap (kbd "C-o") 'pdf-occur-view-occurrence)
-    (define-key kmap (kbd "SPC") 'pdf-occur-view-occurrence)
-    (define-key kmap (kbd "C-c C-f") 'next-error-follow-minor-mode)
-    (define-key kmap (kbd "g") 'pdf-occur-revert-buffer-with-args)
-    (define-key kmap (kbd "K") 'pdf-occur-abort-search)
-    (define-key kmap (kbd "D") 'pdf-occur-tablist-do-delete)
-    (define-key kmap (kbd "x") 'pdf-occur-tablist-do-flagged-delete)
-    (define-key kmap (kbd "A") 'pdf-occur-tablist-gather-documents)
+    (define-key kmap (kbd "RET") #'pdf-occur-goto-occurrence)
+    (define-key kmap (kbd "C-o") #'pdf-occur-view-occurrence)
+    (define-key kmap (kbd "SPC") #'pdf-occur-view-occurrence)
+    (define-key kmap (kbd "C-c C-f") #'next-error-follow-minor-mode)
+    (define-key kmap (kbd "g") #'pdf-occur-revert-buffer-with-args)
+    (define-key kmap (kbd "K") #'pdf-occur-abort-search)
+    (define-key kmap (kbd "D") #'pdf-occur-tablist-do-delete)
+    (define-key kmap (kbd "x") #'pdf-occur-tablist-do-flagged-delete)
+    (define-key kmap (kbd "A") #'pdf-occur-tablist-gather-documents)
     kmap)
   "The keymap used for `pdf-occur-buffer-mode'.")
 
@@ -128,9 +124,9 @@ Some useful keys are:
 
 \\{pdf-occur-buffer-mode-map}"
   (setq-local case-fold-search case-fold-search)
-  (setq-local next-error-function 'pdf-occur-next-error)
+  (setq-local next-error-function #'pdf-occur-next-error)
   (setq-local revert-buffer-function
-              'pdf-occur-revert-buffer)
+              #'pdf-occur-revert-buffer)
   (setq next-error-last-buffer (current-buffer))
   (setq-local tabulated-list-sort-key nil)
   (setq-local tabulated-list-use-header-line t)
@@ -192,10 +188,10 @@ For a programmatic search of multiple documents see
   (let* ((2-columns-p (= 1 (length pdf-occur-search-documents)))
          (filename-width
           (min 24
-               (apply 'max
-                 (mapcar 'length
-                         (mapcar 'pdf-occur-abbrev-document
-                                 (mapcar 'car pdf-occur-search-documents))))))
+               (apply #'max
+                 (mapcar #'length
+                         (mapcar #'pdf-occur-abbrev-document
+                                 (mapcar #'car pdf-occur-search-documents))))))
          (page-sorter (tablist-generate-sorter
                        (if 2-columns-p 0 1)
                        '<
@@ -355,7 +351,6 @@ This global minor mode enables (or disables)
 `pdf-occur-ibuffer-minor-mode' and `pdf-occur-dired-minor-mode'
 in all current and future ibuffer/dired buffer."
   :global t
-  :group 'pdf-occur
   (let ((arg (if pdf-occur-global-minor-mode 1 -1)))
     (dolist (buf (buffer-list))
       (with-current-buffer buf
@@ -366,15 +361,15 @@ in all current and future ibuffer/dired buffer."
           (pdf-occur-ibuffer-minor-mode arg)))))
     (cond
      (pdf-occur-global-minor-mode
-      (add-hook 'dired-mode-hook 'pdf-occur-dired-minor-mode)
-      (add-hook 'ibuffer-mode-hook 'pdf-occur-ibuffer-minor-mode))
+      (add-hook 'dired-mode-hook #'pdf-occur-dired-minor-mode)
+      (add-hook 'ibuffer-mode-hook #'pdf-occur-ibuffer-minor-mode))
      (t
-      (remove-hook 'dired-mode-hook 'pdf-occur-dired-minor-mode)
-      (remove-hook 'ibuffer-mode-hook 'pdf-occur-ibuffer-minor-mode)))))
+      (remove-hook 'dired-mode-hook #'pdf-occur-dired-minor-mode)
+      (remove-hook 'ibuffer-mode-hook #'pdf-occur-ibuffer-minor-mode)))))
 
 (defvar pdf-occur-ibuffer-minor-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [remap ibuffer-do-occur] 'pdf-occur-ibuffer-do-occur)
+    (define-key map [remap ibuffer-do-occur] #'pdf-occur-ibuffer-do-occur)
     map)
   "Keymap used in `pdf-occur-ibuffer-minor-mode'.")
 
@@ -385,8 +380,7 @@ in all current and future ibuffer/dired buffer."
 This mode remaps `ibuffer-do-occur' to
 `pdf-occur-ibuffer-do-occur', which will start the PDF Tools
 version of `occur', if all marked buffer's are in `pdf-view-mode'
-and otherwise fallback to `ibuffer-do-occur'."
-  :group 'pdf-occur)
+and otherwise fallback to `ibuffer-do-occur'.")
 
 (defun pdf-occur-ibuffer-do-occur (&optional regexp-p)
   "Uses `pdf-occur-search', if appropriate.
@@ -409,7 +403,7 @@ I.e. all marked buffers are in PDFView mode."
 
 (defvar pdf-occur-dired-minor-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [remap dired-do-search] 'pdf-occur-dired-do-search)
+    (define-key map [remap dired-do-search] #'pdf-occur-dired-do-search)
     map)
   "Keymap used in `pdf-occur-dired-minor-mode'.")
 
@@ -420,8 +414,7 @@ I.e. all marked buffers are in PDFView mode."
 This mode remaps `dired-do-search' to
 `pdf-occur-dired-do-search', which will start the PDF Tools
 version of `occur', if all marked buffer's are in `pdf-view-mode'
-and otherwise fallback to `dired-do-search'."
-  :group 'pdf-occur)
+and otherwise fallback to `dired-do-search'.")
 
 (defun pdf-occur-dired-do-search ()
   "Uses `pdf-occur-search', if appropriate.
@@ -477,7 +470,8 @@ Returns the window where the buffer is displayed."
     (display-buffer
      (current-buffer))))
 
-(defadvice tabulated-list-init-header (after update-header activate)
+(advice-add 'tabulated-list-init-header :after #'pdf-occur--update-header)
+(defun pdf-occur--update-header (&rest _)
   "We want our own headers, thank you."
   (when (derived-mode-p 'pdf-occur-buffer-mode)
     (save-current-buffer
@@ -554,7 +548,7 @@ matches linked with PAGE."
          (mapcar (lambda (doc)
                    (pdf-occur-create-entry doc 1))
                  (cl-set-difference
-                  (mapcar 'car
+                  (mapcar #'car
                           pdf-occur-search-documents)
                   (mapcar (lambda (elt)
                             (plist-get (car elt) :document))
@@ -634,7 +628,7 @@ matches linked with PAGE."
      batches)
     (setq pdf-occur-number-of-matches 0)
     (setq pdf-occur-search-pages-left
-          (apply '+ (mapcar (lambda (elt)
+          (apply #'+ (mapcar (lambda (elt)
                               (1+ (- (cdr (nth 1 elt))
                                      (car (nth 1 elt)))))
                             batches)))))
@@ -695,7 +689,7 @@ matches linked with PAGE."
 Examine all dired/ibuffer windows and offer to put marked files
 in the search list."
   (interactive)
-  (let ((searched (mapcar 'car pdf-occur-search-documents))
+  (let ((searched (mapcar #'car pdf-occur-search-documents))
         files)
     (dolist (win (window-list))
       (with-selected-window win
@@ -708,7 +702,7 @@ in the search list."
               (setq files
                     (append files marked nil)))))
          ((derived-mode-p 'ibuffer-mode)
-          (dolist (fname (mapcar 'buffer-file-name
+          (dolist (fname (mapcar #'buffer-file-name
                                  (ibuffer-get-marked-buffers)))
             (when fname
               (push fname files))))
@@ -734,7 +728,7 @@ in the search list."
       (when (tablist-yes-or-no-p
              'add nil (mapcar (lambda (file)
                                 (cons nil (vector file)))
-                              (cl-sort files 'string-lessp)))
+                              (cl-sort files #'string-lessp)))
         (setq pdf-occur-search-documents
               (append pdf-occur-search-documents
                       (pdf-occur-normalize-documents files)))
diff --git a/lisp/pdf-outline.el b/lisp/pdf-outline.el
index d8107ae023..68459b8bba 100644
--- a/lisp/pdf-outline.el
+++ b/lisp/pdf-outline.el
@@ -41,80 +41,73 @@
 
 (defcustom pdf-outline-buffer-indent 2
   "The level of indent in the Outline buffer."
-  :type 'integer
-  :group 'pdf-outline)
+  :type 'integer)
 
 (defcustom pdf-outline-enable-imenu t
   "Whether `imenu' should be enabled in PDF documents."
-  :group 'pdf-outline
   :type '(choice (const :tag "Yes" t)
                  (const :tag "No" nil)))
 
 (defcustom pdf-outline-imenu-keep-order t
   "Whether `imenu' should be advised not to reorder the outline."
-  :group 'pdf-outline
   :type '(choice (const :tag "Yes" t)
                  (const :tag "No" nil)))
 
 (defcustom pdf-outline-imenu-use-flat-menus nil
   "Whether the constructed Imenu should be a list, rather than a tree."
-  :group 'pdf-outline
   :type '(choice (const :tag "Yes" t)
                  (const :tag "No" nil)))
 
 (defcustom pdf-outline-display-buffer-action '(nil . nil)
   "The display action used, when displaying the outline buffer."
-  :group 'pdf-outline
   :type display-buffer--action-custom-type)
 
 (defcustom pdf-outline-display-labels nil
   "Whether the outline should display labels instead of page numbers.
 
 Usually a page's label is it's displayed page number."
-  :group 'pdf-outline
   :type 'boolean)
 
 (defcustom pdf-outline-fill-column fill-column
   "The value of `fill-column' in pdf outline buffers.
 
 Set to nil to disable line wrapping."
-  :group 'pdf-outline
   :type 'integer)
 
 (defvar pdf-outline-minor-mode-map
   (let ((km (make-sparse-keymap)))
-    (define-key km (kbd "o") 'pdf-outline)
+    (define-key km (kbd "o") #'pdf-outline)
     km)
   "Keymap used for `pdf-outline-minor-mode'.")
 
 (defvar pdf-outline-buffer-mode-map
   (let ((kmap (make-sparse-keymap)))
     (dotimes (i 10)
-      (define-key kmap (vector (+ i ?0)) 'digit-argument))
-    (define-key kmap "-" 'negative-argument)
-    (define-key kmap (kbd "p") 'previous-line)
-    (define-key kmap (kbd "n") 'next-line)
-    (define-key kmap (kbd "b") 'outline-backward-same-level)
-    (define-key kmap (kbd "d") 'hide-subtree)
-    (define-key kmap (kbd "a") 'show-all)
-    (define-key kmap (kbd "s") 'show-subtree)
-    (define-key kmap (kbd "f") 'outline-forward-same-level)
-    (define-key kmap (kbd "u") 'pdf-outline-up-heading)
-    (define-key kmap (kbd "Q") 'hide-sublevels)
-    (define-key kmap (kbd "<") 'beginning-of-buffer)
-    (define-key kmap (kbd ">") 'pdf-outline-end-of-buffer)
-    (define-key kmap (kbd "TAB") 'outline-toggle-children)
-    (define-key kmap (kbd "RET") 'pdf-outline-follow-link)
-    (define-key kmap (kbd "C-o") 'pdf-outline-display-link)
-    (define-key kmap (kbd "SPC") 'pdf-outline-display-link)
-    (define-key kmap [mouse-1] 'pdf-outline-mouse-display-link)
-    (define-key kmap (kbd "o") 'pdf-outline-select-pdf-window)
-    (define-key kmap (kbd ".") 'pdf-outline-move-to-current-page)
-    ;; (define-key kmap (kbd "Q") 'pdf-outline-quit)
-    (define-key kmap (kbd "C-c C-q") 'pdf-outline-quit-and-kill)
-    (define-key kmap (kbd "q") 'quit-window)
-    (define-key kmap (kbd "M-RET") 'pdf-outline-follow-link-and-quit)
-    (define-key kmap (kbd "C-c C-f") 'pdf-outline-follow-mode)
+      (define-key kmap (vector (+ i ?0)) #'digit-argument))
+    (define-key kmap "-" #'negative-argument)
+    (define-key kmap (kbd "p") #'previous-line)
+    (define-key kmap (kbd "n") #'next-line)
+    (define-key kmap (kbd "b") #'outline-backward-same-level)
+    (define-key kmap (kbd "d") #'hide-subtree)
+    (define-key kmap (kbd "a") #'show-all)
+    (define-key kmap (kbd "s") #'show-subtree)
+    (define-key kmap (kbd "f") #'outline-forward-same-level)
+    (define-key kmap (kbd "u") #'pdf-outline-up-heading)
+    (define-key kmap (kbd "Q") #'hide-sublevels)
+    (define-key kmap (kbd "<") #'beginning-of-buffer)
+    (define-key kmap (kbd ">") #'pdf-outline-end-of-buffer)
+    (define-key kmap (kbd "TAB") #'outline-toggle-children)
+    (define-key kmap (kbd "RET") #'pdf-outline-follow-link)
+    (define-key kmap (kbd "C-o") #'pdf-outline-display-link)
+    (define-key kmap (kbd "SPC") #'pdf-outline-display-link)
+    (define-key kmap [mouse-1] #'pdf-outline-mouse-display-link)
+    (define-key kmap (kbd "o") #'pdf-outline-select-pdf-window)
+    (define-key kmap (kbd ".") #'pdf-outline-move-to-current-page)
+    ;; (define-key kmap (kbd "Q") #'pdf-outline-quit)
+    (define-key kmap (kbd "C-c C-q") #'pdf-outline-quit-and-kill)
+    (define-key kmap (kbd "q") #'quit-window)
+    (define-key kmap (kbd "M-RET") #'pdf-outline-follow-link-and-quit)
+    (define-key kmap (kbd "C-c C-f") #'pdf-outline-follow-mode)
     kmap)
   "Keymap used in `pdf-outline-buffer-mode'.")
 
@@ -197,9 +190,9 @@ rebound to their respective last character.
   (setq pdf-outline-follow-mode-last-link nil)
   (cond
    (pdf-outline-follow-mode
-    (add-hook 'post-command-hook 'pdf-outline-follow-mode-pch nil t))
+    (add-hook 'post-command-hook #'pdf-outline-follow-mode-pch nil t))
    (t
-    (remove-hook 'post-command-hook 'pdf-outline-follow-mode-pch t))))
+    (remove-hook 'post-command-hook #'pdf-outline-follow-mode-pch t))))
 
 (defun pdf-outline-follow-mode-pch ()
   (let ((link (pdf-outline-link-at-pos (point))))
diff --git a/lisp/pdf-sync.el b/lisp/pdf-sync.el
index 5a349dd680..b85009cce7 100644
--- a/lisp/pdf-sync.el
+++ b/lisp/pdf-sync.el
@@ -47,7 +47,6 @@
 
 This key is added to `TeX-source-correlate-method', when
 command `pdf-sync-minor-mode' is activated and this map is defined."
-  :group 'pdf-sync
   :type 'key-sequence)
 
 (make-obsolete-variable
@@ -58,7 +57,6 @@ command `pdf-sync-minor-mode' is activated and this map is 
defined."
   "Hook ran after going to a source location.
 
 The hook is run in the TeX buffer."
-  :group 'pdf-sync
   :type 'hook
   :options '(pdf-sync-backward-beginning-of-word))
 
@@ -66,17 +64,14 @@ The hook is run in the TeX buffer."
   "Hook ran after displaying the PDF buffer.
 
 The hook is run in the PDF's buffer."
-  :group 'pdf-sync
   :type 'hook)
 
 (defcustom pdf-sync-forward-display-action nil
   "Display action used when displaying PDF buffers."
-  :group 'pdf-sync
   :type 'display-buffer--action-custom-type)
 
 (defcustom pdf-sync-backward-display-action nil
   "Display action used when displaying TeX buffers."
-  :group 'pdf-sync
   :type 'display-buffer--action-custom-type)
 
 (defcustom pdf-sync-locate-synctex-file-functions nil
@@ -86,13 +81,12 @@ Each function on this hook should accept a single argument: 
The
 absolute path of a PDF file.  It should return the absolute path
 of the corresponding synctex database or nil, if it was unable to
 locate it."
-  :group 'pdf-sync
   :type 'hook)
 
 (defvar pdf-sync-minor-mode-map
   (let ((kmap (make-sparse-keymap)))
-    (define-key kmap [double-mouse-1] 'pdf-sync-backward-search-mouse)
-    (define-key kmap [C-mouse-1] 'pdf-sync-backward-search-mouse)
+    (define-key kmap [double-mouse-1] #'pdf-sync-backward-search-mouse)
+    (define-key kmap [C-mouse-1] #'pdf-sync-backward-search-mouse)
     kmap))
 
 (defcustom pdf-sync-backward-redirect-functions nil
@@ -110,7 +104,6 @@ none) values modified.
 AUCTeX installs a function here which changes the backward search
 location for synthetic `TeX-region' files back to the equivalent
 position in the original tex file."
-  :group 'pdf-sync
   :type '(repeat function))
 
 
@@ -145,7 +138,6 @@ with AUCTeX."
 
 If nil, just go where Synctex tells us.  Otherwise try to find
 the exact location of the clicked-upon text in the PDF."
-  :group 'pdf-sync
   :type 'boolean)
 
 (defcustom pdf-sync-backward-text-translations
@@ -263,7 +255,6 @@ file.  These strings should not match
 `pdf-sync-backward-source-flush-regexp'.
 
 Has no effect if `pdf-sync-backward-use-heuristic' is nil."
-  :group 'pdf-sync
   :type '(alist :key-type character
                 :value-type (repeat string)))
 
@@ -320,7 +311,7 @@ point to the correct position."
                         .line .column)))
         (cl-destructuring-bind (source line column)
             (or (save-selected-window
-                  (apply 'run-hook-with-args-until-success
+                  (apply #'run-hook-with-args-until-success
                     'pdf-sync-backward-redirect-functions data))
                 data)
           (list source
@@ -539,22 +530,19 @@ word-level searching is desired."
 (define-minor-mode pdf-sync-backward-debug-minor-mode
   "Aid in debugging the backward search."
   :group 'pdf-sync
-  (if (and (fboundp 'advice-add)
-           (fboundp 'advice-remove))
-      (let ((functions
-             '(pdf-sync-backward-search
-               pdf-sync-backward--tokenize
-               pdf-util-seq-alignment)))
-        (cond
-         (pdf-sync-backward-debug-minor-mode
-          (dolist (fn functions)
-            (advice-add fn :around (apply-partially 
'pdf-sync-backward-debug-wrapper
-                                                    fn)
-                        `((name . ,(format "%s-debug" fn))))))
-         (t
-          (dolist (fn functions)
-            (advice-remove fn (format "%s-debug" fn))))))
-    (error "Need Emacs version >= 24.4")))
+  (let ((functions
+         '(pdf-sync-backward-search
+           pdf-sync-backward--tokenize
+           pdf-util-seq-alignment)))
+    (cond
+     (pdf-sync-backward-debug-minor-mode
+      (dolist (fn functions)
+        (advice-add fn :around
+                    (apply-partially #'pdf-sync-backward-debug-wrapper fn)
+                    `((name . ,(format "%s-debug" fn))))))
+     (t
+      (dolist (fn functions)
+        (advice-remove fn (format "%s-debug" fn)))))))
 
 (defun pdf-sync-backward-debug-explain ()
   "Explain the last backward search.
@@ -591,7 +579,7 @@ Needs to have `pdf-sync-backward-debug-minor-mode' enabled."
                        (insert
                         (mapconcat (lambda (elt)
                                      (if (consp elt)
-                                         (mapconcat 'identity elt or-sep)
+                                         (mapconcat #'identity elt or-sep)
                                        elt))
                                    (nth 2 (cdr text)) " "))
                        (point)))
@@ -604,7 +592,7 @@ Needs to have `pdf-sync-backward-debug-minor-mode' enabled."
         (insert (propertize "Source Token:" 'face 'font-lock-keyword-face))
         (insert sep)
         (fill-region (point)
-                     (progn (insert (mapconcat 'identity (nth 2 (cdr source)) 
" "))
+                     (progn (insert (mapconcat #'identity (nth 2 (cdr source)) 
" "))
                             (point)))
         (insert sep)
 
@@ -617,7 +605,7 @@ Needs to have `pdf-sync-backward-debug-minor-mode' enabled."
           (dolist (a (cdr (cdr alignment)))
             (let* ((source (cdr a))
                    (text (if (consp (car a))
-                             (mapconcat 'identity (car a) or-sep)
+                             (mapconcat #'identity (car a) or-sep)
                            (car a)))
                    (extend (max (length text)
                                 (length source))))
diff --git a/lisp/pdf-tools.el b/lisp/pdf-tools.el
index faaceab90b..660ffad628 100644
--- a/lisp/pdf-tools.el
+++ b/lisp/pdf-tools.el
@@ -2,12 +2,13 @@
 
 ;; Copyright (C) 2013, 2014  Andreas Politz
 
-;; Author: Andreas Politz <politza@fh-trier.de>
+;; Author: Andreas Politz <mail@andreas-politz.de>
+;; Maintainer: Vedang Manerikar <vedang.manerikar@gmail.com>
 ;; URL: http://github.com/vedang/pdf-tools/
 ;; Keywords: files, multimedia
 ;; Package: pdf-tools
 ;; Version: 1.0
-;; Package-Requires: ((emacs "24.3") (tablist "1.0") (let-alist "1.0.4"))
+;; Package-Requires: ((emacs "24.3") (nadvice "0.3") (tablist "1.0") 
(let-alist "1.0.4"))
 
 ;; 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
@@ -307,10 +308,11 @@ Returns the buffer of the compilation process."
   (unless callback (setq callback #'ignore))
   (unless build-directory
     (setq build-directory (pdf-tools-locate-build-directory)))
-  (cl-check-type target-directory file-directory)
+  (cl-check-type target-directory (satisfies file-directory-p))
   (setq target-directory (file-name-as-directory
                           (expand-file-name target-directory)))
-  (cl-check-type build-directory (and (not null) file-directory))
+  (cl-check-type build-directory (and (not null)
+                                      (satisfies file-directory-p)))
   (when (and skip-dependencies-p force-dependencies-p)
     (error "Can't simultaneously skip and force dependencies"))
   (let* ((compilation-auto-jump-to-first-error nil)
@@ -428,7 +430,7 @@ See `pdf-view-mode' and `pdf-tools-enabled-modes'."
   (when (memq 'pdf-virtual-global-minor-mode
               pdf-tools-enabled-modes)
     (pdf-virtual-global-minor-mode 1))
-  (add-hook 'pdf-view-mode-hook 'pdf-tools-enable-minor-modes)
+  (add-hook 'pdf-view-mode-hook #'pdf-tools-enable-minor-modes)
   (dolist (buf (buffer-list))
     (with-current-buffer buf
       (when (and (not (derived-mode-p 'pdf-view-mode))
@@ -446,7 +448,7 @@ See `pdf-view-mode' and `pdf-tools-enabled-modes'."
     (remove pdf-tools-magic-mode-alist-entry magic-mode-alist))
   (pdf-occur-global-minor-mode -1)
   (pdf-virtual-global-minor-mode -1)
-  (remove-hook 'pdf-view-mode-hook 'pdf-tools-enable-minor-modes)
+  (remove-hook 'pdf-view-mode-hook #'pdf-tools-enable-minor-modes)
   (dolist (buf (buffer-list))
     (with-current-buffer buf
       (when (pdf-util-pdf-buffer-p buf)
@@ -504,7 +506,7 @@ MODES defaults to `pdf-tools-enabled-modes'."
     (princ "PDF Tools Help\n\n")
     (princ "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n")
     (dolist (m (cons 'pdf-view-mode
-                     (sort (copy-sequence pdf-tools-modes) 'string<)))
+                     (sort (copy-sequence pdf-tools-modes) #'string<)))
       (princ (format "`%s' is " m))
       (describe-function-1 m)
       (terpri) (terpri)
diff --git a/lisp/pdf-util.el b/lisp/pdf-util.el
index d8691beda6..09788a2099 100644
--- a/lisp/pdf-util.el
+++ b/lisp/pdf-util.el
@@ -71,7 +71,7 @@ remove the entry if the new value is `eql' to DEFAULT."
 
 (require 'register)
 (unless (fboundp 'register-read-with-preview)
-  (defalias 'register-read-with-preview 'read-char
+  (defalias 'register-read-with-preview #'read-char
     "Compatibility alias for pdf-tools."))
 
 ;; In Emacs 24.3 window-width does not have a PIXELWISE argument.
@@ -303,6 +303,42 @@ See `pdf-util-scale' for the LIST-OF-EDGES-OR-POS 
argument."
           result
         (car result)))))
 
+(defmacro pdf-util-with-edges (list-of-edges &rest body)
+  "Provide some convenient macros for the edges in LIST-OF-EDGES.
+
+LIST-OF-EDGES should be a list of variables \(X ...\), each one
+holding a list of edges. Inside BODY the symbols X-left, X-top,
+X-right, X-bot, X-width and X-height expand to their respective
+values."
+
+  (declare (indent 1) (debug (sexp &rest form)))
+  (unless (cl-every 'symbolp list-of-edges)
+    (error "Argument should be a list of symbols"))
+  (let ((list-of-syms
+         (mapcar (lambda (edge)
+                   (cons edge (mapcar
+                               (lambda (kind)
+                                 (intern (format "%s-%s" edge kind)))
+                               '(left top right bot width height))))
+                 list-of-edges)))
+    (macroexpand-all
+     `(cl-symbol-macrolet
+          ,(apply #'nconc
+                  (mapcar
+                   (lambda (edge-syms)
+                     (let ((edge (nth 0 edge-syms))
+                           (syms (cdr edge-syms)))
+                       `((,(pop syms) (nth 0 ,edge))
+                         (,(pop syms) (nth 1 ,edge))
+                         (,(pop syms) (nth 2 ,edge))
+                         (,(pop syms) (nth 3 ,edge))
+                         (,(pop syms) (- (nth 2 ,edge)
+                                         (nth 0 ,edge)))
+                         (,(pop syms) (- (nth 3 ,edge)
+                                         (nth 1 ,edge))))))
+                   list-of-syms))
+        ,@body))))
+
 (defun pdf-util-edges-transform (region elts &optional to-region-p)
   "Translate ELTS according to REGION.
 
@@ -355,43 +391,6 @@ depending on the input."
             result
           (car result))))))
 
-(defmacro pdf-util-with-edges (list-of-edges &rest body)
-  "Provide some convenient macros for the edges in LIST-OF-EDGES.
-
-LIST-OF-EDGES should be a list of variables \(X ...\), each one
-holding a list of edges. Inside BODY the symbols X-left, X-top,
-X-right, X-bot, X-width and X-height expand to their respective
-values."
-
-  (declare (indent 1) (debug (sexp &rest form)))
-  (unless (cl-every 'symbolp list-of-edges)
-    (error "Argument should be a list of symbols"))
-  (let ((list-of-syms
-         (mapcar (lambda (edge)
-                   (cons edge (mapcar
-                               (lambda (kind)
-                                 (intern (format "%s-%s" edge kind)))
-                               '(left top right bot width height))))
-                 list-of-edges)))
-    (macroexpand-all
-     `(cl-symbol-macrolet
-          ,(apply 'nconc
-                  (mapcar
-                   (lambda (edge-syms)
-                     (let ((edge (nth 0 edge-syms))
-                           (syms (cdr edge-syms)))
-                       `((,(pop syms) (nth 0 ,edge))
-                         (,(pop syms) (nth 1 ,edge))
-                         (,(pop syms) (nth 2 ,edge))
-                         (,(pop syms) (nth 3 ,edge))
-                         (,(pop syms) (- (nth 2 ,edge)
-                                         (nth 0 ,edge)))
-                         (,(pop syms) (- (nth 3 ,edge)
-                                         (nth 1 ,edge))))))
-                   list-of-syms))
-        ,@body))))
-
-
 ;; * ================================================================== *
 ;; * Scrolling
 ;; * ================================================================== *
@@ -415,7 +414,7 @@ Returns a list of pixel edges."
                   (+ x0 (- (nth 2 edges) (nth 0 edges)))))
          (y1 (min (cdr isize)
                   (+ y0 (- (nth 3 edges) (nth 1 edges))))))
-    (mapcar 'round (list x0 y0 x1 y1))))
+    (mapcar #'round (list x0 y0 x1 y1))))
 
 (defun pdf-util-required-hscroll (edges &optional eager-p context-pixel)
   "Return the amount of scrolling necessary, to make image EDGES visible.
@@ -560,7 +559,7 @@ killed."
         (setq pdf-util--dedicated-directory
               (make-temp-file (convert-standard-filename 
(pdf-util-temp-prefix))
                               t))
-        (add-hook 'kill-buffer-hook 'pdf-util-delete-dedicated-directory
+        (add-hook 'kill-buffer-hook #'pdf-util-delete-dedicated-directory
                   nil t)))
     pdf-util--dedicated-directory))
 
@@ -648,7 +647,7 @@ Signal an error, if color is invalid."
     (let ((values (color-values color)))
       (unless values
         (signal 'wrong-type-argument (list 'color-defined-p color)))
-      (apply 'format "#%02x%02x%02x"
+      (apply #'format "#%02x%02x%02x"
              (mapcar (lambda (c) (lsh c -8))
                      values)))))
 
@@ -690,6 +689,10 @@ string."
             ,@tooltip-frame-parameters)))
     (tooltip-show text)))
 
+;; FIXME: Defined in `pdf-view' but we can't require it here because it
+;; requires us :-(
+(defvar pdf-view-midnight-colors)
+
 (defun pdf-util-tooltip-arrow (image-top &optional timeout)
   (pdf-util-assert-pdf-window)
   (when (floatp image-top)
@@ -735,7 +738,8 @@ string."
 
 (defvar pdf-util--face-colors-cache (make-hash-table))
 
-(defadvice enable-theme (after pdf-util-clear-faces-cache activate)
+(advice-add 'enable-theme :after #'pdf-util--clear-faces-cache)
+(defun pdf-util--clear-faces-cache (&rest _)
   (clrhash pdf-util--face-colors-cache))
 
 (defun pdf-util-face-colors (face &optional dark-p)
@@ -762,7 +766,7 @@ colors, otherwise light."
                   (let ((colors
                          (cons (face-attribute face :foreground nil 'default)
                                (face-attribute face :background nil 
'default))))
-                    (puthash face `(,(mapcar 'copy-sequence spec)
+                    (puthash face `(,(mapcar #'copy-sequence spec)
                                     ((,bg . ,colors) ,@color-alist))
                              pdf-util--face-colors-cache)
                     colors)
@@ -859,15 +863,14 @@ them is nil, it means there is gap at this position in the
 respective sequence."
 
   (cl-macrolet ((make-matrix (rows columns)
-                  (list 'apply (list 'quote 'vector)
-                        (list 'cl-loop 'for 'i 'from 1 'to rows
-                              'collect (list 'make-vector columns nil))))
+                  `(apply #'vector
+                          (cl-loop for i from 1 to ,rows
+                                   collect (make-vector ,columns nil))))
                 (mset (matrix row column newelt)
-                  (list 'aset (list 'aref matrix row) column newelt))
+                  `(aset (aref ,matrix ,row) ,column ,newelt))
                 (mref (matrix row column)
-                  (list 'aref (list 'aref matrix row) column)))
-    (let* ((nil-value nil)
-           (len1 (length seq1))
+                  `(aref (aref ,matrix ,row) ,column)))
+    (let* ((len1 (length seq1))
            (len2 (length seq2))
            (d (make-matrix (1+ len1) (1+ len2)))
            (prefix-p (memq alignment-type '(prefix infix)))
@@ -903,7 +906,7 @@ respective sequence."
                  (= (mref d i j)
                     (1- (mref d (1- i) j))))
             (cl-decf i)
-            (push (cons (elt seq1 i) nil-value) alignment))
+            (push (cons (elt seq1 i) nil) alignment))
            ((and (> j 0)
                  (= (mref d i j)
                     (+ (mref d i (1- j))
@@ -911,13 +914,14 @@ respective sequence."
                                (and (= i len1) prefix-p))
                            0 -1))))
             (cl-decf j)
-            (push (cons nil-value (elt seq2 j)) alignment))
+            (push (cons nil (elt seq2 j)) alignment))
            (t
             (cl-assert (and (> i 0) (> j 0)) t)
             (cl-decf i)
             (cl-decf j)
             (push (cons (elt seq1 i)
-                        (elt seq2 j)) alignment))))
+                        (elt seq2 j))
+                  alignment))))
         (cons (mref d len1 len2) alignment)))))
 
 
@@ -934,7 +938,7 @@ See also `regexp-quote'."
       (when (memq ch to-escape)
         (push ?\\ escaped))
       (push ch escaped))
-    (apply 'string (nreverse escaped))))
+    (apply #'string (nreverse escaped))))
 
 (defun pdf-util-frame-ppi ()
   "Return the PPI of the current frame."
@@ -1059,10 +1063,10 @@ of the last commands given earlier in SPEC. E.g. a call 
like
        image-file out-file
        :foreground \"black\"
        :background \"white\"
-       :commands '\(\"-fill\" \"%f\" \"-draw\" \"rectangle %x,%y,%X,%Y\"\)
-       :apply '\(\(0 0 10 10\) \(10 10 20 20\)\)
-       :commands '\(\"-fill\" \"%b\" \"-draw\" \"rectangle %x,%y,%X,%Y\"\)
-       :apply '\(\(10 0 20 10\) \(0 10 10 20\)\)\)
+       :commands '(\"-fill\" \"%f\" \"-draw\" \"rectangle %x,%y,%X,%Y\")
+       :apply '((0 0 10 10) (10 10 20 20))
+       :commands '(\"-fill\" \"%b\" \"-draw\" \"rectangle %x,%y,%X,%Y\")
+       :apply '((10 0 20 10) (0 10 10 20)))
 
 would draw a 4x4 checkerboard pattern in the left corner of the
 image, while leaving the rest of it as it was.
@@ -1072,7 +1076,7 @@ Returns OUT-FILE.
 See url `http://www.imagemagick.org/script/convert.php'."
   (pdf-util-assert-convert-program)
   (let* ((cmds (pdf-util-convert--create-commands spec))
-         (status (apply 'call-process
+         (status (apply #'call-process
                         pdf-util-convert-program nil
                         (get-buffer-create "*pdf-util-convert-output*")
                         nil
@@ -1097,7 +1101,7 @@ Returns the convert process."
             callback nil))
     (let* ((cmds (pdf-util-convert--create-commands spec))
            (proc
-            (apply 'start-process "pdf-util-convert"
+            (apply #'start-process "pdf-util-convert"
                    (get-buffer-create "*pdf-util-convert-output*")
                    pdf-util-convert-program
                    `(,in-file ,@cmds ,out-file))))
@@ -1122,7 +1126,7 @@ Return the converted PNG image as a string.  See also
             (set-buffer-file-coding-system 'binary)
             (insert image-data))
           (pdf-util-munch-file
-           (apply 'pdf-util-convert
+           (apply #'pdf-util-convert
                   in-file out-file specs)))
       (when (file-exists-p in-file)
         (delete-file in-file))
@@ -1224,10 +1228,10 @@ If RELATIVE-P is non-nil, also check that all values <= 
1."
 (defun pdf-util-edges-union (&rest edges)
   (if (null (cdr edges))
       (car edges)
-    (list (apply 'min (mapcar 'car edges))
-          (apply 'min (mapcar 'cadr edges))
-          (apply 'max (mapcar 'cl-caddr edges))
-          (apply 'max (mapcar 'cl-cadddr edges)))))
+    (list (apply #'min (mapcar #'car edges))
+          (apply #'min (mapcar #'cadr edges))
+          (apply #'max (mapcar #'cl-caddr edges))
+          (apply #'max (mapcar #'cl-cadddr edges)))))
 
 (defun pdf-util-edges-intersection-area (e1 e2)
   (let ((inters (pdf-util-edges-intersection e1 e2)))
diff --git a/lisp/pdf-view.el b/lisp/pdf-view.el
index 532b524eeb..6b50fbd4d6 100644
--- a/lisp/pdf-view.el
+++ b/lisp/pdf-view.el
@@ -34,7 +34,7 @@
 (require 'password-cache)
 
 (declare-function cua-copy-region "cua-base")
-
+(declare-function pdf-tools-pdf-buffer-p "pdf-tools")
 
 ;; * ================================================================== *
 ;; * Customizations
@@ -401,16 +401,15 @@ PNG images in Emacs buffers."
                  (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))
+      t)))
 
 (defun pdf-view-check-incompatible-modes (&optional buffer)
   "Check BUFFER for incompatible modes, maybe issue a warning."
@@ -581,6 +580,9 @@ For example, (pdf-view-shrink 1.25) decreases size by 20%."
 ;; * Moving by pages and scrolling
 ;; * ================================================================== *
 
+(defvar pdf-view-inhibit-redisplay nil)
+(defvar pdf-view-inhibit-hotspots nil)
+
 (defun pdf-view-goto-page (page &optional window)
   "Go to PAGE in PDF.
 
@@ -879,9 +881,6 @@ See also `pdf-view-set-slice-from-bounding-box'."
 ;; * Display
 ;; * ================================================================== *
 
-(defvar pdf-view-inhibit-redisplay nil)
-(defvar pdf-view-inhibit-hotspots nil)
-
 (defun pdf-view-image-type ()
   "Return the image type that should be used.
 
diff --git a/lisp/pdf-virtual.el b/lisp/pdf-virtual.el
index e2e4543c3e..613a966db0 100644
--- a/lisp/pdf-virtual.el
+++ b/lisp/pdf-virtual.el
@@ -41,6 +41,7 @@
 (require 'pdf-info)
 (require 'pdf-util)
 
+(declare-function pdf-view-mode "pdf-view.el")
 
 ;; * ================================================================== *
 ;; * Variables
diff --git a/test/pdf-cache-test.el b/test/pdf-cache-test.el
index 26b7fe7ff7..24abf6df45 100644
--- a/test/pdf-cache-test.el
+++ b/test/pdf-cache-test.el
@@ -1,4 +1,4 @@
-
+;; -*- lexical-binding: t; -*-
 
 ;; * ================================================================== *
 ;; * Tests for pdf-cache.el
@@ -28,4 +28,3 @@
                     (pdf-cache--make-image 1 1 "1" nil)
                     (pdf-cache--make-image 3 1 "3" nil))))
     (should-not (pdf-cache-get-image 4 1))))
-
diff --git a/test/pdf-sync-test.el b/test/pdf-sync-test.el
index 544f99b64b..e1ebf7223a 100644
--- a/test/pdf-sync-test.el
+++ b/test/pdf-sync-test.el
@@ -1,4 +1,4 @@
-
+;; -*- lexical-binding: t; -*-
 
 ;; * ================================================================== *
 ;; * Tests for pdf-sync.el
diff --git a/test/pdf-tools-test.el b/test/pdf-tools-test.el
index 8a247e8ab0..50674a7c33 100644
--- a/test/pdf-tools-test.el
+++ b/test/pdf-tools-test.el
@@ -1,4 +1,4 @@
-
+;; -*- lexical-binding: t; -*-
 
 ;; * ================================================================== *
 ;; * Tests not fitting anywhere else
diff --git a/test/pdf-util-test.el b/test/pdf-util-test.el
index 1f468d304c..71f2ce3f4e 100644
--- a/test/pdf-util-test.el
+++ b/test/pdf-util-test.el
@@ -1,4 +1,4 @@
-
+;; -*- lexical-binding: t; -*-
 
 ;; * ================================================================== *
 ;; * Tests for pdf-util.el
diff --git a/test/test-helper.el b/test/test-helper.el
index 0b6673d2c8..da01765896 100644
--- a/test/test-helper.el
+++ b/test/test-helper.el
@@ -1,4 +1,4 @@
-;;; test-helper --- Test helper for pdf-tools
+;;; test-helper --- Test helper for pdf-tools  -*- lexical-binding: t; -*-
 
 ;;; Commentary:
 ;; test helper inspired from 
https://github.com/tonini/overseer.el/blob/master/test/test-helper.el
@@ -16,7 +16,7 @@
 
 (unless (and (file-exists-p pdf-tools-package)
              (string-match "\\.tar\\'" pdf-tools-package))
-  (error "Invalid tar package:" pdf-tools-package))
+  (error "Invalid tar package: %s" pdf-tools-package))
 
 (unless load-file-name
   (error "load-file-name is unset"))
@@ -99,4 +99,9 @@
 (require 'ert)
 (require 'pdf-tools)
 
+;; FIXME: Can't be compiled with the Package-Requires dependencies alone.
+;; Local Variables:
+;; no-byte-compile: t
+;; End:
+
 ;;; test-helper.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]