changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: ulang and cli updates

changeset 626: cc13027df6fa
parent 625: e49442cd6010
child 627: 3af20cb389e8
author: Richard Westhaver <ellis@rwest.io>
date: Mon, 26 Aug 2024 20:09:01 -0400
files: emacs/lib/ulang.el lisp/lib/cli/clap/cli.lisp lisp/lib/cli/clap/cmd.lisp lisp/lib/cli/tests.lisp
description: ulang and cli updates
     1.1--- a/emacs/lib/ulang.el	Sun Aug 25 21:38:07 2024 -0400
     1.2+++ b/emacs/lib/ulang.el	Mon Aug 26 20:09:01 2024 -0400
     1.3@@ -33,6 +33,16 @@
     1.4 (defvar ulang-link-history nil)
     1.5 (defvar ulang-file-history nil)
     1.6 
     1.7+(defvar ulang-categories
     1.8+  (list "note" "link" "code" "doc" "project" "data"))
     1.9+
    1.10+;;  FIX 2024-08-26: doesn't work
    1.11+(defun org-category-allowed-values (prop)
    1.12+  (when (string= (upcase prop) "CATEGORY")
    1.13+    (append ulang-categories (list ":ETC"))))
    1.14+
    1.15+(cl-pushnew #'org-category-allowed-values org-property-allowed-value-functions)
    1.16+
    1.17 ;;;###autoload
    1.18 (defun dblock-insert-links (regexp)
    1.19   "Create dblock to insert links matching REGEXP."
    1.20@@ -51,17 +61,18 @@
    1.21 (setq org-stuck-projects '("+PROJECT/-DONE" ("NEXT") nil ""))
    1.22 
    1.23 (setq org-todo-keywords
    1.24-      '((type "TBD(0!)" "TODO(t!)" "|")
    1.25-        (type "WIP(w!)" "|")
    1.26-        (type "HOLD(H@!)" "WAIT(/j@!)" "|")
    1.27-        (sequence "FIND(q!)" "READ(r@!)" "WATCH(A@!)" "|")
    1.28-        (sequence "RESEARCH(s!)" "RECORD(e!)" "WRITE(W!)" "|")
    1.29+      '((sequence "TBD(0!)" "TODO(t!)" "NEXT(n!)" "WIP(i!)" "|" "DONE(d!)")
    1.30+        (sequence "HOLD(H@/!)" "WIP(!)" "|")
    1.31+        (sequence "WAIT(W@/!)" "WIP(!)" "|")
    1.32+        (sequence "RESEARCH(s!)" "REPORT(c!)" "|")
    1.33         (sequence "OUTLINE(O!)" "DRAFT(M!)" "REVIEW(V!)" "|")
    1.34-        (type "FIXME(i!)" "TEST(T!)" "BENCH(b!)" "DEPLOY(D!)" "RUN(X!)" "LOG(L!)" "GOTO(g!)" "|")
    1.35-        (type "HACK(h!)" "CODE(c!)" "|")
    1.36-        (type "NOTE(n!)" "LINK(l!)")
    1.37+        (type "FIND(q!)" "READ(r@!)" "WATCH(A@!)" "HACK(h!)"
    1.38+              "CODE(c!)" "BENCH(b!)" "DEPLOY(D!)" "RUN(X!)"
    1.39+              "REFILE(w!)"
    1.40+              "LOG(L!)" "GOTO(g!)" "|")
    1.41+        (type "FIXME(f!)" "WIP(!)" "TEST(T!)" "|")
    1.42         (type "PROJECT(p!)" "PRODUCT(P!)" "SPRINT(S!)" "RELEASE(R!)" "|")
    1.43-        (sequence "|" "DONE(d!)" "NOPE(x@!)" "FOUND(f@!)" "FIXED(F!)")))
    1.44+        (sequence "|" "DONE(d!)" "NOPE(x@!)")))
    1.45 
    1.46 (setq org-todo-keyword-faces
    1.47       '(("PROJECT" . (:foreground "lightseagreen" :weight bold))
    1.48@@ -70,7 +81,7 @@
    1.49         ("RESEARCH" . (:foreground "maroon2" :weight bold))
    1.50         ("HACK" . (:foreground "maroon3" :weight bold))
    1.51         ("TBD" . (:foreground "darkred2" :weight bold))
    1.52-        ("NOTE" . (:foreground "tomato2" :weight bold))
    1.53+        ;; ("NOTE" . (:foreground "tomato2" :weight bold))
    1.54         ("CODE" . (:foreground "bisque" :weight bold :background "midnightblue"))
    1.55         ("HOLD" . (:foreground "red1" :weight bold :background "yellow1"))
    1.56         ("WAIT" . (:foreground "red4" :weight bold :background "yellow1"))
     2.1--- a/lisp/lib/cli/clap/cli.lisp	Sun Aug 25 21:38:07 2024 -0400
     2.2+++ b/lisp/lib/cli/clap/cli.lisp	Mon Aug 26 20:09:01 2024 -0400
     2.3@@ -37,7 +37,7 @@
     2.4          "Run the top-level function and print to *STDOUT*."
     2.5          (with-cli-handlers
     2.6            (progn
     2.7-             ,@body (terpri))))
     2.8+             ,@body)))
     2.9        ,@(when export `((export ',main))))))
    2.10 
    2.11 ;; RESEARCH 2023-09-12: closed over hash-table with short/long flags
     3.1--- a/lisp/lib/cli/clap/cmd.lisp	Sun Aug 25 21:38:07 2024 -0400
     3.2+++ b/lisp/lib/cli/clap/cmd.lisp	Mon Aug 26 20:09:01 2024 -0400
     3.3@@ -217,7 +217,7 @@
     3.4     (let ((args (if compile (proc-args self args) args)))
     3.5       (install-ast self args))))
     3.6 
     3.7-;; warning: make sure to fill in the opt and cmd slots with values
     3.8+;; WARNING: make sure to fill in the opt and cmd slots with values
     3.9 ;; from the top-level args before calling a command.
    3.10 (defmethod call-cmd ((self cli-cmd) args opts)
    3.11   (trace! "calling command:" args opts)
     4.1--- a/lisp/lib/cli/tests.lisp	Sun Aug 25 21:38:07 2024 -0400
     4.2+++ b/lisp/lib/cli/tests.lisp	Mon Aug 26 20:09:01 2024 -0400
     4.3@@ -225,6 +225,7 @@
     4.4 
     4.5 (defparameter *cli* (make-cli :cli :opts *opts* :cmds *cmds* :description "test cli"))
     4.6 
     4.7+
     4.8 (deftest clap-basic ()
     4.9   "test basic CLAP functionality."
    4.10   (let ((cli *cli*))
    4.11@@ -247,7 +248,7 @@
    4.12 
    4.13 (deftest clap-opts ()
    4.14   "CLAP opt tests."
    4.15-  (is (reduce (lambda (x y) (when x (when y t)))
    4.16+  (is (reduce (lambda (x y) (and x y))
    4.17               (loop for k across *cli-opt-kinds* collect (cli-opt-kind-p k))))
    4.18   (is (parse-thing-opt t))
    4.19   (is (null (parse-thing-opt nil))))
    4.20@@ -673,14 +674,18 @@
    4.21   (is (exec-path-list))
    4.22   (is (find-exe "sbcl")))
    4.23 
    4.24-(deftest clap-ast ())
    4.25+(deftest cli-ast ()
    4.26+  "Validate the CLI/CLAP/AST parser."
    4.27+  (with-cli () *cli*))
    4.28 
    4.29-(compile (defmain (:exit nil :export nil)
    4.30-           (let ((test-target t))
    4.31-             test-target)))
    4.32+(defmain (:exit nil :export nil)
    4.33+  (proc-args *cli* '("--foo 1"))
    4.34+  (with-cli () *cli*
    4.35+    (log:trace! "defmain is OK")
    4.36+    t))
    4.37 
    4.38-(deftest main-output ()
    4.39-  (is (not (funcall 'main))))
    4.40+(deftest clap-main ()
    4.41+  (is (null (funcall #'main))))
    4.42 
    4.43 (deftest sbcl-tools ()
    4.44   (with-sbcl (:noinform t :quit t)