From 37b4c4fcecf2dfe9c7f960864fde1a82bb2ea2c6 Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Mon, 10 Oct 2022 15:34:33 +0530 Subject: Add a byteclean target in the Makefile Similar to the `bytecompile` target, this is for helping with testing. --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f776884..e2bdc29 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,11 @@ $(pkgfile): .cask/$(emacs_version) server/epdfinfo lisp/*.el bytecompile: .cask/$(emacs_version) $(CASK) exec $(emacs) --batch -L lisp -f batch-byte-compile lisp/*.el +# Clean bytecompiled sources +byteclean: + rm -f -- lisp/*.elc + rm -f -- lisp/*.eln + # Run ERT tests test: all PACKAGE_TAR=$(pkgfile) $(CASK) exec ert-runner @@ -68,9 +73,8 @@ melpa-package: $(pkgfile) -f $(pkgname)-melpa.tar # Various clean targets -clean: server-clean +clean: server-clean byteclean rm -f -- $(pkgfile) - rm -f -- lisp/*.elc rm -f -- pdf-tools-readme.txt rm -f -- pdf-tools-$(version).entry -- cgit v1.0 From 710fe66dc48c9fb1f4a411a5636c5dee7dc34943 Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Mon, 10 Oct 2022 15:37:33 +0530 Subject: Explicitly declare documentation files as Org files Renames: NEWS, TODO and README files. README was a symlink to README.org, removes the symlink in favor of simply keeping the Org file. --- TODO | 26 -------------------------- TODO.org | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 26 deletions(-) delete mode 100644 TODO create mode 100644 TODO.org diff --git a/TODO b/TODO deleted file mode 100644 index 68f1e0b..0000000 --- a/TODO +++ /dev/null @@ -1,26 +0,0 @@ --*- org -*- - -* pdf-isearch -** Allow for entering multi-byte characters with some input-methods. - The PDF buffer is in uni-byte mode prohibiting the user from - inserting multi-byte characters in the minibuffer with some - input-methods, while editing the search string. -* PDF Forms - Recent poppler versions have some support for editing forms. -* pdf-annot -** Updating the list buffer is too slow - + Update it incrementally. - + Possibly skip the update if the buffer is not visible. -** Make highlighting customizable -* epdfinfo -** Maybe split the code up in several files. -* pdf-view -** Provide some kind of multi-page view -** Make persistent scrolling relative - Currently the scrolling is kept when changing the image's size (in - pdf-view-display-image), which is actually not so desirable, since - it is absolute. This results e.g. in the image popping out of the - window, when it is shrunken. -* pdf-info -** Add a report/debug command, displaying a list of open files and other information. -** Use alists for results instead of positional lists. diff --git a/TODO.org b/TODO.org new file mode 100644 index 0000000..71384eb --- /dev/null +++ b/TODO.org @@ -0,0 +1,21 @@ +#+TITLE: A list of important / desirable tasks + +* pdf-isearch +** Allow for entering multi-byte characters with some input-methods. +The PDF buffer is in uni-byte mode. It prohibits the user from inserting multi-byte characters in the minibuffer with some input-methods, while editing the search string. +* pdf-forms +Recent poppler versions have some support for editing forms. +* pdf-annot +** Updating the list buffer is too slow ++ Update it incrementally. ++ Possibly skip the update if the buffer is not visible. +** Make highlighting customizable +* epdfinfo +** Maybe split the code up in several files. +* pdf-view +** Provide some kind of multi-page view +** Make persistent scrolling relative +Currently the scrolling is kept when changing the image's size (in pdf-view-display-image), which is actually not so desirable, since it is absolute. This results e.g. in the image popping out of the window, when it is shrunken. +* pdf-info +** Add a report/debug command, displaying a list of open files and other information. +** Use alists for results instead of positional lists. -- cgit v1.0 From 365d2d8e8ed45c4358ff767a40fdc184746e043b Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Mon, 3 Oct 2022 14:42:02 +0530 Subject: Remove guards in `pdf-virtual` tests and code. This is dead-code for supporting Emacs <26.3 Relates to: #26 --- lisp/pdf-virtual.el | 6 -- test/pdf-virtual-test.el | 199 +++++++++++++++++++++++------------------------ 2 files changed, 98 insertions(+), 107 deletions(-) diff --git a/lisp/pdf-virtual.el b/lisp/pdf-virtual.el index 575f622..f8ecf97 100644 --- a/lisp/pdf-virtual.el +++ b/lisp/pdf-virtual.el @@ -31,12 +31,6 @@ ;; asynchronous case. ;;; Code: -(eval-when-compile - (unless (or (> emacs-major-version 24) - (and (= emacs-major-version 24) - (>= emacs-minor-version 4))) - (error "pdf-virtual.el only works with Emacs >= 24.4"))) - (require 'let-alist) (require 'pdf-info) (require 'pdf-util) diff --git a/test/pdf-virtual-test.el b/test/pdf-virtual-test.el index fc20981..ed5e052 100644 --- a/test/pdf-virtual-test.el +++ b/test/pdf-virtual-test.el @@ -1,6 +1,5 @@ ;; -*- lexical-binding: t -*- -(unless (version< emacs-version "24.4") (require 'pdf-virtual) (require 'ert) @@ -40,28 +39,28 @@ (ert-deftest pdf-virtual-document-filenames () (with-pdf-virtual-test-document doc - (should (equal (pdf-virtual-document-filenames doc) - '("test.pdf"))))) + (should (equal (pdf-virtual-document-filenames doc) + '("test.pdf"))))) (ert-deftest pdf-virtual-document-pages () (with-pdf-virtual-test-document doc - (should (equal '(("test.pdf" (4 . 4) nil) - ("test.pdf" (3 . 3) nil) - ("test.pdf" (5 . 6) nil)) - (pdf-virtual-document-pages '(3 . 6) doc))))) + (should (equal '(("test.pdf" (4 . 4) nil) + ("test.pdf" (3 . 3) nil) + ("test.pdf" (5 . 6) nil)) + (pdf-virtual-document-pages '(3 . 6) doc))))) (ert-deftest pdf-virtual-document-page () (with-pdf-virtual-test-document doc - (should (equal '("test.pdf" 6 nil) - (pdf-virtual-document-page 6 doc))))) + (should (equal '("test.pdf" 6 nil) + (pdf-virtual-document-page 6 doc))))) (ert-deftest pdf-virtual-document-page-of () (with-pdf-virtual-test-document doc - (let ((pages '(2 1 4 3 5 6))) - (dotimes (i (length pages)) - (should (equal (1+ i) - (pdf-virtual-document-page-of - "test.pdf" (nth i pages) nil doc))))))) + (let ((pages '(2 1 4 3 5 6))) + (dotimes (i (length pages)) + (should (equal (1+ i) + (pdf-virtual-document-page-of + "test.pdf" (nth i pages) nil doc))))))) (ert-deftest pdf-virtual-open () (with-pdf-virtual-test-buffer @@ -77,29 +76,29 @@ (ert-deftest pdf-virtual-search () (with-pdf-virtual-test-buffer - (dolist (m (list (pdf-info-search-string "PDF" 2) - (pdf-info-search-regexp "PDF" 2))) - (should (= 2 (length m))) - (should (equal (mapcar (apply-partially 'alist-get 'page) - m) - '(2 2))) - (should (cl-every (lambda (elt) - (cl-every 'pdf-test-relative-edges-p elt)) - (mapcar (apply-partially 'alist-get 'edges) - m)))))) + (dolist (m (list (pdf-info-search-string "PDF" 2) + (pdf-info-search-regexp "PDF" 2))) + (should (= 2 (length m))) + (should (equal (mapcar (apply-partially 'alist-get 'page) + m) + '(2 2))) + (should (cl-every (lambda (elt) + (cl-every 'pdf-test-relative-edges-p elt)) + (mapcar (apply-partially 'alist-get 'edges) + m)))))) (ert-deftest pdf-virtual-pagelinks () (with-pdf-virtual-test-buffer - (let ((links (pdf-info-pagelinks 4))) - (should (cl-every 'pdf-test-relative-edges-p - (mapcar (apply-partially 'alist-get 'edges) - links))) - (should (equal (mapcar (apply-partially 'alist-get 'type) - links) - '(goto-dest uri))) - (should (equal (mapcar (apply-partially 'alist-get 'uri) - links) - '(nil "http://www.gnu.org")))))) + (let ((links (pdf-info-pagelinks 4))) + (should (cl-every 'pdf-test-relative-edges-p + (mapcar (apply-partially 'alist-get 'edges) + links))) + (should (equal (mapcar (apply-partially 'alist-get 'type) + links) + '(goto-dest uri))) + (should (equal (mapcar (apply-partially 'alist-get 'uri) + links) + '(nil "http://www.gnu.org")))))) (ert-deftest pdf-virtual-number-of-pages () (with-pdf-virtual-test-buffer @@ -107,23 +106,23 @@ (ert-deftest pdf-virtual-outline () (with-pdf-virtual-test-buffer - (let ((outline (pdf-info-outline))) - (should (= 8 (length outline))) - (should (equal (mapcar (apply-partially 'alist-get 'depth) - outline) - '(1 2 2 2 2 2 3 4))) - (should (cl-every (lambda (type) - (equal type 'goto-dest)) - (mapcar (apply-partially 'alist-get 'type) - (cdr outline))))))) + (let ((outline (pdf-info-outline))) + (should (= 8 (length outline))) + (should (equal (mapcar (apply-partially 'alist-get 'depth) + outline) + '(1 2 2 2 2 2 3 4))) + (should (cl-every (lambda (type) + (equal type 'goto-dest)) + (mapcar (apply-partially 'alist-get 'type) + (cdr outline))))))) (ert-deftest pdf-virtual-gettext () (with-pdf-virtual-test-buffer - (let ((text (pdf-info-gettext 2 '(0 0 1 1)))) - (should - (= 2 (with-temp-buffer - (insert text) - (count-matches "PDF" 1 (point)))))))) + (let ((text (pdf-info-gettext 2 '(0 0 1 1)))) + (should + (= 2 (with-temp-buffer + (insert text) + (count-matches "PDF" 1 (point)))))))) (ert-deftest pdf-virtual-getselection () (with-pdf-virtual-test-buffer @@ -144,29 +143,29 @@ (ert-deftest pdf-virtual-pagesize () (with-pdf-virtual-test-buffer - (let* ((os '(612 . 792)) - (s (pdf-info-pagesize 1)) - (ds (cons (* (- 0.4046 0.1879) (car os)) - (* (- 0.3392 0.2462) (cdr os))))) - (should (< (abs (- (car s) (car ds))) 10)) - (should (< (abs (- (cdr s) (cdr ds))) 10))))) + (let* ((os '(612 . 792)) + (s (pdf-info-pagesize 1)) + (ds (cons (* (- 0.4046 0.1879) (car os)) + (* (- 0.3392 0.2462) (cdr os))))) + (should (< (abs (- (car s) (car ds))) 10)) + (should (< (abs (- (cdr s) (cdr ds))) 10))))) (ert-deftest pdf-virtual-getannots () (with-pdf-virtual-test-buffer - (let ((a (pdf-info-getannots 1))) - (should (= 3 (length a))) - (should (equal (sort (copy-sequence '(highlight underline squiggly)) - 'string<) - (sort (mapcar (lambda (elt) - (cdr (assq 'type elt))) - a) - 'string<)))))) + (let ((a (pdf-info-getannots 1))) + (should (= 3 (length a))) + (should (equal (sort (copy-sequence '(highlight underline squiggly)) + 'string<) + (sort (mapcar (lambda (elt) + (cdr (assq 'type elt))) + a) + 'string<)))))) (ert-deftest pdf-virtual-getannot () (with-pdf-virtual-test-buffer - (let* ((a1 (car (pdf-info-getannots 1))) - (a2 (pdf-info-getannot (cdr (assq 'id a1))))) - (should (equal a1 a2))))) + (let* ((a1 (car (pdf-info-getannots 1))) + (a2 (pdf-info-getannot (cdr (assq 'id a1))))) + (should (equal a1 a2))))) (ert-deftest pdf-virtual-addannot () (with-pdf-virtual-test-buffer @@ -175,8 +174,8 @@ (ert-deftest pdf-virtual-delannot () (skip-unless (pdf-info-writable-annotations-p)) (with-pdf-virtual-test-buffer - (should-error (pdf-info-delannot - (cdr (assq 'id (car (pdf-info-getannots 1)))))))) + (should-error (pdf-info-delannot + (cdr (assq 'id (car (pdf-info-getannots 1)))))))) (ert-deftest pdf-virtual-mvannot () (skip-unless (pdf-info-writable-annotations-p)) @@ -203,49 +202,47 @@ (progn (pdf-virtual-global-minor-mode 1) (with-pdf-virtual-test-buffer - (should (stringp (pdf-info-renderpage 1 100 :alpha 0.1))) - (should (stringp (pdf-info-renderpage - 1 100 (current-buffer) :alpha 0.2)))) + (should (stringp (pdf-info-renderpage 1 100 :alpha 0.1))) + (should (stringp (pdf-info-renderpage + 1 100 (current-buffer) :alpha 0.2)))) (pdf-test-with-test-pdf - (should (plist-get (pdf-info-setoptions - :render/printed t) - :render/printed)) - (should-not (plist-get (pdf-info-setoptions - (current-buffer) - :render/printed nil) - :render/printed)) - (should (plist-get (pdf-info-setoptions - (buffer-file-name) - :render/printed t) - :render/printed)))) + (should (plist-get (pdf-info-setoptions + :render/printed t) + :render/printed)) + (should-not (plist-get (pdf-info-setoptions + (current-buffer) + :render/printed nil) + :render/printed)) + (should (plist-get (pdf-info-setoptions + (buffer-file-name) + :render/printed t) + :render/printed)))) (unless enabled-p (pdf-virtual-global-minor-mode -1))))) - ;; (ert-deftest pdf-virtual-getattachment-from-annot () - ;; ) +;; (ert-deftest pdf-virtual-getattachment-from-annot () +;; ) - ;; (ert-deftest pdf-virtual-getattachments () - ;; ) +;; (ert-deftest pdf-virtual-getattachments () +;; ) - ;; (ert-deftest pdf-virtual-synctex-forward-search () - ;; ) +;; (ert-deftest pdf-virtual-synctex-forward-search () +;; ) - ;; (ert-deftest pdf-virtual-synctex-backward-search () - ;; ) +;; (ert-deftest pdf-virtual-synctex-backward-search () +;; ) - ;; (ert-deftest pdf-virtual-renderpage () - ;; ) +;; (ert-deftest pdf-virtual-renderpage () +;; ) - ;; (ert-deftest pdf-virtual-boundingbox () - ;; ) +;; (ert-deftest pdf-virtual-boundingbox () +;; ) - ;; (ert-deftest pdf-virtual-pagelabels () - ;; ) +;; (ert-deftest pdf-virtual-pagelabels () +;; ) - ;; (ert-deftest pdf-virtual-setoptions () - ;; ) +;; (ert-deftest pdf-virtual-setoptions () +;; ) - ;; (ert-deftest pdf-virtual-getoptions () - ;; ) - - ) +;; (ert-deftest pdf-virtual-getoptions () +;; ) -- cgit v1.0 From 5563ac911466ee8948b76241d22c5c0e384b9ab4 Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Fri, 7 Oct 2022 19:42:04 +0530 Subject: Remove bugfix for imenu in Emacs 24.3 and below This is no longer necessary, since we are dropping support for Emacs 24.3 Relates to: #26 --- lisp/pdf-outline.el | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/lisp/pdf-outline.el b/lisp/pdf-outline.el index a9212b7..fc75b02 100644 --- a/lisp/pdf-outline.el +++ b/lisp/pdf-outline.el @@ -572,23 +572,6 @@ not call `imenu-sort-function'." (cons title (nconc (nreverse keep-at-top) menulist)))) -;; bugfix for imenu in Emacs 24.3 and below. -(when (condition-case nil - (progn (imenu--truncate-items '(("" 0))) nil) - (error t)) - (eval-after-load "imenu" - '(defun imenu--truncate-items (menulist) - "Truncate all strings in MENULIST to `imenu-max-item-length'." - (mapc (lambda (item) - ;; Truncate if necessary. - (when (and (numberp imenu-max-item-length) - (> (length (car item)) imenu-max-item-length)) - (setcar item (substring (car item) 0 imenu-max-item-length))) - (when (imenu--subalist-p item) - (imenu--truncate-items (cdr item)))) - menulist)))) - - (provide 'pdf-outline) -- cgit v1.0 From ce5ed3412d016641e1bfce72a1304fd2c303fc1d Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Fri, 7 Oct 2022 19:51:29 +0530 Subject: Remove macro / function re-definitions Rely on the functions that come built into Emacs. Relates to: #26 --- lisp/pdf-util.el | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/lisp/pdf-util.el b/lisp/pdf-util.el index cfc77d3..ebf7ccf 100644 --- a/lisp/pdf-util.el +++ b/lisp/pdf-util.el @@ -43,37 +43,6 @@ ;; * Compatibility with older Emacssen (< 25.1) ;; * ================================================================== * -;; The with-file-modes macro is only available in recent Emacs -;; versions. -(eval-when-compile - (unless (fboundp 'with-file-modes) - (defmacro with-file-modes (modes &rest body) - "Execute BODY with default file permissions temporarily set to MODES. -MODES is as for `set-default-file-modes'." - (declare (indent 1) (debug t)) - (let ((umask (make-symbol "umask"))) - `(let ((,umask (default-file-modes))) - (unwind-protect - (progn - (set-default-file-modes ,modes) - ,@body) - (set-default-file-modes ,umask))))))) - -(unless (fboundp 'alist-get) ;;25.1 - (defun alist-get (key alist &optional default remove) - "Get the value associated to KEY in ALIST. -DEFAULT is the value to return if KEY is not found in ALIST. -REMOVE, if non-nil, means that when setting this element, we should -remove the entry if the new value is `eql' to DEFAULT." - (ignore remove) ;;Silence byte-compiler. - (let ((x (assq key alist))) - (if x (cdr x) default)))) - -(require 'register) -(unless (fboundp 'register-read-with-preview) - (defalias 'register-read-with-preview #'read-char - "Compatibility alias for pdf-tools.")) - ;; 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." -- cgit v1.0 From 3af61419267d8abc63d86ce7260d0b1e0710a222 Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Fri, 7 Oct 2022 19:52:49 +0530 Subject: Remove pdf-util-window-pixel-width, fallback to window-body-width `window-body-width` is available for us to use in Emacs 26.3 Relates to: #26 --- lisp/pdf-util.el | 10 ---------- lisp/pdf-view.el | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/lisp/pdf-util.el b/lisp/pdf-util.el index ebf7ccf..cbfff98 100644 --- a/lisp/pdf-util.el +++ b/lisp/pdf-util.el @@ -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) diff --git a/lisp/pdf-view.el b/lisp/pdf-view.el index 0820e8f..21824ad 100644 --- a/lisp/pdf-view.el +++ b/lisp/pdf-view.el @@ -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)) -- cgit v1.0 From 05c42596a21fc668eac3b8df4cf6ae2d93bf097c Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Fri, 7 Oct 2022 20:20:50 +0530 Subject: Remove compatibility function for image-mode-winprops Relates to: #26 --- lisp/pdf-util.el | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/lisp/pdf-util.el b/lisp/pdf-util.el index cbfff98..e17800c 100644 --- a/lisp/pdf-util.el +++ b/lisp/pdf-util.el @@ -40,53 +40,6 @@ ;; * ================================================================== * -;; * 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 ;; * ================================================================== * -- cgit v1.0 From 321e19ed597483ec4b5bebc2de160ba3803f1a8b Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Sat, 8 Oct 2022 11:41:27 +0530 Subject: Remove Emacs 24.4 guards for cua-mode Relates to: #26 --- lisp/pdf-info.el | 4 +++- lisp/pdf-view.el | 27 +++++++++------------------ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/lisp/pdf-info.el b/lisp/pdf-info.el index 408dd3f..40dfc3d 100644 --- a/lisp/pdf-info.el +++ b/lisp/pdf-info.el @@ -305,7 +305,9 @@ error." (setq pdf-info--queue (tq-create proc)))) pdf-info--queue) -(when (< emacs-major-version 27) (advice-add 'tq-process-buffer :around #'pdf-info--tq-workaround)) +(when (< emacs-major-version 27) + (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. diff --git a/lisp/pdf-view.el b/lisp/pdf-view.el index 21824ad..981aa1b 100644 --- a/lisp/pdf-view.el +++ b/lisp/pdf-view.el @@ -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." -- cgit v1.0 From 1f91ba8894e3820faa82e5cc95a0de163c461cb0 Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Wed, 12 Oct 2022 20:47:13 +0530 Subject: Render crisp images for HiDPI screens by default Copying from the README: > `pdf-tools` version `1.1.0` release changed the default value of > `pdf-view-use-scaling` to `t` (previously, it was `nil`). This has > been done keeping in mind that most modern monitors are HiDPI > screens, so the default configuration should cater to this user. If > you are not using a HiDPI screen, you might have to change this > value to `nil` in your configuration. Closes: #133 --- NEWS | 20 ++++++++++++++++++-- README.org | 8 ++++---- lisp/pdf-cache.el | 6 +++--- lisp/pdf-util.el | 24 ++++++++++++++++-------- lisp/pdf-view.el | 8 ++++---- 5 files changed, 45 insertions(+), 21 deletions(-) diff --git a/NEWS b/NEWS index 00d2d5c..1ff8c77 100644 --- a/NEWS +++ b/NEWS @@ -2,8 +2,24 @@ * Version 1.0.0 (Under Development) From this version onward, we will follow Semantic Versioning for new ~pdf-tools~ releases. -** Raise the minimum supported version of Emacs to 26.1 -Drop support for Emacs 24 and 25. This allows for some code cleanup. + +** Breaking changes: +*** Raise the minimum supported version of Emacs to 26.3 #26 +Drop support for Emacs 24 and 25. This allows for some code cleanup. *This is a major breaking change*. +*** Change the default value of pdf-view-use-scaling #133 +~pdf-view-use-scaling~ is now true by default, leading to rendering of crisp images on high-resolution screens. This should not cause problems on low-resolution screen (other than taking up more cache space / increasing rendering time), but if it does, please ~(setq pdf-view-use-scaling nil)~ in your configuration. + +** Improve overall user experience +- Set ~pdf-annot-list-highlight-type~ to true by default. + + Show annotation color when listing them by default, allow the user to turn them off if need be. + +** Make changes required by newer versions of Emacs +- Emacs 29 introduces ~pixel-scroll-precision-mode~, which interferes with ~pdf-view~ scrolling. This is fixed in #124 + +** Functionality fixes and improvements +- Fix ~revert-buffer~ to correctly work over Tramp #128 +- Fix sorting by date in ~pdf-annot-list-mode~ #75 + * Version 0.91 ** Change the keybindings for traversing history This is a minor but *breaking change*. ~l~ (backward) and ~r~ (forward) are the conventional bindings for history navigation in Emacs, but ~pdf-tools~ uses ~B~ and ~N~. The previous keybindings are kept as-is for people who were used to it, while introducing ~l~ and ~r~ keybindings as well. diff --git a/README.org b/README.org index 67d443c..57409fb 100644 --- a/README.org +++ b/README.org @@ -521,7 +521,7 @@ L/R scrolling breaks while zoomed into a pdf, with usage of sublimity smooth scr :ID: C3A4A7C0-6BBB-4923-AD39-3707C8482A76 :END: -In such PDFs the selected text becomes hidden behind the selection; see [[https://github.com/vedang/pdf-tools/issues/149][this issue]], which also describes the workaround in detail. The following function, which depends on the [[https://github.com/orgtre/qpdf.el][qpdf.el]] package, can be used to convert such a PDF file into one where text selection is transparent: +In such PDFs the selected text becomes hidden behind the selection; see [[https://github.com/vedang/pdf-tools/issues/149][this issue]], which also describes the workaround in detail. The following function, which depends on the [[https://github.com/orgtre/qpdf.el][qpdf.el]] package, can be used to convert such a PDF file into one where text selection is transparent: #+begin_src elisp (defun my-fix-pdf-selection () "Replace pdf with one where selection shows transparently." @@ -605,15 +605,15 @@ To see the list of operating systems where compilation testing is supported, run :CREATED: [2021-12-30 Thu 22:04] :ID: 3be6abe7-163e-4c3e-a7df-28e8470fe37f :END: -** I'm on a Macbook and PDFs are rendering blurry +** PDFs are not rendering well! :PROPERTIES: :CREATED: [2021-12-30 Thu 22:04] :ID: 20ef86be-7c92-4cda-97ec-70a22484e689 :END: -If you are on a Macbook with a Retina display, you may see PDFs as blurry due to the high resolution display. Use: +~pdf-tools~ version ~1.1.0~ release changed the default value of ~pdf-view-use-scaling~ to ~t~ (previously, it was ~nil~). This has been done keeping in mind that most modern monitors are HiDPI screens, so the default configuration should cater to this user. If you are not using a HiDPI screen, you might have to change this value to ~nil~ in your configuration #+begin_src elisp - (setq pdf-view-use-scaling t) + (setq pdf-view-use-scaling nil) #+end_src to scale the images correctly when rendering them. diff --git a/lisp/pdf-cache.el b/lisp/pdf-cache.el index 31073ff..650ff36 100644 --- a/lisp/pdf-cache.el +++ b/lisp/pdf-cache.el @@ -429,9 +429,9 @@ WINDOW and IMAGE-WIDTH decide the page and scale of the final image." (pdf-cache-lookup-image page image-width - (if (not pdf-view-use-scaling) - image-width - (* 2 image-width)))) + (if pdf-view-use-scaling + (* 2 image-width) + image-width))) (setq page (pop pdf-cache--prefetch-pages))) (pdf-util-debug (when (null page) diff --git a/lisp/pdf-util.el b/lisp/pdf-util.el index e17800c..1e3b7be 100644 --- a/lisp/pdf-util.el +++ b/lisp/pdf-util.el @@ -856,14 +856,22 @@ See also `regexp-quote'." (defun pdf-util-frame-ppi () "Return the PPI of the current frame." - (let* ((props (frame-monitor-attributes)) - (px (nthcdr 2 (alist-get 'geometry props))) - (mm (alist-get 'mm-size props)) - (dp (sqrt (+ (expt (nth 0 px) 2) - (expt (nth 1 px) 2)))) - (di (sqrt (+ (expt (/ (nth 0 mm) 25.4) 2) - (expt (/ (nth 1 mm) 25.4) 2))))) - (/ dp di))) + (condition-case nil + (let* ((props (frame-monitor-attributes)) + (px (nthcdr 2 (alist-get 'geometry props))) + (mm (alist-get 'mm-size props)) + (dp (sqrt (+ (expt (nth 0 px) 2) + (expt (nth 1 px) 2)))) + (di (sqrt (+ (expt (/ (nth 0 mm) 25.4) 2) + (expt (/ (nth 1 mm) 25.4) 2))))) + (/ dp di)) + ;; Calculating frame-ppi failed, return 0 to indicate unknown. + ;; This can happen when (frame-monitor-attributes) does not have + ;; the right properties (Emacs 26, 27). It leads to the + ;; wrong-type-argument error, which is the only one we are + ;; catching here. We will catch more errors only if we see them + ;; happening. + (wrong-type-argument 0))) (defvar pdf-view-use-scaling) diff --git a/lisp/pdf-view.el b/lisp/pdf-view.el index 981aa1b..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 @@ -955,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 -- cgit v1.0 From 19801defb89ba6208afe96dbbb44ba84fb579f23 Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Wed, 12 Oct 2022 21:30:30 +0530 Subject: Add support for Alpine Linux to autobuild This ensures that all operating systems currently mentioned in the README are covered in the autobuild script Relates to: #160 --- server/autobuild | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/server/autobuild b/server/autobuild index d9f7975..de42806 100755 --- a/server/autobuild +++ b/server/autobuild @@ -455,6 +455,28 @@ os_opensuse() { return 0 } +# Alpine Linux +os_alpine() { + if [ -f "/etc/os-release" ]; then + . /etc/os-release + if [ "$ID" != "alpine" ]; then + return 1 + fi + else + return 1 + fi + PACKAGES="autoconf + automake + libpng-dev + poppler-dev + glib-dev + gcc + build-base" + PKGCMD=apk + PKGARGS="add" + return 0 +} + # By Parameter --os os_argument() { [ -z "$OS" ] && return 1 @@ -471,6 +493,7 @@ os_argument() { nixos) os_nixos "$@";; void) os_void "$@";; opensuse) os_opensuse "$@";; + alpine) os_alpine "$@";; *) echo "Invalid --os argument: $OS" exit 1 esac || { @@ -480,7 +503,8 @@ os_argument() { } ## +-----------------------------------------------------------+ -## * Figure out were we are, install deps and build the program +## * Figure out where we are +## ** install deps and build the program ## +-----------------------------------------------------------+ handle_options "$@" @@ -498,6 +522,7 @@ os_msys2 "$@" || \ os_nixos "$@" || \ os_void "$@" || \ os_opensuse "$@" || \ +os_alpine "$@" || \ { OS_IS_HANDLED= if [ -z "$DRY_RUN" ]; then -- cgit v1.0 From bc7c159c483da6047630d445cb6e1ae45384f9a0 Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Wed, 12 Oct 2022 21:31:59 +0530 Subject: Make sure pkg-config is correctly set in autobuild Also, simplify the config script for finding gnu-sed. Relates to: #160 --- .circleci/config.yml | 2 +- server/autobuild | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 636546d..a8005ee 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -95,7 +95,7 @@ jobs: - run: name: Add Cask and Gnu-SED to the Path command: | - echo 'export PATH="$HOME"/.cask/bin:"$(brew --prefix)"/opt/gnu-sed/libexec/gnubin:"$PATH"' >> "$BASH_ENV" + echo 'export PATH="$HOME"/.cask/bin:"$(brew --prefix gnu-sed)"/libexec/gnubin:"$PATH"' >> "$BASH_ENV" - install-pdf-tools-server workflows: diff --git a/server/autobuild b/server/autobuild index de42806..4b33bfd 100755 --- a/server/autobuild +++ b/server/autobuild @@ -353,7 +353,7 @@ os_macos() { PKG_INSTALL_AS_ROOT= # brew installs libffi as keg-only, meaning we need to set # PKG_CONFIG_PATH manually so configure can find it - export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:$(brew --prefix libffi)/lib/pkgconfig/" + export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:$(brew --prefix libffi)/lib/pkgconfig/:$(brew --prefix zlib)/lib/pkgconfig/" elif which port >/dev/null 2>&1; then PKGCMD=port PKGARGS=install -- cgit v1.0 From e10d9cedad5007e9435788b31aec6eb4b5ce964f Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Wed, 12 Oct 2022 21:37:06 +0530 Subject: Update and cleanup the Install section Simplify the instructions and ask users to use `make` where possible! Closes: #160 --- README.org | 394 +++++++++++++++++++++++-------------------------------------- 1 file changed, 145 insertions(+), 249 deletions(-) diff --git a/README.org b/README.org index 57409fb..103dd6c 100644 --- a/README.org +++ b/README.org @@ -11,281 +11,172 @@ The ~pdf-tools~ Wiki is maintained at https://pdftools.wiki. Head to the site if you find it easier to navigate a website for reading a manual. All the topics on the site are listed at https://pdftools.wiki/impulse. +* Table of Contents :noexport:TOC_3_org: +- [[About PDF Tools][About PDF Tools]] +- [[Installing pdf-tools][Installing pdf-tools]] + - [[Installing the epdfinfo server][Installing the epdfinfo server]] + - [[Installing the epdfinfo server from package managers][Installing the epdfinfo server from package managers]] + - [[Installing the epdfinfo server from source on Windows (+ Gotchas)][Installing the epdfinfo server from source on Windows (+ Gotchas)]] + - [[Installing the epdfinfo server from source on macOS (+ Gotchas)][Installing the epdfinfo server from source on macOS (+ Gotchas)]] + - [[Common installation gotchas][Common installation gotchas]] + - [[Installing optional features][Installing optional features]] + - [[Installing pdf-tools elisp code][Installing pdf-tools elisp code]] + - [[Updating pdf-tools][Updating pdf-tools]] +- [[Features][Features]] + - [[View and Navigate PDFs][View and Navigate PDFs]] + - [[Keybindings for navigating PDF documents][Keybindings for navigating PDF documents]] + - [[Keybindings for manipulating display of PDF][Keybindings for manipulating display of PDF]] + - [[Annotations][Annotations]] + - [[Keybindings for working with Annotations][Keybindings for working with Annotations]] + - [[Working with AUCTeX][Working with AUCTeX]] + - [[Keybindings for working with AUCTeX][Keybindings for working with AUCTeX]] + - [[Miscellaneous features][Miscellaneous features]] + - [[Keybindings for miscellaneous features in PDF tools][Keybindings for miscellaneous features in PDF tools]] + - [[Easy Help for PDF Tools features][Easy Help for PDF Tools features]] + - [[Configuring PDF Tools features][Configuring PDF Tools features]] +- [[Known problems][Known problems]] + - [[linum-mode][linum-mode]] + - [[display-line-numbers-mode][display-line-numbers-mode]] + - [[auto-revert][auto-revert]] + - [[sublimity][sublimity]] + - [[Text selection is not transparent in PDFs OCRed with Tesseract][Text selection is not transparent in PDFs OCRed with Tesseract]] +- [[Key-bindings in PDF Tools][Key-bindings in PDF Tools]] +- [[Tips and Tricks for Developers][Tips and Tricks for Developers]] + - [[Turn on debug mode][Turn on debug mode]] + - [[Run Emacs lisp tests locally][Run Emacs lisp tests locally]] + - [[Run server compilation tests locally][Run server compilation tests locally]] + - [[Add a Dockerfile to automate server compilation testing][Add a Dockerfile to automate server compilation testing]] +- [[FAQs][FAQs]] + - [[PDFs are not rendering well!][PDFs are not rendering well!]] + - [[What Emacs versions does pdf-tools support?][What Emacs versions does pdf-tools support?]] + - [[I want to add support for pdf-tools on "My Fav OS". How do I do that?][I want to add support for pdf-tools on "My Fav OS". How do I do that?]] + - [[I am on a Macbook M1 and pdf-tools installation fails with a stack-trace][I am on a Macbook M1 and pdf-tools installation fails with a stack-trace]] + - [[I am a developer, making changes to the pdf-tools source code][I am a developer, making changes to the pdf-tools source code]] + * About PDF Tools :PROPERTIES: :CREATED: [2021-12-29 Wed 18:34] :ID: 5a884389-6aec-498a-90d5-f37168809b4f :EXPORT_FILE_NAME: index :END: -PDF Tools is, among other things, a replacement of DocView for PDF files. The key difference is that pages are not pre-rendered by e.g. ghostscript and stored in the file-system, but rather created on-demand and stored in memory. +PDF Tools is, among other things, a replacement of DocView for PDF files. The key difference is that pages are not pre-rendered by, say, ~ghostscript~ and stored in the file-system, but rather created on-demand and stored in memory. This rendering is performed by a special library named, for whatever reason, ~poppler~, running inside a server program. This program is called ~epdfinfo~ and its job is to successively read requests from Emacs and produce the proper results, i.e. the PNG image of a PDF page. Actually, displaying PDF files is just one part of ~pdf-tools~. Since ~poppler~ can provide us with all kinds of information about a document and is also able to modify it, there is a lot more we can do with it. [[https://www.dailymotion.com/video/x2bc1is][Watch this video for a detailed demo!]] -* Installing ~pdf-tools~ +* Installing pdf-tools :PROPERTIES: :CREATED: [2021-12-29 Wed 18:34] :ID: 6ceea50c-cbaa-4d8a-b450-8067c5e8c9da :NEURON_DIRTREE_DISPLAY: false :END: -Installing this package via NonGNU ELPA or MELPA or any of the other package managers is straightforward and should just work. -~pdf-tools~ requires a server ~epdfinfo~ to run against, which it will try to compile and build when it is activated for the first time. +Installing this package via NonGNU ELPA or MELPA or any of the other package managers is straightforward and should just work! You should not require any manual changes. The documentation below is *only if you are installing from source*, or for troubleshooting / debugging purposes. -You should not require any manual changes. The documentation below is *only if you are installing from source*, or for troubleshooting / debugging purposes. The following steps need to be followed *in this order*, to install ~pdf-tools~ and ~epdfinfo~ correctly: +~pdf-tools~ requires a server ~epdfinfo~ to run against, which it will try to compile and build when it is activated for the first time. The following steps need to be followed *in this order*, to install ~pdf-tools~ and ~epdfinfo~ correctly: -- [[brain-child:8ce3cf4e-d186-4de1-a40e-f41063068ab0][Installing ~epdfinfo~ server prerequisites]] -- [[brain-child:e305cd0a-e798-4c2b-af27-21bcd936c1c9][Installing the ~epdfinfo~ server]] -- [[brain-child:3d4e6b6b-f015-475d-8ea2-84988efd6c22][Installing ~pdf-tools~ elisp prerequisites]] -- [[brain-child:32c4fc3b-b4ea-43bd-b92c-bdf2d3831fcf][Installing ~pdf-tools~ elisp code]] +- [[brain-child:e305cd0a-e798-4c2b-af27-21bcd936c1c9][Installing the epdfinfo server]] +- [[brain-child:32c4fc3b-b4ea-43bd-b92c-bdf2d3831fcf][Installing pdf-tools elisp code]] -** Installing ~epdfinfo~ server prerequisites +** Installing the epdfinfo server :PROPERTIES: :CREATED: [2021-12-29 Wed 18:34] -:ID: 8ce3cf4e-d186-4de1-a40e-f41063068ab0 +:ID: e305cd0a-e798-4c2b-af27-21bcd936c1c9 :END: -If you install ~pdf-tools~ via NonGNU ELPA or MELPA, *you don't need to worry about this separate server installation at all*. However, if you have a non-standard installation, please refer to the links below for installing ~epdfinfo~ server prerequisites. - -Note: You'll need GNU Emacs \ge 26.1 and some form of a GNU/Linux OS. Other operating systems are not officially supported, but ~pdf-tools~ is known to work on many of them. +If you install ~pdf-tools~ via NonGNU ELPA or MELPA, *you don't need to worry about this separate server installation at all*. -Similarly, package-managers are not officially supported, but ~pdf-tools~ is known to be available on some of them. See the section on [[id:fb5cef15-fed4-4dec-a443-52f7c00c7831][Installing the ~epdfinfo~ server from package managers]] to avoid manual installation of server / server prerequisites. - -See the section on [[id:A34704B9-1B51-4614-8806-C4059F7B42D5][I want to add support for ~pdf-tools~ on =My Fav OS=. How do I do that?]] to add your favorite Operating System to this list. +Note: You'll need GNU Emacs \ge 26.3 and some form of a GNU/Linux OS. Other operating systems are not officially supported, but ~pdf-tools~ is known to work on many of them. -*** Installing ~epdfinfo~ Server Prerequisites on a Debian-based system -:PROPERTIES: -:CREATED: [2022-02-13 Sun 23:17] -:ID: abaae1be-3bbb-4d99-90e7-5429c56083e1 -:END: -First make sure a suitable build-system is installed. We need at least a C compiler (~gcc~), ~make~, ~automake~ and ~autoconf~. +The ~epdfinfo~ install script takes care of installing all the necessary pre-requisites on supported operating systems (see list below). See the section on [[id:A34704B9-1B51-4614-8806-C4059F7B42D5][I want to add support for ~pdf-tools~ on =My Fav OS=. How do I do that?]] to learn how to add your favorite Operating System to this list. -Next we need to install a few libraries ~pdf-tools~ depends on, some of which are probably already on your system. +Similarly, package-managers are not officially supported, but ~pdf-tools~ is known to be available on some of them. See the section on [[id:fb5cef15-fed4-4dec-a443-52f7c00c7831][Installing the ~epdfinfo~ server from package managers]] to avoid manual installation of server / server prerequisites. +Installation Instructions for ~epdfinfo~: #+begin_src sh - $ sudo apt install libpng-dev zlib1g-dev libpoppler-glib-dev + $ git clone https://github.com/vedang/pdf-tools + $ cd /path/to/pdf-tools + $ make -s # If you don't have make installed, run ./server/autobuild and it will install make #+end_src -On some older Ubuntu systems, the final command will possibly give an error. This should be no problem, since in some versions this package was contained in the main package ~libpoppler-dev~. Also note, that ~zlib1g-dev~ was for a long time called ~libz-dev~, which it still may be on your system. - -Debian wheezy comes with ~libpoppler~ version ~0.18~, which is pretty old. The minimally required version is ~0.16~, but some features of ~pdf-tools~ depend on a more recent version of this library. See the following table for what they are and what version they require. +This should give you no error and should compile the ~epdfinfo~ server. If you face a problem, please report on the issue tracker! -| You want to ... | Required version | -|-------------------------------------------+------------------| -| ... create and modify text annotations. | \ge 0.19.4 | -| ... search case-sensitive. | \ge 0.22 | -| ... create and modify markup annotations. | \ge 0.26 | -|-------------------------------------------+------------------| +The following Operating Systems / package managers are supported. *Note*: The package manager used to install pre-requisites should be installed on your OS for the script to work: -In case you decide to install ~libpoppler~ from source, make sure to run its configure script with the ~--enable-xpdf-headers~ option. +- Debian-based systems (~debian~, ~ubuntu~): ~apt-get~ +- Fedora: ~dnf~ +- macOS: ~brew~ +- Windows (MSYS2/ MingW): ~pacman~ +- NixOS: ~nix-shell~ +- openSUSE (Tumbleweed and Leap): ~zypper~ +- Void Linux: ~xbps-install~ +- Apline Linux: ~apk~ +- FreeBSD: ~pkg~ +- OpenBSD: ~pkg_add~ +- Arch Linux: ~pacman~ +- Gentoo: ~emerge~ +- CentOS: ~yum~ -Finally there is one feature (following links of a PDF document by plain keystrokes) which requires imagemagick's convert utility. This requirement is optional and you may install it like so: -#+begin_src sh - $ sudo apt install imagemagick -#+end_src -*** Installing ~epdfinfo~ Server Prerequisites On macOS +*** Installing the epdfinfo server from package managers :PROPERTIES: -:CREATED: [2021-12-29 Wed 18:34] -:ID: f10e9d94-bdec-44dc-8d3c-1816d62ef1c4 +:CREATED: [2022-02-13 Sun 23:10] +:ID: fb5cef15-fed4-4dec-a443-52f7c00c7831 :END: -Although macOS is not officially supported, it has been reported that ~pdf-tools~ works well on macOS. You will need to install ~poppler~ which you can get with Homebrew via -#+BEGIN_SRC sh - $ brew install poppler automake -#+END_SRC +~pdf-tools~ can be directly installed from the package manager on some operating systems. Note that the packages available on these package managers are not maintained by the author and might be outdated. -You will also have to help ~pkg-config~ find some libraries by setting ~PKG_CONFIG_PATH~. ~brew~ will show you which paths need to be added to ~PKG_CONFIG_PATH~ during the installation process. Make sure you export the paths to the env variable, eg: -#+BEGIN_SRC sh - $ export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:$(brew --prefix libffi)/lib/pkgconfig/:/usr/local/Cellar/zlib/1.2.8/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig" -#+END_SRC -or likewise within Emacs using ~setenv~. +- Debian: https://packages.debian.org/buster/elpa-pdf-tools-server +- Ubuntu: https://packages.ubuntu.com/impish/elpa-pdf-tools-server +- MSYS2 / MINGW (Windows): https://packages.msys2.org/package/mingw-w64-x86_64-emacs-pdf-tools-server?repo=mingw64 +- FreeBSD: https://repology.org/metapackages/?search=pdf-tools&inrepo=freebsd -After that, compilation should proceed as normal. -*** Installing ~epdfinfo~ Server Prerequisites On FreeBSD +*** Installing the epdfinfo server from source on Windows (+ Gotchas) :PROPERTIES: :CREATED: [2021-12-29 Wed 18:34] -:ID: 00faf3e3-6d09-4cf7-9373-838f3d231504 +:ID: d14e01ff-9bd5-47ee-86fc-859b4499d5d7 :END: -Although not officially supported, it has been reported that ~pdf-tools~ work well on FreeBSD. Instead of building ~pdf-tools~, you can install one of the OS packages with e.g. -#+BEGIN_SRC sh - $ pkg install pdf-tools-emacs26 -#+END_SRC - -To see the current list of ~pdf-tools~ packages for FreeBSD visit [[https://repology.org/metapackages/?search=pdf-tools&inrepo=freebsd][the Repology list]]. +If using the GNU binaries for Windows, support for PNG and ~zlib~ must first be installed by copying the appropriate dlls into emacs' ~bin/~ directory. Most third-party binaries come with this already done. -To build ~pdf-tools~ from either MELPA or directly from the source repository, install the dependencies with -#+BEGIN_SRC sh - $ pkg install autotools gmake poppler-glib -#+END_SRC +1. [[https://www.msys2.org/][install MSYS2]] and update the package database and core packages using the instructions provided. +2. Open ~mingw64~ shell (*Note:* You must use ~mingw64.exe~ and not ~msys2.exe~) +3. Compile the ~epdfinfo~ server using Installation steps described in [[id:e305cd0a-e798-4c2b-af27-21bcd936c1c9][Installing the ~epdfinfo~ server]] +4. This should produce a file ~server/epdfinfo.exe~. Copy this file into the ~pdf-tools/~ installation directory in your Emacs. +5. Make sure Emacs can find ~epdfinfo.exe~. Either add the MINGW install location (e.g. ~C:/msys2/mingw64/bin~) to the system path with ~setx PATH "C:\msys2\mingw64\bin;%PATH%"~ or set Emacs's path with ~(setenv "PATH" (concat "C:\\msys64\\mingw64\\bin;" (getenv "PATH")))~. Note that libraries from other GNU utilities, such as Git for Windows, may interfere with those needed by ~pdf-tools~. ~pdf-info-check-epdinfo~ will succeed, but errors occur when trying to view a PDF file. This can be fixed by ensuring that the MSYS libraries are always preferred. +6. ~pdf-tools~ will successfully compile using Cygwin, but it will not be able to open PDFs properly due to the way binaries compiled with Cygwin handle file paths. Please use MSYS2. -If you choose not to install from MELPA, you must substitute ~gmake~ for ~make~ in the instructions below. -*** Installing ~epdfinfo~ Server Prerequisites On CentOS +*** Installing the epdfinfo server from source on macOS (+ Gotchas) :PROPERTIES: -:CREATED: [2021-12-29 Wed 18:34] -:ID: e39946d0-3a28-405d-bb23-337120412dac +:CREATED: [2022-10-11 Tue 11:42] +:ID: 60CBCD65-5654-400A-913F-8B31901D071C :END: -#+BEGIN_SRC sh - $ yum install poppler-devel poppler-glib-devel -#+END_SRC +On macOS, ~autobuild~ adjusts ~PKG_CONFIG_PATH~ so that ~pdf-tools~ can find some of the keg-only packages installed by ~brew~. It is recommended that you review the output logs printed by ~brew~ during the installation process to also export the relevant paths to the appropriate ENV variables. -*** Installing ~epdfinfo~ Server Prerequisites On Fedora +*** Common installation gotchas :PROPERTIES: -:CREATED: [2021-12-29 Wed 18:34] -:ID: d0013822-f4d0-4354-b3db-c54ffe41ce58 +:CREATED: [2022-10-11 Tue 11:04] +:ID: 3F4C0FDF-6AC0-4845-BA2D-ED7C2F40D894 :END: -#+BEGIN_SRC sh - $ sudo dnf install make automake autoconf gcc libpng-devel zlib-devel poppler-glib-devel -#+END_SRC +In case you decide to install ~libpoppler~ from source, make sure to run its configure script with the ~--enable-xpdf-headers~ option. -There is one feature (following links of a PDF document by plain keystrokes) which requires imagemagick's convert utility. This requirement is optional and you may install it like so: -#+begin_src sh - $ sudo dnf install imagemagick -#+end_src -*** Installing ~epdfinfo~ Server Prerequisites On openSUSE +*** Installing optional features :PROPERTIES: -:ID: 07033620-fee5-4b52-a99d-e62e4b758ccc -:CREATED: [2022-04-25 Mon 21:09] +:CREATED: [2022-10-11 Tue 11:15] +:ID: 97FC4447-B567-457F-A498-7CCA74DD5657 :END: -For openSUSE Tumbleweed and Leap: -#+BEGIN_SRC sh - $ sudo zypper install make automake autoconf gcc libpng16-devel libpng16-compat-devel zlib-devel libpoppler-devel libpoppler-glib-devel glib2-devel -#+END_SRC - -For openSUSE MicroOS Desktop: -#+BEGIN_SRC sh - $ pkcon install make automake autoconf gcc libpng16-devel libpng16-compat-devel zlib-devel libpoppler-devel libpoppler-glib-devel glib2-devel -#+END_SRC - -There is one feature (following links of a PDF document by plain keystrokes) which requires imagemagick's convert utility. This requirement is optional and you may install the imagemagick package via the package manager of your choice. -*** Installing ~epdfinfo~ Server Prerequisites On Alpine Linux +One feature -- following links of a PDF document by plain keystrokes -- requires ~imagemagick~'s convert utility. This requirement is optional, the installation process will detect if you have ~imagemagick~ installed or not. +** Installing pdf-tools elisp code :PROPERTIES: :CREATED: [2021-12-29 Wed 18:34] -:ID: 443d9b18-096e-4770-b59c-4e472a5d4b0e +:ID: 32c4fc3b-b4ea-43bd-b92c-bdf2d3831fcf :END: +~pdf-tools~ requires ~tablist~ package (>= version 0.70) to be installed, for it to work correctly. Please make sure that the latest version of ~tablist~ is installed. + +We have already run the steps necessary to install ~pdf-tools~ as part of [[id:e305cd0a-e798-4c2b-af27-21bcd936c1c9][the server installation]]! These are: #+BEGIN_SRC sh - $ apk add build-base gcc automake autoconf libpng-dev glib-dev poppler-dev + $ git clone https://github.com/vedang/pdf-tools + $ cd /path/to/pdf-tools + $ make -s #+END_SRC -*** Installing ~epdfinfo~ Server Prerequisites On Windows -:PROPERTIES: -:CREATED: [2021-12-29 Wed 18:34] -:ID: 005243cb-1557-4f94-a73d-e647e0d4b53d -:END: -~pdf-tools~ can be built and used on Windows using the MSYS2 compiler, or pre-built binaries can be installed in MSYS2. - -The pre-built binaries will work with native (not Cygwin) Windows builds of Emacs. They include the standard binaries provided by the GNU project, those available as MSYS2 packages and numerous third-party binaries. Refer to the appropriate section under [[id:e305cd0a-e798-4c2b-af27-21bcd936c1c9][Installing the ~epdfinfo~ server]] for more details. - -~pdf-tools~ will successfully compile using Cygwin, but it will not be able to open PDFs properly due to the way binaries compiled with Cygwin handle file paths. - -** Installing the ~epdfinfo~ server -:PROPERTIES: -:CREATED: [2021-12-29 Wed 18:34] -:ID: e305cd0a-e798-4c2b-af27-21bcd936c1c9 -:END: -If you install ~pdf-tools~ via NonGNU ELPA or MELPA, you don't need to worry about this separate server installation at all. However, if you have a non-standard installation, please refer to the links below for installing ~epdfinfo~. -*** Compiling and Installing the ~epdfinfo~ server from source on Linux -:PROPERTIES: -:CREATED: [2022-02-13 Sun 23:11] -:ID: bd7fd084-8fdf-4698-b40a-da75920d17ed -:END: -Note that this is the only officially supported method for installing the ~epdfinfo~ binary. Instructions: - -#+begin_src sh - $ cd /path/to/pdf-tools - $ make -s -#+end_src - -This should compile the source code and create a Emacs Lisp Package in the root directory of the project. The configure script also tells you at the very end, which features, depending on the ~libpoppler~ version, will be available. These commands should give no error, otherwise you are in trouble. -*** Compiling and Installing the ~epdfinfo~ server from source on Windows -:PROPERTIES: -:CREATED: [2021-12-29 Wed 18:34] -:ID: d14e01ff-9bd5-47ee-86fc-859b4499d5d7 -:END: - -If using the GNU binaries for Windows, support for PNG and ~zlib~ must first be installed by copying the appropriate dlls into emacs' ~bin/~ directory. Most third-party binaries come with this already done. - -First, [[https://www.msys2.org/][install MSYS2]] and update the package database and core packages using the instructions provided. Then, to compile ~pdf-tools~ itself: - -1. Open msys2 shell -2. Update and install dependencies, skipping any you already have - #+BEGIN_SRC sh - $ pacman -Syu - $ pacman -S base-devel - $ pacman -S mingw-w64-x86_64-toolchain - $ pacman -S mingw-w64-x86_64-zlib - $ pacman -S mingw-w64-x86_64-libpng - $ pacman -S mingw-w64-x86_64-poppler - $ pacman -S mingw-w64-x86_64-imagemagick - #+END_SRC -3. Install ~pdf-tools~ in Emacs, but do not try to compile the server. Instead, get a separate copy of the source somewhere else. - #+BEGIN_SRC sh - $ git clone https://github.com/vedang/pdf-tools - #+END_SRC -4. Open ~mingw64~ shell (*Note:* You must use ~mingw64.exe~ and not ~msys2.exe~) -5. Compile pdf-tools - #+BEGIN_SRC sh - $ cd /path/to/pdf-tools - $ make -s - #+END_SRC -6. This should produce a file ~server/epdfinfo.exe~. Copy this file into the ~pdf-tools/~ installation directory in your Emacs. -7. Start Emacs and activate the package. - #+BEGIN_SRC - M-x pdf-tools-install RET - #+END_SRC -8. Test. - #+BEGIN_SRC - M-x pdf-info-check-epdfinfo RET - #+END_SRC - -If this is successful, ~(pdf-tools-install)~ can be added to Emacs' config. See the note on how to set up PATH in the previous section. - -*** Installing the ~epdfinfo~ server from package managers -:PROPERTIES: -:CREATED: [2022-02-13 Sun 23:10] -:ID: fb5cef15-fed4-4dec-a443-52f7c00c7831 -:END: -Note that the packages available on these package managers are not maintained by the author and might be outdated. -**** Using the pre-built MINGW packages from MSYS2 on Windows -:PROPERTIES: -:CREATED: [2022-02-13 Sun 22:55] -:ID: 1fc6e25b-ae09-45d7-8288-c57c7065326c -:END: -Package maintained at: https://packages.msys2.org/package/mingw-w64-x86_64-emacs-pdf-tools-server?repo=mingw64 - -Users installing Emacs from the MSYS2 distribution can install pre-built binaries of the ~epdfinfo~ server. - -1. [[https://www.msys2.org/][Install MSYS2]] and update the package database and core packages using the instructions provided. -2. Install packages: ~pacman -Ss mingw-w64-x86_64-{emacs,emacs-pdf-tools-server,imagemagick}~ (ImageMagick is optional, see above.) -3. Make sure Emacs can find ~epdfinfo.exe~. Either add the MINGW install location (e.g. ~C:/msys2/mingw64/bin~) to the system path with ~setx PATH "C:\msys2\mingw64\bin;%PATH%"~ or set Emacs's path with ~(setenv "PATH" (concat "C:\\msys64\\mingw64\\bin;" (getenv "PATH")))~. Note that libraries from other GNU utilities, such as Git for Windows, may interfere with those needed by ~pdf-tools~. ~pdf-info-check-epdinfo~ will succeed, but errors occur when trying to view a PDF file. This can be fixed by ensuring that the MSYS libraries are always preferred. -4. Add ~(pdf-tools-install)~ to your Emacs config. - -**** Using the pre-built packages from Debian -:PROPERTIES: -:CREATED: [2022-02-13 Sun 23:30] -:ID: 416af9e8-b437-4f6e-ac21-15b79822780e -:END: -Package maintained at: https://packages.debian.org/buster/elpa-pdf-tools-server -**** Using the pre-built packages from Ubuntu -:PROPERTIES: -:CREATED: [2022-02-13 Sun 23:31] -:ID: b2c49338-845f-421a-93f3-a3da5efcc4ac -:END: -Package maintained at: https://packages.ubuntu.com/impish/elpa-pdf-tools-server -** Installing ~pdf-tools~ elisp prerequisites -:PROPERTIES: -:CREATED: [2021-12-29 Wed 18:34] -:ID: 3d4e6b6b-f015-475d-8ea2-84988efd6c22 -:END: -This package depends on the following Elisp packages, which should be installed before installing the ~pdf-tools~ package. -| Package | Required version | -|-----------+----------------------------------| -| [[http://melpa.org/#/tablist][tablist]] | >= 0.70 | -|-----------+----------------------------------| - -** Installing ~pdf-tools~ elisp code -:PROPERTIES: -:CREATED: [2021-12-29 Wed 18:34] -:ID: 32c4fc3b-b4ea-43bd-b92c-bdf2d3831fcf -:END: -If ~make~ produced the ELP file ~pdf-tools-${VERSION}.tar~ you are fine. This package contains all the necessary files for Emacs and may be installed by either using +If the ~make~ command produced the ELP file ~pdf-tools-${VERSION}.tar~ you are fine! This package contains all the necessary files for Emacs and may be installed by either using #+begin_src sh $ make install-package #+end_src @@ -294,6 +185,11 @@ or executing the Emacs command M-x package-install-file RET pdf-tools-${VERSION}.tar RET #+end_src +You can test if the package has been installed correctly, by running +#+begin_src elisp + M-x pdf-info-check-epdfinfo RET +#+end_src + To complete the installation process, you need to activate the package by putting the code below somewhere in your ~.emacs~. Alternatively, and if you care about startup time, you may want to use the loader version instead. #+begin_src elisp (pdf-tools-install) ; Standard activation command @@ -301,14 +197,15 @@ To complete the installation process, you need to activate the package by puttin #+end_src Once the Installation process is complete, check out [[id:19a3daea-6fa6-4ac3-9201-d2034c46ad8c][Easy Help for PDF Tools features]] and [[id:8dccd685-18b8-4c98-977a-0fe2d66b724c][Configuring PDF Tools features]] to get started! -** Updating ~pdf-tools~ +** Updating pdf-tools :PROPERTIES: :CREATED: [2021-12-29 Wed 18:34] :ID: 9dd62314-f5ad-4bd4-83fa-8e28343e3d9c :END: -Some day you might want to update this package via ~git pull~ and then reinstall it. Sometimes this may fail, especially if Lisp-Macros are involved and the version hasn't changed. To avoid this kind of problems, you should delete the old package via ~list-packages~, restart Emacs and then reinstall the package. +Some day you might want to update this package via ~git pull~ and then reinstall it. Sometimes this may fail, especially if Lisp-Macros are involved and the version hasn't changed. To avoid this kind of problems, you should delete the old package via ~list-packages~, restart Emacs, run ~make distclean~ and then reinstall the package. Follow the steps described in [[id:32c4fc3b-b4ea-43bd-b92c-bdf2d3831fcf][Installing pdf-tools elisp code]]. + +This also applies when updating via MELPA / NonGNU ELPA (except for running the ~make distclean~ step). -This also applies when updating via package and MELPA. * Features :PROPERTIES: :CREATED: [2021-12-29 Wed 18:34] @@ -339,26 +236,25 @@ PDFView Mode is an Emacs PDF viewer. It displays PDF files as PNG images in Emac :CREATED: [2021-12-30 Thu 18:25] :ID: 01864499-2286-4e64-91f5-f8133f53ec61 :END: -| Navigation | | -|-----------------------------------------------+-----------------------| -| Scroll Up / Down by Page-full | ~space~ / ~backspace~ | -| Scroll Up / Down by Line | ~C-n~ / ~C-p~ | -| Scroll Right / Left | ~C-f~ / ~C-b~ | -| First Page / Last Page | ~<~ / ~>~ | -| Next Page / Previous Page | ~n~ / ~p~ | -| First Page / Last Page | ~M-<~ / ~M->~ | -| Incremental Search Forward / Backward | ~C-s~ / ~C-r~ | -| Occur (list all lines containing a phrase) | ~M-s o~ | -| Jump to Occur Line | ~RETURN~ | -| Pick a Link and Jump | ~F~ | -| Incremental Search in Links | ~f~ | -| History Back / Forwards | ~l~ / ~r~ | -| Display Outline | ~o~ | -| Jump to Section from Outline | ~RETURN~ | -| Jump to Page | ~M-g g~ | -| Store position / Jump to position in register | ~m~ / ~'~ | -|-----------------------------------------------+-----------------------| -| | | +| Navigation | | +|-----------------------------------------------+-------------------------| +| Scroll Up / Down by Page-full | ~space~ / ~backspace~ | +| Scroll Up / Down by Line | ~C-n~ / ~C-p~ | +| Scroll Right / Left | ~C-f~ / ~C-b~ | +| First Page / Last Page | ~<~, ~M-<~ / ~>~, ~M->~ | +| Next Page / Previous Page | ~n~ / ~p~ | +| Incremental Search Forward / Backward | ~C-s~ / ~C-r~ | +| Occur (list all lines containing a phrase) | ~M-s o~ | +| Jump to Occur Line | ~RETURN~ | +| Pick a Link and Jump | ~F~ | +| Incremental Search in Links | ~f~ | +| History Back / Forwards | ~l~ / ~r~ | +| Display Outline | ~o~ | +| Jump to Section from Outline | ~RETURN~ | +| Jump to Page | ~M-g g~ | +| Store position / Jump to position in register | ~m~ / ~'~ | +|-----------------------------------------------+-------------------------| +| | | Note that ~pdf-tools~ renders the PDF as images inside Emacs. This means that all the keybindings of ~image-mode~ work on individual PDF pages as well. | Image Mode | | |------------------------+---------------------------------------------| @@ -618,20 +514,20 @@ To see the list of operating systems where compilation testing is supported, run to scale the images correctly when rendering them. -** What Emacs versions does ~pdf-tools~ support? +** What Emacs versions does pdf-tools support? :PROPERTIES: :CREATED: [2022-01-02 Sun 10:12] :ID: f44c66e6-402d-4154-b806-6bb4180a0a5b :END: -~pdf-tools~ supports the 3 latest versions of Emacs major releases. At the moment of this writing, this means that the minimum supported Emacs version is ~26.1~. -** I want to add support for ~pdf-tools~ on =My Fav OS=. How do I do that? +~pdf-tools~ supports the 3 latest versions of Emacs major releases. At the moment of this writing, this means that the minimum supported Emacs version is ~26.3~. +** I want to add support for pdf-tools on "My Fav OS". How do I do that? :PROPERTIES: :CREATED: [2022-04-25 Mon 21:50] :ID: A34704B9-1B51-4614-8806-C4059F7B42D5 :END: I'm working on automating ~pdf-tools~ installation as much as possible, in order to improve the installation experience. If you want to add support for a new / currently unsupported Operating System, please modify the ~server/autobuild~ script. Say you want to support a new Operating System called MyFavOS. You need to do the following work: -1. Add a call to ~os_myfavos~ under ~handle-options~ at the end of the existing call chain. Here we try and pick up the correct Operating System and install the relevant dependencies. +1. Search for the ~Figure out where we are~ section. Here, add a call to ~os_myfavos~ right below ~handle_options~ at the end of the existing call chain. Here we try and pick up the correct Operating System and install the relevant dependencies. 2. Add handling for the ~--os~ argument in ~os_argument~ for ~myfavos~, so that the appropriate function can be called to install pre-requisites. ~--os~ is the argument that we pass to the script from the command-line to indicate which OS we are on. 3. Create a ~os_myfavos~ function. This function checks if we are running on MyFavOS. If we are running on MyFavOS, it sets up ~PKGCMD~, ~PKGARGS~ and ~PACKAGES~ variables so that the appropriate package manager can install the dependencies as part of the rest of the ~autobuild~ script. 4. If you are adding support for your favorite operating system, consider adding automated testing support as well, to help me ensure that ~epdfinfo~ continues to compile correctly. See [[id:A401543C-308B-4175-8212-5B78CD6C8389][Add a Dockerfile to automate server compilation testing]] for more details. @@ -642,7 +538,7 @@ This seems like a lot of work, but it is not. If you need a reference, search fo When you make your changes, please be sure to test [[id:1CBE7325-A5A1-479B-9A98-BEEFBAC9D8FF][the elisp changes]] as well as [[id:5327945D-9D92-4462-8172-7237DEF4C359][the server code changes]] as described in the linked articles. -** I am on a Macbook M1 and ~pdf-tools~ installation fails with a stack-trace +** I am on a Macbook M1 and pdf-tools installation fails with a stack-trace :PROPERTIES: :CREATED: [2022-05-09 Mon 20:29] :ID: 96D389D8-DD23-4FB0-996C-2D6F70A76BB2 @@ -683,7 +579,7 @@ You can see this by opening the =Activity Monitor=, selecting =Emacs=, clicking If your Emacs is compiled for x86, the =Code Type= will be =x86_64=. -** I am a developer, making changes to the ~pdf-tools~ source code +** I am a developer, making changes to the pdf-tools source code :PROPERTIES: :CREATED: [2022-05-09 Mon 21:31] :ID: 2D173424-C211-4474-B0D0-83F4381CAFFA -- cgit v1.0 From 7a51b38310014628fe4ada9731d6d63657e8f209 Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Thu, 24 Nov 2022 19:00:30 +0530 Subject: Extend docker testing framework to test against Emacs versions Until this commit, docker-based local testing only checked whether the epdfinfo server compiled correctly. With this commit, local testing now also runs elisp tests against the different versions of Emacs we currently support. All versions of Emacs are run on Ubuntu at the moment, but going forward I expect that we will add more operating system variants to this matrix as well. As test coverage increases, this will help automate away a lot of the tests! Relates to: #130 --- server/test/.gitignore | 1 + server/test/Makefile | 6 ++++-- server/test/docker/lib/run-tests | 21 ++++++++++++++++++--- server/test/docker/templates/Dockerfile.common.in | 6 +++--- server/test/docker/templates/emacs-26.Dockerfile.in | 5 +++++ server/test/docker/templates/emacs-27.Dockerfile.in | 5 +++++ server/test/docker/templates/emacs-28.Dockerfile.in | 5 +++++ server/test/docker/templates/emacs-29.Dockerfile.in | 5 +++++ 8 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 server/test/.gitignore create mode 100644 server/test/docker/templates/emacs-26.Dockerfile.in create mode 100644 server/test/docker/templates/emacs-27.Dockerfile.in create mode 100644 server/test/docker/templates/emacs-28.Dockerfile.in create mode 100644 server/test/docker/templates/emacs-29.Dockerfile.in diff --git a/server/test/.gitignore b/server/test/.gitignore new file mode 100644 index 0000000..aaedb1f --- /dev/null +++ b/server/test/.gitignore @@ -0,0 +1 @@ +.start-vm diff --git a/server/test/Makefile b/server/test/Makefile index 303b9a1..26a0f36 100644 --- a/server/test/Makefile +++ b/server/test/Makefile @@ -39,10 +39,10 @@ docker/%.Dockerfile: docker/templates/%.Dockerfile.in \ @echo Creating Dockerfile for target $* cat $^ > $@ -# Build the Docker Image +# Build the Docker Image. Since we are building a new image, remove the existing container. docker/.%.build: docker/%.Dockerfile ../autobuild docker/lib @echo Building target image $* - podman image build $(DOCKER_BUILD_ARGS) epdfinfo/$* -f $< ../ + podman image build $(DOCKER_BUILD_ARGS) epdfinfo/$* -f $< ../../ touch $@ # Build the Docker Container @@ -68,6 +68,8 @@ docker/.%.clean: docker/clean: $(patsubst %, docker/.%.clean, $(DOCKER_OS)) +test: docker/test + clean: docker/clean rm -f -- docker/.[^.]*.build rm -f -- docker/.[^.]*.container diff --git a/server/test/docker/lib/run-tests b/server/test/docker/lib/run-tests index 43fe5e5..31887bf 100755 --- a/server/test/docker/lib/run-tests +++ b/server/test/docker/lib/run-tests @@ -2,8 +2,23 @@ PATH="$(dirname "$0")":$PATH -set -e +run_tests_exit_success() +{ + echo "===============================" + echo " Elisp Tests succeeded. :O) " + echo "===============================" + exit 0 +} -yes-or-enter | ./autobuild -i /bin -yes-or-enter | ./autobuild -i /usr/bin | \ +set -e +# Check that install completes successfully +yes-or-enter | ./server/autobuild -i /bin +# Check that re-install skips package installation +yes-or-enter | ./server/autobuild -i /usr/bin | \ grep -q "Skipping package installation (already installed)" +# Check that lisp tests run correctly, if emacs is installed and available on PATH +echo +if which emacs > /dev/null 2> /dev/null; then + echo "Emacs found installed! Running elisp tests" + make test && run_tests_exit_success +fi diff --git a/server/test/docker/templates/Dockerfile.common.in b/server/test/docker/templates/Dockerfile.common.in index 083b19a..142f062 100644 --- a/server/test/docker/templates/Dockerfile.common.in +++ b/server/test/docker/templates/Dockerfile.common.in @@ -1,4 +1,4 @@ -ADD . /epdfinfo -WORKDIR /epdfinfo +COPY . /pdf-tools +WORKDIR /pdf-tools RUN make -s distclean || true -CMD ["sh", "./test/docker/lib/run-tests"] +CMD ["sh", "./server/test/docker/lib/run-tests"] diff --git a/server/test/docker/templates/emacs-26.Dockerfile.in b/server/test/docker/templates/emacs-26.Dockerfile.in new file mode 100644 index 0000000..088a991 --- /dev/null +++ b/server/test/docker/templates/emacs-26.Dockerfile.in @@ -0,0 +1,5 @@ +# -*- dockerfile -*- +FROM silex/emacs:26-ci-cask +ARG DEBIAN_FRONTEND=noninteractive +# Need to install make, tzdata here to avoid stupid prompts when running package install via autobuild +RUN apt-get update -y && apt-get install -y make tzdata diff --git a/server/test/docker/templates/emacs-27.Dockerfile.in b/server/test/docker/templates/emacs-27.Dockerfile.in new file mode 100644 index 0000000..50cd820 --- /dev/null +++ b/server/test/docker/templates/emacs-27.Dockerfile.in @@ -0,0 +1,5 @@ +# -*- dockerfile -*- +FROM silex/emacs:27-ci-cask +ARG DEBIAN_FRONTEND=noninteractive +# Need to install make, tzdata here to avoid stupid prompts when running package install via autobuild +RUN apt-get update -y && apt-get install -y make tzdata diff --git a/server/test/docker/templates/emacs-28.Dockerfile.in b/server/test/docker/templates/emacs-28.Dockerfile.in new file mode 100644 index 0000000..c6895ac --- /dev/null +++ b/server/test/docker/templates/emacs-28.Dockerfile.in @@ -0,0 +1,5 @@ +# -*- dockerfile -*- +FROM silex/emacs:28-ci-cask +ARG DEBIAN_FRONTEND=noninteractive +# Need to install make, tzdata here to avoid stupid prompts when running package install via autobuild +RUN apt-get update -y && apt-get install -y make tzdata diff --git a/server/test/docker/templates/emacs-29.Dockerfile.in b/server/test/docker/templates/emacs-29.Dockerfile.in new file mode 100644 index 0000000..edbf764 --- /dev/null +++ b/server/test/docker/templates/emacs-29.Dockerfile.in @@ -0,0 +1,5 @@ +# -*- dockerfile -*- +FROM silex/emacs:master-ci-cask +ARG DEBIAN_FRONTEND=noninteractive +# Need to install make, tzdata here to avoid stupid prompts when running package install via autobuild +RUN apt-get update -y && apt-get install -y make tzdata -- cgit v1.0 From 96703b2bb5c937afd05778086c43280b0593fe99 Mon Sep 17 00:00:00 2001 From: Vedang Manerikar Date: Thu, 13 Oct 2022 09:48:52 +0530 Subject: =?UTF-8?q?Bump=20the=20minimum=20Emacs=20version=20to=2026.3!=20?= =?UTF-8?q?=F0=9F=8E=89=F0=9F=A4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All the code working around issues in Emacs 24 and Emacs 25 has been removed at this point! (or at least, as much of it as I could find) I've tested against Emacs 28 and it's working fine. I need many more automated tests to ensure that behaviour does not break across multiple Emacs versions / operating systems, but that is a topic for another day. This commit bumps the version of `pdf-tools` from `1.0.0snapshot` to `1.0.0`. I do not expect this to have any real change either on Melpa Stable or Non-GNU Elpa, since they already parse the version as 1.0.0. I am not creating a tag at the moment. I will do some more cleanup work and directly create a `1.1.0` post those changes. Closes: #26 --- Cask | 2 -- lisp/pdf-tools.el | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Cask b/Cask index d9486f5..8d7b1e0 100644 --- a/Cask +++ b/Cask @@ -9,7 +9,5 @@ "server/epdfinfo.exe") (development - (depends-on "let-alist") - (depends-on "tablist") (depends-on "ert-runner") (depends-on "undercover")) diff --git a/lisp/pdf-tools.el b/lisp/pdf-tools.el index 9d15269..b94c82f 100644 --- a/lisp/pdf-tools.el +++ b/lisp/pdf-tools.el @@ -7,8 +7,8 @@ ;; URL: http://github.com/vedang/pdf-tools/ ;; Keywords: files, multimedia ;; Package: pdf-tools -;; Version: 1.0.0snapshot -;; Package-Requires: ((emacs "24.3") (nadvice "0.3") (tablist "1.0") (let-alist "1.0.4")) +;; Version: 1.0.0 +;; Package-Requires: ((emacs "26.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 -- cgit v1.0 From 997467ad3bcd23de22624c538d14863479b27cba Mon Sep 17 00:00:00 2001 From: Sunil Nimmagadda Date: Mon, 21 Nov 2022 11:58:59 +0530 Subject: autobuild: Recognize NetBSD and install packages via pkgin Closes: #170 --- README.org | 1 + server/autobuild | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/README.org b/README.org index 103dd6c..09ed930 100644 --- a/README.org +++ b/README.org @@ -112,6 +112,7 @@ The following Operating Systems / package managers are supported. *Note*: The pa - Apline Linux: ~apk~ - FreeBSD: ~pkg~ - OpenBSD: ~pkg_add~ +- NetBSD: ~pkgin~ - Arch Linux: ~pacman~ - Gentoo: ~emerge~ - CentOS: ~yum~ diff --git a/server/autobuild b/server/autobuild index 4b33bfd..517a30c 100755 --- a/server/autobuild +++ b/server/autobuild @@ -239,6 +239,17 @@ os_freebsd() { return 0 } +# NetBSD +os_netbsd() { + if ! which uname >/dev/null 2>&1 || [ "$(uname -s)" != "NetBSD" ]; then + return 1 + fi + PKGCMD=pkgin + PKGARGS=install + PACKAGES="autoconf automake poppler-glib png pkgconf" + return 0 +} + # OpenBSD os_openbsd() { if ! which uname >/dev/null 2>&1 || [ "$(uname -s)" != "OpenBSD" ]; then @@ -485,6 +496,7 @@ os_argument() { freebsd) os_freebsd "$@";; arch) os_arch "$@";; centos) os_centos "$@";; + netbsd) os_netbsd "$@";; openbsd) os_openbsd "$@";; fedora) os_fedora "$@";; debian) os_debian "$@";; @@ -514,6 +526,7 @@ os_macos "$@" || \ os_freebsd "$@" || \ os_arch "$@" || \ os_centos "$@" || \ +os_netbsd "$@" || \ os_openbsd "$@" || \ os_fedora "$@" || \ os_debian "$@" || \ -- cgit v1.0