changeset 642: |
f58f3b88c49e |
parent 641: |
48bcbca019e6 |
child 643: |
f901de70a80e |
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Sun, 08 Sep 2024 21:14:30 -0400 |
files: |
emacs/lib/inbox.el emacs/lib/scrum.el |
description: |
move project-info to scrum |
1.1--- a/emacs/lib/inbox.el Sun Sep 08 20:11:35 2024 -0400
1.2+++ b/emacs/lib/inbox.el Sun Sep 08 21:14:30 2024 -0400
1.3@@ -203,87 +203,6 @@
1.4 (defun org-summary ()
1.5 "Insert or update a summary section.")
1.6
1.7-;; project-info
1.8-(defcustom org-project-info-order '(details status churn log files)
1.9- "Order in which sections of the 'project-info' dblock will appear."
1.10- :type 'list
1.11- :group 'inbox)
1.12-
1.13-(defun org-dblock-write:project-info (params)
1.14- "Generate a project-info section.
1.15-
1.16-The following keyword parameters can be passed to the info dynamic block:
1.17-
1.18-:location Set or override the project location which is inferred by
1.19- checking for a LOCATION property in the current tree, followed
1.20- by the value of the `project-current' function.
1.21-
1.22-:branch Set or override the project branch to display info for. Default
1.23- branch name is 'default'.
1.24-
1.25-:files When nil don't include the files table.
1.26-:churn When nil don't include the vc churn report.
1.27-:log when nil don't include the vc log.
1.28-:status when nil don't include vc status.
1.29-:details When nil don't include the project details section."
1.30- (let ((location (or (when-let ((param (plist-get params :location)))
1.31- (cl-coerce param 'string))
1.32- (org-entry-get (point) "LOCATION")
1.33- (when-let ((kw (org-collect-keywords '("LOCATION"))))
1.34- (cadar kw))
1.35- (project-root (project-current))))
1.36- (point (point))
1.37- (files (if-let ((val (plist-member params :files)))
1.38- (cadr val)
1.39- t))
1.40- (churn (if-let ((val (plist-member params :churn)))
1.41- (cadr val)
1.42- t))
1.43- (status (if-let ((val (plist-member params :log)))
1.44- (cadr val)
1.45- t))
1.46- (log (if-let ((val (plist-member params :status)))
1.47- (cadr val)
1.48- t))
1.49- (details (if-let ((val (plist-member params :details)))
1.50- (cadr val)
1.51- t)))
1.52- (message "Generating info for project: %s" location)
1.53- (let* ((project (project-current nil location))
1.54- (project-name (project-name project))
1.55- (project-root (project-root project)))
1.56- (dolist (i org-project-info-order)
1.57- (pcase i
1.58- ('details (when details
1.59- (message "building project details...")
1.60- (insert "#+CALL: project-details() :dir " project-root "\n")
1.61- (org-babel-execute-maybe)
1.62- (org-table-align)))
1.63- ('status (when status
1.64- (message "building project status...")
1.65- (insert "#+CALL: hg-status() :dir " project-root "\n")))
1.66- ('churn (when churn
1.67- (message "building project vc churn...")
1.68- (insert "#+CALL: hg-churn() :dir " project-root "\n")))
1.69- ('log (when log
1.70- (message "building project vc log...")))
1.71- ('files (when files
1.72- (message "building project file table...")
1.73- (insert "#+CALL: project-files() :dir " project-root "\n")))))
1.74- (org-babel-execute-region point (point)))))
1.75-
1.76-(defun org-project-info ()
1.77- "Insert or update a project-info dblock."
1.78- (interactive)
1.79- (if (re-search-forward (rx bol "#+BEGIN:" (+ space) "project-info") nil t)
1.80- (progn
1.81- (if (fboundp 'org-fold-show-entry)
1.82- (org-fold-show-entry)
1.83- (with-no-warnings (org-show-entry)))
1.84- (beginning-of-line))
1.85- (org-create-dblock (list :name "project-info")))
1.86- (org-update-dblock))
1.87-
1.88 (defun org-inbox-configure-dblock ()
1.89 "Configure the current org-inbox-dblock at point."
1.90 (interactive)
2.1--- a/emacs/lib/scrum.el Sun Sep 08 20:11:35 2024 -0400
2.2+++ b/emacs/lib/scrum.el Sun Sep 08 21:14:30 2024 -0400
2.3@@ -68,5 +68,102 @@
2.4 (defun org-dblock-write:burndown ()
2.5 "Generate a 'burndown' chart in the current buffer.")
2.6
2.7+;;; Projects
2.8+;; defining 'project' machinery here because we don't have a better
2.9+;; place to put it. These functions are intended to map projects
2.10+;; from 'skel' and 'project.el' into our task-based org system.
2.11+
2.12+;; Projects can contain many subprojects, which are identified by org
2.13+;; headings with a 'PROJECT' todo keyword. Projects and sub-projects
2.14+;; all have a 'VERSION' property assigned which can't be
2.15+;; inherited. The 'PROJECT' property itself can be inherited.
2.16+
2.17+;; project-info
2.18+(defcustom org-project-info-order '(details status tasks churn log files)
2.19+ "Order in which sections of the 'project-info' dblock will appear."
2.20+ :type 'list
2.21+ :group 'scrum)
2.22+
2.23+(defun org-dblock-write:project-info (params)
2.24+ "Generate a project-info section.
2.25+
2.26+The following keyword parameters can be passed to the info dynamic block:
2.27+
2.28+:location Set or override the project location which is inferred by
2.29+ checking for a LOCATION property in the current tree, followed
2.30+ by the value of the `project-current' function.
2.31+
2.32+:branch Set or override the project branch to display info for. Default
2.33+ branch name is 'default'.
2.34+
2.35+:files When nil don't include the files table.
2.36+:churn When nil don't include the vc churn report.
2.37+:log when nil don't include the vc log.
2.38+:status when nil don't include vc status.
2.39+:details When nil don't include the project details section."
2.40+ (let ((location (or (when-let ((param (plist-get params :location)))
2.41+ (cl-coerce param 'string))
2.42+ (org-entry-get (point) "LOCATION")
2.43+ (when-let ((kw (org-collect-keywords '("LOCATION"))))
2.44+ (cadar kw))
2.45+ (project-root (project-current))))
2.46+ (point (point))
2.47+ (files (if-let ((val (plist-member params :files)))
2.48+ (cadr val)
2.49+ t))
2.50+ (churn (if-let ((val (plist-member params :churn)))
2.51+ (cadr val)
2.52+ t))
2.53+ (status (if-let ((val (plist-member params :log)))
2.54+ (cadr val)
2.55+ t))
2.56+ (log (if-let ((val (plist-member params :status)))
2.57+ (cadr val)
2.58+ t))
2.59+ (tasks (if-let ((val (plist-member params :tasks)))
2.60+ (cadr val)
2.61+ t))
2.62+ (details (if-let ((val (plist-member params :details)))
2.63+ (cadr val)
2.64+ t)))
2.65+ (message "Generating info for project: %s" location)
2.66+ (let* ((project (project-current nil location))
2.67+ (project-name (project-name project))
2.68+ (project-root (project-root project)))
2.69+ (dolist (i org-project-info-order)
2.70+ (pcase i
2.71+ ('details (when details
2.72+ (message "building project details...")
2.73+ (insert "#+CALL: project-details() :dir " project-root "\n")
2.74+ (org-babel-execute-maybe)
2.75+ (org-table-align)))
2.76+ ('status (when status
2.77+ (message "building project status...")
2.78+ (insert "#+CALL: hg-status() :dir " project-root "\n")))
2.79+ ('tasks (when tasks
2.80+ (message "building project tasks...")
2.81+ (insert "#+CALL: project-tasks() :dir " project-root "\n")))
2.82+ ('churn (when churn
2.83+ (message "building project vc churn...")
2.84+ (insert "#+CALL: hg-churn() :dir " project-root "\n")))
2.85+ ('log (when log
2.86+ (message "building project vc log...")))
2.87+ ('files (when files
2.88+ (message "building project file table...")
2.89+ (insert "#+CALL: project-files() :dir " project-root "\n")))))
2.90+ (org-babel-execute-region point (point)))))
2.91+
2.92+(defun org-project-info ()
2.93+ "Insert or update a project-info dblock."
2.94+ (interactive)
2.95+ (if (re-search-forward (rx bol "#+BEGIN:" (+ space) "project-info") nil t)
2.96+ (progn
2.97+ (if (fboundp 'org-fold-show-entry)
2.98+ (org-fold-show-entry)
2.99+ (with-no-warnings (org-show-entry)))
2.100+ (beginning-of-line))
2.101+ (org-create-dblock (list :name "project-info")))
2.102+ (org-update-dblock))
2.103+
2.104 (provide 'scrum)
2.105 ;;; scrum.el ends here