changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: refactor org-id stuff to ulang, pkgbuild notes

changeset 588: 0552341ac196
parent 587: 7efdeaebaf22
child 589: 16a3cdc06cbc
author: Richard Westhaver <ellis@rwest.io>
date: Mon, 12 Aug 2024 18:32:35 -0400
files: emacs/default.el emacs/lib/publish.el emacs/lib/ulang.el lisp/lib/packy/pkgbuild.lisp
description: refactor org-id stuff to ulang, pkgbuild notes
     1.1--- a/emacs/default.el	Mon Aug 12 16:18:47 2024 -0400
     1.2+++ b/emacs/default.el	Mon Aug 12 18:32:35 2024 -0400
     1.3@@ -1084,8 +1084,8 @@
     1.4 (setq switch-to-buffer-obey-display-actions t)
     1.5 (add-to-list 'display-buffer-alist
     1.6    '("^\\*Dictionary\\*" display-buffer-in-side-window
     1.7-     (side . left)
     1.8-     (window-width . 50)))
     1.9+     (side . right)))
    1.10+
    1.11 
    1.12 ;;; Skel
    1.13 (add-to-load-path user-emacs-lib-directory)
     2.1--- a/emacs/lib/publish.el	Mon Aug 12 16:18:47 2024 -0400
     2.2+++ b/emacs/lib/publish.el	Mon Aug 12 18:32:35 2024 -0400
     2.3@@ -107,40 +107,6 @@
     2.4          :html-preamble ,html-nav
     2.5          :html-postamble ,html-foot)))
     2.6 
     2.7-(defun org-custom-id-get (&optional pom create prefix)
     2.8-  "Get the CUSTOM_ID property of the entry at point-or-marker POM.
     2.9-   If POM is nil, refer to the entry at point. If the entry does
    2.10-   not have an CUSTOM_ID, the function returns nil. However, when
    2.11-   CREATE is non nil, create a CUSTOM_ID if none is present
    2.12-   already. PREFIX will be passed through to `org-id-new'. In any
    2.13-   case, the CUSTOM_ID of the entry is returned."
    2.14-  (interactive)
    2.15-(org-with-point-at pom
    2.16-  (let ((id (org-entry-get nil "CUSTOM_ID"))
    2.17-	;; use CUSTOM_ID for links
    2.18-	(org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id))
    2.19-      (cond
    2.20-       ((and id (stringp id) (string-match "\\S-" id))
    2.21-        id)
    2.22-       (create
    2.23-        (setq id (org-id-new prefix))
    2.24-        (org-entry-put pom "CUSTOM_ID" id)
    2.25-        (org-id-add-location id (buffer-file-name (buffer-base-buffer)))
    2.26-        id)))))
    2.27-
    2.28-;;;###autoload
    2.29-(defun org-id-add-to-headlines-in-file ()
    2.30-  "Add ID properties to all headlines in the
    2.31-   current file which do not already have one."
    2.32-  (interactive)
    2.33-  (org-map-entries (lambda () (org-id-get (point) 'create))))
    2.34-
    2.35-(defun org-custom-id-add-to-headlines-in-file ()
    2.36-  "Add CUSTOM_ID properties to all headlines in the
    2.37-   current file which do not already have one."
    2.38-  (interactive)
    2.39-  (org-map-entries (lambda () (org-custom-id-get (point) 'create))))
    2.40-
    2.41 ;;;###autoload
    2.42 (defun publish (&optional sitemap static force async)
    2.43   "publish `rwest-io' content.
     3.1--- a/emacs/lib/ulang.el	Mon Aug 12 16:18:47 2024 -0400
     3.2+++ b/emacs/lib/ulang.el	Mon Aug 12 18:32:35 2024 -0400
     3.3@@ -67,6 +67,49 @@
     3.4         ("packy" . "https://packy.compiler.company/%s")
     3.5         ("yt" . "https://youtube.com/watch?v=%s")))
     3.6 
     3.7+;;; IDs
     3.8+(defun org-custom-id-get (&optional pom create prefix)
     3.9+  "Get the CUSTOM_ID property of the entry at point-or-marker POM.
    3.10+   If POM is nil, refer to the entry at point. If the entry does
    3.11+   not have an CUSTOM_ID, the function returns nil. However, when
    3.12+   CREATE is non nil, create a CUSTOM_ID if none is present
    3.13+   already. PREFIX will be passed through to `org-id-new'. In any
    3.14+   case, the CUSTOM_ID of the entry is returned."
    3.15+  (interactive)
    3.16+(org-with-point-at pom
    3.17+  (let ((id (org-entry-get nil "CUSTOM_ID"))
    3.18+        ;; use CUSTOM_ID for links
    3.19+        (org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id))
    3.20+      (cond
    3.21+       ((and id (stringp id) (string-match "\\S-" id))
    3.22+        id)
    3.23+       (create
    3.24+        (setq id (org-id-new prefix))
    3.25+        (org-entry-put pom "CUSTOM_ID" id)
    3.26+        (org-id-add-location id (buffer-file-name (buffer-base-buffer)))
    3.27+        id)))))
    3.28+
    3.29+;;;###autoload
    3.30+(defun org-id-add-to-headlines-in-file ()
    3.31+  "Add ID properties to all headlines in the
    3.32+   current file which do not already have one."
    3.33+  (interactive)
    3.34+  (org-map-entries (lambda () (org-id-get (point) 'create))))
    3.35+
    3.36+(defun org-custom-id-add-to-headlines-in-file ()
    3.37+  "Add CUSTOM_ID properties to all headlines in the
    3.38+   current file which do not already have one."
    3.39+  (interactive)
    3.40+  (org-map-entries (lambda () (org-custom-id-get (point) 'create))))
    3.41+
    3.42+(defun org-id-add-to-headlines-in-agenda-files ()
    3.43+  (interactive)
    3.44+  (with-temp-buffer
    3.45+    (dolist (f org-agenda-files)
    3.46+      (find-file f)
    3.47+      (org-id-add-to-headlines-in-file)
    3.48+      (save-buffer))))
    3.49+
    3.50 (message "Initialized ULANG.")
    3.51 
    3.52 (provide 'ulang)
     4.1--- a/lisp/lib/packy/pkgbuild.lisp	Mon Aug 12 16:18:47 2024 -0400
     4.2+++ b/lisp/lib/packy/pkgbuild.lisp	Mon Aug 12 18:32:35 2024 -0400
     4.3@@ -22,3 +22,13 @@
     4.4 (defmethod check-package ((self pkgbuild)))
     4.5 (defmethod package-version ((self pkgbuild)))
     4.6 (defmethod pack ((self pkgbuild)))
     4.7+
     4.8+;;; Hooks
     4.9+
    4.10+;; pre_install, post_install
    4.11+
    4.12+;; pre_upgrade, post_upgrade
    4.13+
    4.14+;; pre_remove, post_remove
    4.15+
    4.16+;;; Meta-packages