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

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

[elpa] externals/doc-toc a0018b8a63 71/84: Add replace fields in toc-tab


From: ELPA Syncer
Subject: [elpa] externals/doc-toc a0018b8a63 71/84: Add replace fields in toc-tabular-mode feature
Date: Mon, 26 Sep 2022 13:58:39 -0400 (EDT)

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

    Add replace fields in toc-tabular-mode feature
---
 toc-mode.el | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/toc-mode.el b/toc-mode.el
index eae96dc5fa..bf799e44c1 100644
--- a/toc-mode.el
+++ b/toc-mode.el
@@ -702,6 +702,18 @@ Prompt for startpage and endpage and print OCR output to 
new buffer."
        t)
       (forward-line 1))))
 
+(defun toc--replace-input ()
+  (interactive)
+  (let* ((column (cond ((< (current-column) 5)
+                       0)
+                      ((and (> (current-column) 5) (< (current-column) 90))
+                       1)
+                      ((> (current-column) 90)
+                       2)))
+         (old-input (aref (tabulated-list-get-entry) column))
+         (new-input (read-string "Replace column input with: " old-input)))
+    (tabulated-list-set-col column new-input t)))
+
 (defun toc--tablist-follow ()
   "Preview pagenumber of current line in separate document buffer."
   (interactive)
@@ -777,6 +789,7 @@ Prompt for startpage and endpage and print OCR output to 
new buffer."
     (define-key map [S-left] #'toc--decrease)
     (define-key map [C-right] #'toc--increase-remaining-and-follow)
     (define-key map [C-left] #'toc--decrease-remaining-and-follow)
+    (define-key map "\C-r" #'toc--replace-input)
     (define-key map [tab] #'toc--tablist-follow)
     (define-key map [S-down] #'toc--scroll-other-window-page-up)
     (define-key map [S-up] #'toc--scroll-other-window-page-down)
@@ -794,7 +807,7 @@ Prompt for startpage and endpage and print OCR output to 
new buffer."
   tabulated-list-mode "TOC-tabular"
   "Major mode for Table Of Contents.
 \\{toc-tabular-mode-map}"
-  (setq-local tabulated-list-format [("level" 10 nil) ("name" 80 nil) ("page" 
1 nil)])
+  (setq-local tabulated-list-format [("level" 5 nil) ("name" 84 nil) ("page" 4 
nil)])
   (tabulated-list-init-header))
 
 (defun toc--list (buffer)



reply via email to

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