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

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

[elpa] externals/doc-toc dc5be6442f 66/84: Add jump-by-level to toc-tabu


From: ELPA Syncer
Subject: [elpa] externals/doc-toc dc5be6442f 66/84: Add jump-by-level to toc-tabular-mode
Date: Mon, 26 Sep 2022 13:58:39 -0400 (EDT)

branch: externals/doc-toc
commit dc5be6442ffa3eac5742d6a7854194b1eb197d5d
Author: Daniel Nicolai <dalanicolai@gmail.com>
Commit: Daniel Nicolai <dalanicolai@gmail.com>

    Add jump-by-level to toc-tabular-mode
---
 README.org  | 10 +++++++---
 toc-mode.el |  9 +++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/README.org b/README.org
index e343f59dbd..f0932cc197 100644
--- a/README.org
+++ b/README.org
@@ -127,9 +127,12 @@ keys will shift =down/up= all the page numbers from the 
current line and below
 
 The =TAB= key jumps to the pagenumber of the current line, while 
=C-right/C-left=
 will shift all remaining page numbers up/down while jumping/scrolling to the
-line its page in the document window. to the =S-up/S-donw= in the tablist 
window
-will just scroll page up/down in the document window and, only for pdf, 
=C-up/C-down=
-will scroll smoothly in that window.
+line its page in the document window. Because the numbering of scanned books
+often breaks at sections of a certain level, =C-j= will let jo jump quickly to 
the
+next entry of a certain level (e.g. you can quickly check if the page numbers 
of
+all level 0 sections correspond to the page numbers in the document). The
+=S-up/S-down= in the tablist window will just scroll page up/down in the 
document
+window and, =C-up/C-down= will scroll smoothly in that window.
 
 Type =C-c C-c= when done.
 
@@ -174,6 +177,7 @@ toc-mode (tablist)
 | ~S-right/S-left~ | in/decrease pagenumber current entry                      
           |
 | ~C-down/C-up~    | scroll document other window (only when other buffer 
shows document) |
 | ~S-down/S-up~    | full page scroll document other window ( idem )           
           |
+| =C-j=            | toc--jump-to-next-entry-by-level                          
                                           |
 
 
 * Alternatives
diff --git a/toc-mode.el b/toc-mode.el
index c7d9f979d6..8887f4182b 100644
--- a/toc-mode.el
+++ b/toc-mode.el
@@ -753,6 +753,14 @@ Prompt for startpage and endpage and print OCR output to 
new buffer."
           ((string= ".djvu" ext) (djvu-scroll-down-or-previous-page))))
   (other-window 1))
 
+(defun toc--jump-to-next-entry-by-level (char)
+  (interactive "cJump to next entry of level: ")
+  (forward-line)
+  (let ((level (char-to-string char)))
+    (while (not (or (string= (aref (tabulated-list-get-entry) 0) level) 
(eobp)))
+                (forward-line)))
+  (toc--tablist-follow))
+
 (defvar toc-tabular-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [right] #'toc--increase-remaining)
@@ -766,6 +774,7 @@ Prompt for startpage and endpage and print OCR output to 
new buffer."
     (define-key map [S-up] #'toc--scroll-other-window-page-down)
     (define-key map [C-down] #'toc--scroll-pdf-other-window-down)
     (define-key map [C-up] #'toc--scroll-pdf-other-window-up)
+    (define-key map "\C-j" #'toc--jump-to-next-entry-by-level)
     (define-key map "\C-c\C-c" #'toc--tablist-to-toc-source)
     (define-key map "\C-c\C-c" #'toc--tablist-to-toc-source)
     (when (featurep 'evil-commands)



reply via email to

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