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

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

[nongnu] elpa/toc-org 4e4b4e6484 057/128: generate correct toc when it's


From: ELPA Syncer
Subject: [nongnu] elpa/toc-org 4e4b4e6484 057/128: generate correct toc when it's the last heading
Date: Sun, 2 Jan 2022 09:59:09 -0500 (EST)

branch: elpa/toc-org
commit 4e4b4e6484dab76f627d8211dc768dbbc8c0116c
Author: Sergei Nosov <sergei.nosov@gmail.com>
Commit: Sergei Nosov <sergei.nosov@gmail.com>

    generate correct toc when it's the last heading
---
 toc-org.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/toc-org.el b/toc-org.el
index 389cb4fc05..72ffde745c 100644
--- a/toc-org.el
+++ b/toc-org.el
@@ -364,7 +364,7 @@ following tag formats:
                     ;; skip drawers
                     (let ((end
                            (save-excursion ;; limit to next heading
-                             (search-forward-regexp "^\\*" (point-max) t))))
+                             (search-forward-regexp "^\\*" (point-max) 
'skip))))
                      (while (re-search-forward toc-org-drawer-regexp end t)
                       (skip-chars-forward "[:space:]")))
                     (beginning-of-line)
@@ -377,7 +377,7 @@ following tag formats:
                     (let ((beg (point))
                           (end
                            (save-excursion
-                             (when (search-forward-regexp "^\\*" (point-max) t)
+                             (when (search-forward-regexp "^\\*" (point-max) 
'skip)
                                (forward-line -1))
                              (end-of-line)
                              (point))))
@@ -442,6 +442,10 @@ following tag formats:
     (test-toc-org-insert-toc-gold-test
      (concat beg ":TOC:\n:PROPERTIES:\n:VISIBILITY: content\n:END:\n")
      "* About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an 
up-to-date table of contents in the\norg files without exporting (useful 
primarily for readme files on\nGitHub).\n\nIt is similar to the 
[[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works 
for org files.\n:TOC:\n  drawer\n:END:\n* Hello\n** Good-bye\n*** Salut\n* 
Table of Contents                                                     
:TOC:\n:PROPERTIES:\n:VISIBILITY: content\n:END:\n - [[#abou [...]
+
+    (test-toc-org-insert-toc-gold-test
+     "* H1\n* H2\n* TOC           :TOC:\n - [[#header-1][Header 1]]\n - 
[[#header-2][Header 2]]\n"
+     "* H1\n* H2\n* TOC           :TOC:\n - [[#h1][H1]]\n - [[#h2][H2]]\n")
     ))
 
 ;; Local Variables:



reply via email to

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