changeset 596: |
46e9425cf3c2 |
parent: |
0552341ac196
|
child: |
74a55d5decce |
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Thu, 15 Aug 2024 21:54:36 -0400 |
permissions: |
-rw-r--r-- |
description: |
howd that get there |
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/>. 24 ;; (setq org-export-global-macros nil) 30 (defvar ulang-links-history nil) 31 (defvar ulang-files-history nil) 34 (defun ulang-dblock-insert-links (regexp) 35 "Create dblock to insert links matching REGEXP." 36 (interactive (list (read-regexp "Insert links matching: " nil ulang-links-history))) 37 (org-create-dblock (list :name "links" 42 (org-dynamic-block-define "links" 'ulang-dblock-insert-links) 44 (org-export-translate-to-lang (list '("Table of Contents" "Index")) "ulang") 46 (setq org-todo-keywords 47 '((type "TBD(0!)" "TODO(t!)" "|") 49 (type "HOLD(H@!)" "WAIT(/j@!)" "|") 50 (sequence "FIND(q!)" "READ(r@!)" "WATCH(W@!)" "|") 51 (sequence "RESEARCH(s!)" "RECORD(e!)" "|") 52 (sequence "OUTLINE(O!)" "RESEARCH(A!)" "DRAFT(M!)" "REVIEW(V!)" "|") 53 (type "FIXME(i!)" "TEST(t!)" "BENCH(b!)" "DEPLOY(D!)" "RUN(X!)" "LOG(L!)" "|") 54 (type "KLUDGE(k@!)" "HACK(h!)" "NOTE(n!)" "CODE(c!)" "LINK(l!)" "|") 55 (type "PROJECT(p!)" "PRODUCT(P!)" "SPRINT(S!)" "RELEASE(R!)" "|") 57 (sequence "|" "DONE(d!)" "NOPE(x@!)" "FOUND(f@!)" "FIXED(F!)"))) 59 (setq org-todo-keyword-faces 60 '(("PROJECT" . (:foreground "lightseagreen" :weight bold)) 61 ("PRODUCT" . (:foreground "olivedrab" :weight bold)) 62 ("RELEASE" . (:foreground "maroon3" :weight bold)) 63 ("RESEARCH" . (:foreground "maroon2" :weight bold)) 64 ("HACK" . (:foreground "maroon3" :weight bold)) 65 ("TBD" . (:foreground "darkred2" :weight bold)) 66 ("NOTE" . (:foreground "tomato2" :weight bold)) 67 ("CODE" . (:foreground "bisque" :weight bold :background "midnightblue")) 68 ("HOLD" . (:foreground "red1" :weight bold :background "yellow1")) 69 ("WAIT" . (:foreground "red4" :weight bold :background "yellow1")) 70 ("WIP" . (:foreground "darkorchid2" :weight bold)) 71 ("NOPE" . (:foreground "hotpink" :weight bold :background "darkgreen")))) 73 (setq org-link-abbrev-alist 74 '(("vc" . "https://vc.compiler.company/%s") 75 ("comp" . "https://compiler.company/%s") 76 ("cdn" . "https://cdn.compiler.company/%s") 77 ("packy" . "https://packy.compiler.company/%s") 78 ("yt" . "https://youtube.com/watch?v=%s") 79 ("wikipedia" . "https://en.wikipedia.org/wiki/%s") 80 ("reddit" . "https://reddit.com/%s") 81 ("hn" . "https://news.ycombinator.com/%s") 82 ("so" . "https://stackoverflow.com/%s"))) 85 (defun org-custom-id-get (&optional pom create prefix) 86 "Get the CUSTOM_ID property of the entry at point-or-marker POM. 87 If POM is nil, refer to the entry at point. If the entry does 88 not have an CUSTOM_ID, the function returns nil. However, when 89 CREATE is non nil, create a CUSTOM_ID if none is present 90 already. PREFIX will be passed through to `org-id-new'. In any 91 case, the CUSTOM_ID of the entry is returned." 93 (org-with-point-at pom 94 (let ((id (org-entry-get nil "CUSTOM_ID")) 95 ;; use CUSTOM_ID for links 96 (org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)) 98 ((and id (stringp id) (string-match "\\S-" id)) 101 (setq id (org-id-new prefix)) 102 (org-entry-put pom "CUSTOM_ID" id) 103 (org-id-add-location id (buffer-file-name (buffer-base-buffer))) 107 (defun org-id-add-to-headlines-in-file () 108 "Add ID properties to all headlines in the 109 current file which do not already have one." 111 (org-map-entries (lambda () (org-id-get (point) 'create)))) 113 (defun org-custom-id-add-to-headlines-in-file () 114 "Add CUSTOM_ID properties to all headlines in the 115 current file which do not already have one." 117 (org-map-entries (lambda () (org-custom-id-get (point) 'create)))) 119 (defun org-id-add-to-headlines-in-agenda-files () 122 (dolist (f org-agenda-files) 124 (org-id-add-to-headlines-in-file) 127 (message "Initialized ULANG.") 130 ;;; ulang.el ends here