changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: org-project-info dblock update

changeset 641: 48bcbca019e6
parent 640: 642b3b82b20d
child 642: f58f3b88c49e
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 08 Sep 2024 20:11:35 -0400
files: emacs/lib/inbox.el emacs/lib/ulang.el
description: org-project-info dblock update
     1.1--- a/emacs/lib/inbox.el	Sun Sep 08 17:35:03 2024 -0400
     1.2+++ b/emacs/lib/inbox.el	Sun Sep 08 20:11:35 2024 -0400
     1.3@@ -269,12 +269,20 @@
     1.4                   (message "building project vc log...")))
     1.5           ('files (when files
     1.6                     (message "building project file table...")
     1.7-                    (insert "#+CALL: files() :dir " project-root "\n")))))
     1.8+                    (insert "#+CALL: project-files() :dir " project-root "\n")))))
     1.9       (org-babel-execute-region point (point)))))
    1.10 
    1.11 (defun org-project-info ()
    1.12   "Insert or update a project-info dblock."
    1.13-  (interactive))
    1.14+  (interactive)
    1.15+  (if (re-search-forward (rx bol "#+BEGIN:" (+ space) "project-info") nil t)
    1.16+      (progn
    1.17+        (if (fboundp 'org-fold-show-entry)
    1.18+            (org-fold-show-entry)
    1.19+          (with-no-warnings (org-show-entry)))
    1.20+        (beginning-of-line))        
    1.21+    (org-create-dblock (list :name "project-info")))
    1.22+  (org-update-dblock))
    1.23 
    1.24 (defun org-inbox-configure-dblock ()
    1.25   "Configure the current org-inbox-dblock at point."
     2.1--- a/emacs/lib/ulang.el	Sun Sep 08 17:35:03 2024 -0400
     2.2+++ b/emacs/lib/ulang.el	Sun Sep 08 20:11:35 2024 -0400
     2.3@@ -157,17 +157,28 @@
     2.4 For example, a PROPERTY value of 'LOCATION' would check all property
     2.5 values in addition to the keyword '#+LOCATION:'."
     2.6   (interactive (list nil nil))
     2.7-  (let ((property (or property (org-read-property-name))))
     2.8-    ;; most of the work passed through to the property handler
     2.9-    (org-entry-get-with-inheritance property literal-nil epom)))
    2.10+  (let* ((property (or property (org-read-property-name)))
    2.11+         (kw (when-let ((val (org-collect-keywords '("LOCATION") nil)))
    2.12+               (cadar val)))
    2.13+         ;; most of the work passed through to the property handler
    2.14+         (props (org-entry-get-with-inheritance property literal-nil epom)))
    2.15+    (if kw
    2.16+        (append (list kw) (if (listp props) props (list props)))
    2.17+      props)))
    2.18 
    2.19 (defun org-get-location (point)
    2.20   "Get the value of property LOCATION at POINT."
    2.21   (interactive "d")
    2.22-  (org-with-point-at point
    2.23-    (message "%s" (or (when-let ((prop (org-entry-get-with-inheritance "LOCATION")))
    2.24-                        (apply 'join-paths (string-split prop " ")))
    2.25-                      (caadar (org-collect-keywords '("LOCATION") nil '("LOCATION")))))))
    2.26+  (let ((path (org-get-with-inheritance "LOCATION" nil point)))
    2.27+    ;; when the second path component is an absolute path, skip the first
    2.28+    (when (and (< 1 (length path)) (file-name-absolute-p (print (cadr path))))
    2.29+      (setq path (cdr path)))
    2.30+    (message "%s"
    2.31+             (apply 'join-paths
    2.32+                    (flatten
    2.33+                     (mapcar
    2.34+                      (lambda (x) (split-string x " "))
    2.35+                      path))))))
    2.36 
    2.37 (defun org-set-location (value)
    2.38   "Set the value of property LOCATION. If point is before first heading