changeset 623: |
a304c9713a51 |
parent: |
35a579313b80
|
child: |
cc13027df6fa |
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Sun, 25 Aug 2024 00:14:17 -0400 |
permissions: |
-rw-r--r-- |
description: |
init graph.el |
1 ;;; ulang.el --- ulang compliance lib -*- lexical-binding:t -*- 8 ;; This program is free software; you can redistribute it and/or modify 9 ;; it under the terms of the GNU General Public License as published by 10 ;; the Free Software Foundation, either version 3 of the License, or 11 ;; (at your option) any later version. 13 ;; This program is distributed in the hope that it will be useful, 14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 ;; GNU General Public License for more details. 18 ;; You should have received a copy of the GNU General Public License 19 ;; along with this program. If not, see <https://www.gnu.org/licenses/>. 31 "CC Universal Language.") 33 (defvar ulang-link-history nil) 34 (defvar ulang-file-history nil) 37 (defun dblock-insert-links (regexp) 38 "Create dblock to insert links matching REGEXP." 39 (interactive (list (read-regexp "Insert links matching: " nil ulang-links-history))) 40 (org-create-dblock (list :name "links" 45 (org-dynamic-block-define "links" 'dblock-insert-links) 47 (org-export-translate-to-lang (list '("Table of Contents" "Index")) "ulang") 48 ;; (setq org-export-global-macros nil) 51 (setq org-stuck-projects '("+PROJECT/-DONE" ("NEXT") nil "")) 53 (setq org-todo-keywords 54 '((type "TBD(0!)" "TODO(t!)" "|") 56 (type "HOLD(H@!)" "WAIT(/j@!)" "|") 57 (sequence "FIND(q!)" "READ(r@!)" "WATCH(A@!)" "|") 58 (sequence "RESEARCH(s!)" "RECORD(e!)" "WRITE(W!)" "|") 59 (sequence "OUTLINE(O!)" "DRAFT(M!)" "REVIEW(V!)" "|") 60 (type "FIXME(i!)" "TEST(T!)" "BENCH(b!)" "DEPLOY(D!)" "RUN(X!)" "LOG(L!)" "GOTO(g!)" "|") 61 (type "HACK(h!)" "CODE(c!)" "|") 62 (type "NOTE(n!)" "LINK(l!)") 63 (type "PROJECT(p!)" "PRODUCT(P!)" "SPRINT(S!)" "RELEASE(R!)" "|") 64 (sequence "|" "DONE(d!)" "NOPE(x@!)" "FOUND(f@!)" "FIXED(F!)"))) 66 (setq org-todo-keyword-faces 67 '(("PROJECT" . (:foreground "lightseagreen" :weight bold)) 68 ("PRODUCT" . (:foreground "olivedrab" :weight bold)) 69 ("RELEASE" . (:foreground "maroon3" :weight bold)) 70 ("RESEARCH" . (:foreground "maroon2" :weight bold)) 71 ("HACK" . (:foreground "maroon3" :weight bold)) 72 ("TBD" . (:foreground "darkred2" :weight bold)) 73 ("NOTE" . (:foreground "tomato2" :weight bold)) 74 ("CODE" . (:foreground "bisque" :weight bold :background "midnightblue")) 75 ("HOLD" . (:foreground "red1" :weight bold :background "yellow1")) 76 ("WAIT" . (:foreground "red4" :weight bold :background "yellow1")) 77 ("WIP" . (:foreground "darkorchid2" :weight bold)) 78 ("NOPE" . (:foreground "hotpink" :weight bold :background "darkgreen")))) 81 (setq org-link-abbrev-alist 82 '(("vc" . "https://vc.compiler.company/%s") 83 ("comp" . "https://compiler.company/%s") 84 ("cdn" . "https://cdn.compiler.company/%s") 85 ("packy" . "https://packy.compiler.company/%s") 86 ("yt" . "https://youtube.com/watch?v=%s") 87 ("wikipedia" . "https://en.wikipedia.org/wiki/%s") 88 ("reddit" . "https://reddit.com/%s") 89 ("hn" . "https://news.ycombinator.com/%s") 90 ("so" . "https://stackoverflow.com/%s"))) 93 (defun org-custom-id-get (&optional pom create prefix) 94 "Get the CUSTOM_ID property of the entry at point-or-marker POM. 95 If POM is nil, refer to the entry at point. If the entry does 96 not have an CUSTOM_ID, the function returns nil. However, when 97 CREATE is non nil, create a CUSTOM_ID if none is present 98 already. PREFIX will be passed through to `org-id-new'. In any 99 case, the CUSTOM_ID of the entry is returned." 101 (org-with-point-at pom 102 (let ((id (org-entry-get nil "CUSTOM_ID")) 103 ;; use CUSTOM_ID for links 104 (org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)) 106 ((and id (stringp id) (string-match "\\S-" id)) 109 (setq id (org-id-new prefix)) 110 (org-entry-put pom "CUSTOM_ID" id) 111 (org-id-add-location id (buffer-file-name (buffer-base-buffer))) 115 (defun org-id-add-to-headlines-in-file () 116 "Add ID properties to all headlines in the 117 current file which do not already have one." 119 (org-map-entries (lambda () (org-id-get (point) 'create)))) 121 (defun org-custom-id-add-to-headlines-in-file () 122 "Add CUSTOM_ID properties to all headlines in the 123 current file which do not already have one." 125 (org-map-entries (lambda () (org-custom-id-get (point) 'create)))) 127 (defun org-id-add-to-headlines-in-files (&optional files) 130 (dolist (f (or files org-agenda-files)) 132 (org-id-add-to-headlines-in-file) 135 (defun org-id-add-to-headlines-in-directory (&optional dir) 137 (let ((dir (or dir org-directory))) 138 (org-id-add-to-headlines-in-files 139 (directory-files-recursively dir "[.]org$")))) 141 (message "Initialized ULANG.") 144 ;;; ulang.el ends here