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

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

[nongnu] elpa/toc-org 90894242a6 046/128: treat org-list-indent-offset p


From: ELPA Syncer
Subject: [nongnu] elpa/toc-org 90894242a6 046/128: treat org-list-indent-offset properly
Date: Sun, 2 Jan 2022 09:59:08 -0500 (EST)

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

    treat org-list-indent-offset properly
    
    Fixes #5
    
    Thanks to @wasamasa for pointing out the issue and proposing the fix
---
 README.org |  8 ++++----
 toc-org.el | 12 +++++++-----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/README.org b/README.org
index d53d849db2..9989e17b7d 100644
--- a/README.org
+++ b/README.org
@@ -13,11 +13,11 @@ name conflict with one of the org contrib modules.
 * Table of Contents                                                     :TOC:
  - [[#about][About]]
  - [[#installation][Installation]]
-     - [[#via-packageel][via package.el]]
-     - [[#manual][Manual]]
+   - [[#via-packageel][via package.el]]
+   - [[#manual][Manual]]
  - [[#use][Use]]
-     - [[#follow-links][Follow links]]
-     - [[#shortcut-for-toc-tag][Shortcut for TOC tag]]
+   - [[#follow-links][Follow links]]
+   - [[#shortcut-for-toc-tag][Shortcut for TOC tag]]
  - [[#different-href-styles][Different href styles]]
  - [[#example][Example]]
 
diff --git a/toc-org.el b/toc-org.el
index b8ab961a5a..a9ffa1b9b2 100644
--- a/toc-org.el
+++ b/toc-org.el
@@ -201,7 +201,9 @@ each heading into a link."
 
             (while (looking-at "\\*")
               (delete-char 1)
-              (insert "    "))
+              (insert (make-string
+                       (+ 2 (or (bound-and-true-p org-list-indent-offset) 0))
+                       ?\s)))
 
             (skip-chars-forward " ")
             (insert "- ")
@@ -232,7 +234,7 @@ each heading into a link."
     (should (equal (gethash "ABOUT" hash) "About")))
   (let ((hash (make-hash-table :test 'equal)))
     (should (equal (toc-org-hrefify-toc "* About\n* Installation\n** via 
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 'upcase 
hash)
-                   " - [[ABOUT][About]]\n - [[INSTALLATION][Installation]]\n   
  - [[VIA PACKAGE.EL][via package.el]]\n     - [[MANUAL][Manual]]\n - 
[[USE][Use]]\n - [[DIFFERENT HREF STYLES][Different href styles]]\n - 
[[EXAMPLE][Example]]\n"))
+                   " - [[ABOUT][About]]\n - [[INSTALLATION][Installation]]\n   
- [[VIA PACKAGE.EL][via package.el]]\n   - [[MANUAL][Manual]]\n - 
[[USE][Use]]\n - [[DIFFERENT HREF STYLES][Different href styles]]\n - 
[[EXAMPLE][Example]]\n"))
     (should (equal (gethash "ABOUT" hash) "About"))
     (should (equal (gethash "INSTALLATION" hash) "Installation"))
     (should (equal (gethash "VIA PACKAGE.EL" hash) "via package.el"))
@@ -366,7 +368,7 @@ following tag formats:
   (let ((beg "* 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-org-test-insert-toc-gold-test
      (concat beg ":TOC:")
-     "* 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 - 
[[#about][About]]\n - [[#hello][Hello]]\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 - 
[[#about][About]]\n - [[#hello][Hello]]\n   - [[#g [...]
 
     (toc-org-test-insert-toc-gold-test
      (concat beg ":TOC_1:")
@@ -374,7 +376,7 @@ following tag formats:
 
     (toc-org-test-insert-toc-gold-test
      (concat beg ":TOC_3:")
-     "* 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_3:\n 
- [[#about][About]]\n - [[#hello][Hello]]\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_3:\n 
- [[#about][About]]\n - [[#hello][Hello]]\n   - [[ [...]
 
     (toc-org-test-insert-toc-gold-test
      (concat beg ":TOC_1_org:")
@@ -382,7 +384,7 @@ following tag formats:
 
     (toc-org-test-insert-toc-gold-test
      (concat beg ":TOC_3_org:")
-     "* 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_3_org:\n - [[About][About]]\n - [[Hello][Hello]]\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_3_org:\n - [[About][About]]\n - [[Hello][Hello]]\n   -  [...]
 
 ;; Local Variables:
 ;; compile-command: "emacs -batch -l ert -l *.el -f 
ert-run-tests-batch-and-exit && emacs -batch -f batch-byte-compile *.el 2>&1 | 
sed -n '/Warning\|Error/p' | xargs -r ls"



reply via email to

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