[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/toc-org e33e4cc00a 084/128: Merge pull request #50 from sn
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/toc-org e33e4cc00a 084/128: Merge pull request #50 from snosov1/handle-custom-keywords |
Date: |
Sun, 2 Jan 2022 09:59:11 -0500 (EST) |
branch: elpa/toc-org
commit e33e4cc00ae1422816d1407f204c221d547e223c
Merge: 5a8a3f9b3a 40c6754d9f
Author: Sergei Nosov <sergei.nosov@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #50 from snosov1/handle-custom-keywords
handle custom keywords specified in the files
---
.travis.yml | 4 ++--
toc-org-test.el | 5 +++++
toc-org.el | 17 ++++++++++++++---
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 55a4eb0f1e..f157a2504b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,7 +6,7 @@ before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq -yy emacs25-nox
- emacs --version
- - emacs-25.2 --version
+ - emacs-25.3 --version
script:
- emacs -batch -l ert -l toc-org.el -l toc-org-test.el -f
ert-run-tests-batch-and-exit && emacs -batch -f batch-byte-compile toc-org.el
2>&1 | sed -n '/Warning\|Error/p' | xargs -r ls
- - emacs-25.2 -batch -l ert -l toc-org.el -l toc-org-test.el -f
ert-run-tests-batch-and-exit && emacs -batch -f batch-byte-compile toc-org.el
2>&1 | sed -n '/Warning\|Error/p' | xargs -r ls
+ - emacs-25.3 -batch -l ert -l toc-org.el -l toc-org-test.el -f
ert-run-tests-batch-and-exit && emacs -batch -f batch-byte-compile toc-org.el
2>&1 | sed -n '/Warning\|Error/p' | xargs -r ls
diff --git a/toc-org-test.el b/toc-org-test.el
index 8384f929bf..207a6cc798 100644
--- a/toc-org-test.el
+++ b/toc-org-test.el
@@ -102,6 +102,11 @@
(test-toc-org-raw-toc-gold-test
"* About\n:TOC:\n drawer\n:END:\n\n* Table of Contents
:TOC:\n - [[#about][About]]\n - [[#use][Use]]\n
- [[#different-href-styles][Different href styles]]\n -
[[#example][Example]]\n\n#+OPTIONS: num: nil todo:t |:t\n\n* Installation\n**
DONE via package.el\nThis is the simplest method if you have the package.el
module\n(built-in since Emacs 24.1) you can simply use =M-x
package-install=\nand then put the following snippet in your ~/. [...]
"* About\n* Installation\n** DONE via package.el\n*** Rather
commentious\n** Manual\n*** EWW\n*** Commented\n** No remove\n* Test ***\n")
+
+ ;; test custom todo keywords
+ (test-toc-org-raw-toc-gold-test
+ "#+STARTUP: showall align\n#+OPTIONS: todo:nil tasks:all
tags:nil\n#+EXCLUDE_TAGS: TOC_3\n#+TODO: CANCER SHMANCER | PARTY\n#+TYP_TODO:
FII IFF ADS\n\n* Summary
:TOC_3:\n- [[#done-task1][DONE Task1]]\n- [[#todo-task3][TODO Task3]]\n-
[[#task2][Task2]]\n - [[#subtask][SubTask]]\n- [[#task3][Task3]]\n\n* DONE
Task1\n CLOSED: [2017-09-08 Fri 01:46]\n* TODO Task3\n* CANCER Task2\n** FII
SubTask\n* CANCER Task3\n"
+ "* DONE Task1\n* TODO Task3\n* Task2\n** SubTask\n* Task3\n")
)
(ert-deftest test-toc-org-hrefify-gh ()
diff --git a/toc-org.el b/toc-org.el
index ac912de18b..9f72029b75 100644
--- a/toc-org.el
+++ b/toc-org.el
@@ -58,8 +58,8 @@ files on GitHub)"
"Regexp to find the extended version of :noexport: tag")
(defconst toc-org-tags-regexp "\s*:[[:word:]:@_]*:\s*$"
"Regexp to find tags on the line")
-(defconst toc-org-states-regexp "^*+\s+\\(TODO\s+\\|DONE\s+\\)"
- "Regexp to find states on the line")
+(defconst toc-org-todo-custom-keywords-regexp
"^#\\+\\(TODO\\|SEQ_TODO\\|TYP_TODO\\):\\(.*\\)$"
+ "Regexp to find custom TODO keywords")
(defconst toc-org-COMMENT-regexp "\\(^*+\\)\s+\\(COMMENT\s+\\)"
"Regexp to find COMMENT headlines")
(defconst toc-org-priorities-regexp "^*+\s+\\(\\[#.\\]\s+\\)"
@@ -105,7 +105,9 @@ i.e. simply flush everything that's not a heading and strip
auxiliary text."
(let ((content (buffer-substring-no-properties
(point-min) (point-max)))
- (leave-states-p nil))
+ (leave-states-p nil)
+ (custom-keywords nil)
+ (toc-org-states-regexp ""))
(with-temp-buffer
(insert content)
@@ -114,6 +116,15 @@ auxiliary text."
(when (re-search-forward toc-org-leave-todo-regexp nil t)
(setq leave-states-p t))
+ ;; set toc-org-states-regexp (after collecting custom keywords)
+ (goto-char (point-min))
+ (while (re-search-forward toc-org-todo-custom-keywords-regexp nil t)
+ (setq custom-keywords (append custom-keywords (split-string
(match-string 2) "[ \f\t\n\r\v|]+" t))))
+ (if custom-keywords
+ (setq toc-org-states-regexp
+ (concat "^*+\s+\\(" (mapconcat 'identity custom-keywords
"\s+\\|") "\s+\\)"))
+ (setq toc-org-states-regexp "^*+\s+\\(TODO\s+\\|DONE\s+\\)"))
+
;; keep only lines starting with *s
(goto-char (point-min))
(keep-lines "^\*+[ ]")
- [nongnu] elpa/toc-org 4c0b28da59 037/128: add more tags for easier search, (continued)
- [nongnu] elpa/toc-org 4c0b28da59 037/128: add more tags for easier search, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org e38e81af3f 088/128: Merge pull request #57 from JAremko/master, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org cda8f73640 073/128: Merge pull request #37 from snosov1/handle-comment, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org ee70dd23e1 104/128: resolve missing functions warnings, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org d52f95fae8 105/128: Handle trailing #'s, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 5ce7c24920 096/128: handle paranthesis in #+TODO line (fixes #65), ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org b1bab4c078 072/128: handle nil that is sometimes returned by (current-word), ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 9efeec690c 111/128: Remove the "backup" variable, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org ff8d49c2c7 113/128: Merge pull request #69 from htsr/comment-stripping, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 95a558b362 099/128: add tests for markdown-style syntax, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org e33e4cc00a 084/128: Merge pull request #50 from snosov1/handle-custom-keywords,
ELPA Syncer <=
- [nongnu] elpa/toc-org 7291a3b08d 100/128: Enable link following in markdown mode, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org f455bd4c88 103/128: Call batch compile before running the tests, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 8321d3c76b 120/128: Revert "Respect the file-local value of org-list-indent-offset.", ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 6eca67f9a8 127/128: Merge pull request #83 from skangas/silence-byte-compiler, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 328d34144f 124/128: Bump version to 1.1, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org ebff38bfa4 094/128: make toc-org a minor mode (#61), ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org aa9aea6d69 102/128: Supress warnings, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 215d3e41e3 114/128: fix C-c C-o for links with cookies, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org a2cb4c254f 128/128: Merge pull request #84 from skangas/nongnu-elpa, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org d66a41f6b7 010/128: strip tags, ELPA Syncer, 2022/01/02