[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eev 239130cac1: Rewrote find-pdftools-page; added find-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/eev 239130cac1: Rewrote find-pdftools-page; added find-pdftoolsr-page. |
Date: |
Tue, 4 Jan 2022 05:57:27 -0500 (EST) |
branch: externals/eev
commit 239130cac16b0a2481233a0ad43b0b319f5e7c1f
Author: Eduardo Ochs <eduardoochs@gmail.com>
Commit: Eduardo Ochs <eduardoochs@gmail.com>
Rewrote find-pdftools-page; added find-pdftoolsr-page.
---
ChangeLog | 11 +++++++++
VERSION | 4 ++--
eev-pdflike.el | 76 ++++++++++++++++++++++++++++++++++++++++++++++++----------
3 files changed, 76 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4d077bf212..e83721e898 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2022-01-04 Eduardo Ochs <eduardoochs@gmail.com>
+
+ * eev-pdflike.el (find-pdftoolsr-page): new function.
+
+2022-01-03 Eduardo Ochs <eduardoochs@gmail.com>
+
+ * eev-pdflike.el (find-xpdf-page): define it explicitly.
+ (find-pdftools-page): rewritten. The new version always calls
+ `revert-buffer' and it uses `pdf-loader-install' instead of
+ `pdf-tools-install'.
+
2021-12-26 Eduardo Ochs <eduardoochs@gmail.com>
* eev-videolinks.el (find-2021ffllvideo): new function.
diff --git a/VERSION b/VERSION
index f2b2b581a3..bf7678e7d6 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-Sun Dec 26 14:19:36 GMT 2021
-Sun Dec 26 11:19:36 -03 2021
+Tue Jan 4 10:01:05 GMT 2022
+Tue Jan 4 07:01:05 -03 2022
diff --git a/eev-pdflike.el b/eev-pdflike.el
index ccd9cec86b..6184bea1d0 100644
--- a/eev-pdflike.el
+++ b/eev-pdflike.el
@@ -19,7 +19,7 @@
;;
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
;; Maintainer: Eduardo Ochs <eduardoochs@gmail.com>
-;; Version: 20211011
+;; Version: 20220104
;; Keywords: e-scripts
;;
;; Latest version: <http://angg.twu.net/eev-current/eev-pdflike.el>
@@ -646,6 +646,11 @@ version just returns the value of the variable
,@(if page `(,(format "%s%d" (ee-find-xpdf-colon) page)))
))
+(defun find-xpdf-page (fname &optional page &rest rest)
+ "This defun will be overridden by the `code-pdfbackend' below.
+We define it just to make this work: (find-efunction 'find-xpdf-page)"
+ (find-bgprocess (ee-find-xpdf-page fname page)))
+
;; (find-code-pdfbackend "xpdf-page")
(code-pdfbackend "xpdf-page")
@@ -724,27 +729,72 @@ version just returns the value of the variable
;; This backend uses the Emacs package `pdf-tools' - that is "a better
;; DocView" - to display a PDF in an Emacs buffer. See:
;;
-;; https://github.com/politza/pdf-tools
-;; (find-epackage 'pdf-tools)
+;; https://github.com/vedang/pdf-tools/
+;; (find-epackage-links 'pdf-tools)
+;; (find-epackage 'pdf-tools)
;; (find-enode "Document View")
-;; http://angg.twu.net/find-pdf-page.html
;;
-;; Note that we don't have an `ee-find-pdftools-page', and
-;; the the defun below OVERRIDES `find-pdftools-page'.
+;; Note that `*-pdftools-page' is an atypical backend. In all the
+;; "normal" backends the function `ee-find-FOO-page' returns the name
+;; of an external program and its command-line arguments, and
+;; `find-FOO-page' uses `find-bgprocess' to call that external
+;; program...
+;;
+;; In the `*-pdftools-page' family of functions the function
+;; `ee-find-pdftools-page' does not exist, and the
+;; `(defun find-pdftools-page ...)' below OVERRIDES the
+;; `(defun find-pdftools-page ...)' executed by the
+;; `(code-pdfbackend "pdftools-page")'.
;;
;; (find-code-pdfbackend "pdftools-page")
(code-pdfbackend "pdftools-page")
-(defun find-pdftools-page (fname &optional page &rest rest)
- (pdf-tools-install)
- (find-fline fname)
- (if page (pdf-view-goto-page (or page 1))))
+(defun find-pdftools-page (pdffile &optional page &rest rest)
+ "Open PDFFILE in the current window using pdf-tools.
+If PAGE is given, go to that page; if PAGE is nil, stay in the
+current page."
+ ;;
+ ;; `pdf-loader-install' makes sure that pdf-tools is loaded and
+ ;; that it has set up `auto-mode-alist' and `magic-mode-alist' to
+ ;; make PDF files be opened in `pdf-view-mode' instead of in
+ ;; `doc-view-mode'. See:
+ ;; (find-evardescr 'auto-mode-alist "pdf")
+ ;; (find-evardescr 'auto-mode-alist "pdf-view-mode")
+ ;; (find-evardescr 'auto-mode-alist "doc-view-mode")
+ ;; (find-efunction 'pdf-loader-install)
+ ;; (find-efunction 'pdf-tools-install)
+ ;;
+ ;; Old way: (pdf-tools-install)
+ (pdf-loader-install)
+ ;; Open pdffile. You will get weird results if it is not a PDF.
+ (find-fline pdffile)
+ ;; Reload the PDF if it has changed.
+ (revert-buffer nil 'noconfirm)
+ ;; If PAGE is given, go to that page.
+ (if page (pdf-view-goto-page page)))
+
+
+;; Test:
+;; (defalias 'find-pdf-page 'find-xpdf-page)
+;; (defalias 'find-pdf-page 'find-pdftoolsr-page)
+;; (find-pdf-page "~/Coetzee99.pdf" 1)
+;; (find-pdf-page "~/Coetzee99.pdf" 3)
+(defun find-pdftoolsr-page (fname &optional page &rest rest)
+ "Like `find-pdftools-page', but opens the PDF in the right window."
+ (interactive)
+ (find-2a nil '(find-pdftools-page fname page)))
-;; I use this function to redisplay the generated PDFs after
-;; recompiling their LaTeX source. TODO: document this.
-;; My notes are here: (find-es "emacs" "ee-pdftools-revert-all")
+
+;; The function `ee-pdftools-revert-all' below - from 2019 - was a
+;; trick that I used to redisplay PDFs when I recompiled their LaTeX
+;; source. In jan/2022 I added a `(revert-buffer ...)' to
+;; `find-pdftools-page', and I _think_ that this will let me rewrite
+;; my hacks that use `ee-pdftools-revert-all' in a much better way.
+;;
+;; My old notes are here: (find-es "emacs" "ee-pdftools-revert-all")
+;; This function will probably be declared obsolete soon.
;;
(defun ee-pdftools-revert-all ()
"Run `revert-buffer' in all windows in which pdf-tools is showing PDFs.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/eev 239130cac1: Rewrote find-pdftools-page; added find-pdftoolsr-page.,
ELPA Syncer <=