[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/doc-toc 97c0ce5c40 19/84: Implement from tabular jump t
From: |
ELPA Syncer |
Subject: |
[elpa] externals/doc-toc 97c0ce5c40 19/84: Implement from tabular jump to/scroll page for djvu |
Date: |
Mon, 26 Sep 2022 13:58:35 -0400 (EDT) |
branch: externals/doc-toc
commit 97c0ce5c40c90aa481239b565abbd0e8987cdfc6
Author: Daniel Nicolai <dalanicolai@gmail.com>
Commit: Daniel Nicolai <dalanicolai@gmail.com>
Implement from tabular jump to/scroll page for djvu
---
README.org | 3 +--
toc-mode.el | 35 +++++++++++++++++++++++++----------
2 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/README.org b/README.org
index c5e3658548..0d17d4ba6e 100644
--- a/README.org
+++ b/README.org
@@ -87,9 +87,8 @@ buffer can be navigated with the arrow =up/down= keys. The
=left= and =right= ar
keys will shift =down/up= all the page numbers from the current line and below
(combine with =SHIFT= for setting individual pagenumbers).
-**** Currently only for pdf's
The =TAB= key jumps to the pagenumber of the current line. =S-up/S-donw= in the
-tablist window will scroll page up/down in the document window while
=C-up/C-down=
+tablist window will scroll page up/down in the document window while, only for
pdf, =C-up/C-down=
will scroll smoothly in that window.
For type =C-c C-c= when done.
diff --git a/toc-mode.el b/toc-mode.el
index f5f2289d87..a1201ab731 100644
--- a/toc-mode.el
+++ b/toc-mode.el
@@ -169,8 +169,17 @@ Use with the universal argument (C-u) omits cleanup to get
the unprocessed text.
(text "")
(buffer (file-name-sans-extension (buffer-name))))
(while (<= startpage (+ endpage))
- (let ((file (cond ((string= ".pdf" ext) (make-temp-file "pageimage"
nil (number-to-string startpage) (pdf-cache-get-image startpage 600)))
- ((string= ".djvu" ext) (djvu-goto-page startpage)
(make-temp-file "pageimage" nil (number-to-string startpage) (image-property
djvu-doc-image :data))))))
+ (let ((file (cond ((string= ".pdf" ext)
+ (make-temp-file "pageimage"
+ nil
+ (number-to-string startpage)
+ (pdf-cache-get-image startpage
600)))
+ ((string= ".djvu" ext)
+ (djvu-goto-page startpage)
+ (make-temp-file "pageimage"
+ nil
+ (number-to-string startpage)
+ (image-property djvu-doc-image
:data))))))
(call-process "tesseract" nil (list buffer nil) nil file
"stdout" "--psm" "6")
(setq startpage (1+ startpage))))
(switch-to-buffer buffer)
@@ -291,21 +300,27 @@ Use with the universal argument (C-u) omits cleanup to
get the unprocessed text.
(defun toc-tablist-follow ()
(interactive)
- (let ((page (string-to-number (aref (tabulated-list-get-entry) 2))))
+ (let ((ext (url-file-extension (buffer-file-name doc-buffer)))
+ (page (string-to-number (aref (tabulated-list-get-entry) 2))))
(pop-to-buffer doc-buffer)
- (pdf-view-goto-page page)
+ (cond ((string= ".pdf" ext) (pdf-view-goto-page page))
+ ((string= ".djvu" ext) (djvu-goto-page page)))
(other-window 1)))
-(defun toc-scroll-pdf-other-window-page-up ()
+(defun toc-scroll-other-window-page-up ()
(interactive)
(other-window 1)
- (pdf-view-next-page 1)
+ (let ((ext (url-file-extension (buffer-file-name (current-buffer)))))
+ (cond ((string= ".pdf" ext) (pdf-view-next-page 1))
+ ((string= ".djvu" ext) (djvu-next-page 1))))
(other-window 1))
-(defun toc-scroll-pdf-other-window-page-down ()
+(defun toc-scroll-other-window-page-down ()
(interactive)
(other-window 1)
- (pdf-view-previous-page 1)
+ (let ((ext (url-file-extension (buffer-file-name (current-buffer)))))
+ (cond ((string= ".pdf" ext) (pdf-view-previous-page 1))
+ ((string= ".djvu" ext) (djvu-prev-page 1))))
(other-window 1))
(defun toc-scroll-pdf-other-window-down ()
@@ -327,8 +342,8 @@ Use with the universal argument (C-u) omits cleanup to get
the unprocessed text.
(define-key map [S-right] 'toc-increase)
(define-key map [S-left] 'toc-decrease)
(define-key map [tab] 'toc-tablist-follow)
- (define-key map [S-down] 'toc-scroll-pdf-other-window-page-up)
- (define-key map [S-up] 'toc-scroll-pdf-other-window-page-down)
+ (define-key map [S-down] 'toc-scroll-other-window-page-up)
+ (define-key map [S-up] 'toc-scroll-other-window-page-down)
(define-key map [C-down] 'toc-scroll-pdf-other-window-up)
(define-key map [C-up] 'toc-scroll-pdf-other-window-down)
(define-key map "\C-c\C-c" 'toc-tablist-to-toc-source)
- [elpa] externals/doc-toc f2ea7db226 68/84: Fix all checkdoc warnings, (continued)
- [elpa] externals/doc-toc f2ea7db226 68/84: Fix all checkdoc warnings, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc 487177a81b 73/84: Update package description, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc 36fe728f38 72/84: Make tesseract psm code configurable via universal arg, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc d5629c7165 75/84: Update djvu ocr to djvu3.el (create ppm instead of svg), ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc a259f4cc65 77/84: Correct docstring position, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc 0671d11654 78/84: Merge pull request #8 from syohex/docstring, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc cf6b12ca35 79/84: Fix #10: prevent pdf-filename become nil, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc b4bb748aa3 84/84: Fix README (remove repeated section), ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc 0c9a7a484f 09/84: Update README with link to djvulibre website, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc 559e7bbf3d 13/84: Implement extract with tesseract ocr, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc 97c0ce5c40 19/84: Implement from tabular jump to/scroll page for djvu,
ELPA Syncer <=
- [elpa] externals/doc-toc 2b6045b0a3 22/84: minor additions i.e. autoload comment and docstrings, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc dda3491299 34/84: Fix djvu parse tablist to djvused algorithm, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc e84c00c923 45/84: Fix/remove ask for path before add TOC djvu, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc eb8c6a0c00 56/84: Fix seq and cl compiler warnings, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc 05b6d034aa 59/84: Fix djvu/pdf hard dependency (github issue #3), ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc 8d4817a543 62/84: Fix org-noter conflict (github #4), ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc a14dbb4c25 67/84: Fix beginning-of-buffer compilation warning, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc 102e14199c 65/84: pdf.tocgen replace original pdf, and show message on fail, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc 4c9ce0f54d 76/84: Fix: eval-when-compile pdf-tools, ELPA Syncer, 2022/09/26
- [elpa] externals/doc-toc 2ec9515f0d 81/84: Apply patch S. Monnier, ELPA Syncer, 2022/09/26