From d6ffd2bfaa47b9e5b2da32b2b70c842feb8c4499 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 3 Aug 2022 14:07:03 +0200 Subject: [PATCH] fix(file-templates): update doom doc templates To reflect the new mode: line added in 7e400ab, and add an ID property. Also corrects heading level in __doom-readme file template. Ref: 7e400abdc00e --- lisp/lib/docs.el | 15 +++++++++++++++ .../templates/org-mode/__doom-category-readme | 4 ++++ .../file-templates/templates/org-mode/__doom-docs | 4 ++++ .../templates/org-mode/__doom-readme | 12 ++++++++---- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/lisp/lib/docs.el b/lisp/lib/docs.el index 7cb9bcaf6..3fc0bce3f 100644 --- a/lisp/lib/docs.el +++ b/lisp/lib/docs.el @@ -352,6 +352,21 @@ This primes `org-mode' for reading." ("doom-suggest-faq" . "id:aa28b732-0512-49ed-a47b-f20586c0f051") ("github" . "https://github.com/%s"))) +;;;###autoload +(defun doom-docs-generate-id (&optional force?) + "Generate an ID for a `doom-docs-org-mode' buffer." + (let ((org-id-link-to-org-use-id t) + (org-id-method 'uuid) + (org-id-track-globally t) + (org-id-locations-file (doom-path doom-cache-dir "doom-docs-org-ids")) + (org-id-locations doom-docs--id-locations) + (org-id-files doom-docs--id-files)) + (doom/reload-docs) + (let ((id (org-id-new))) + (org-id-add-location + id (buffer-file-name (buffer-base-buffer))) + id))) + ;;;###autoload (define-derived-mode doom-docs-org-mode org-mode "Doom Docs" "A derivative of `org-mode' for Doom's documentation files. diff --git a/modules/editor/file-templates/templates/org-mode/__doom-category-readme b/modules/editor/file-templates/templates/org-mode/__doom-category-readme index 570651045..ffc707dd0 100644 --- a/modules/editor/file-templates/templates/org-mode/__doom-category-readme +++ b/modules/editor/file-templates/templates/org-mode/__doom-category-readme @@ -1,6 +1,10 @@ # -*- mode: snippet -*- # name: Doom category readme # -- +# -*- mode: doom-docs-org -*- +:PROPERTIES: +:ID: `(doom-docs-generate-id)` +:END: #+title: `(+file-templates-module-for-path)` #+created: `(format-time-string "%B %d, %Y")` #+since: `(car (split-string doom-version "-"))` diff --git a/modules/editor/file-templates/templates/org-mode/__doom-docs b/modules/editor/file-templates/templates/org-mode/__doom-docs index b1fefa52c..b426e98d3 100644 --- a/modules/editor/file-templates/templates/org-mode/__doom-docs +++ b/modules/editor/file-templates/templates/org-mode/__doom-docs @@ -1,6 +1,10 @@ # -*- mode: snippet -*- # name: Doom documentation # -- +# -*- mode: doom-docs-org -*- +:PROPERTIES: +:ID: `(doom-docs-generate-id)` +:END: #+title: ${1:Title} #+subtitle: ${2:Subtitle} diff --git a/modules/editor/file-templates/templates/org-mode/__doom-readme b/modules/editor/file-templates/templates/org-mode/__doom-readme index 10c49ef26..d0e3db1f2 100644 --- a/modules/editor/file-templates/templates/org-mode/__doom-readme +++ b/modules/editor/file-templates/templates/org-mode/__doom-readme @@ -1,6 +1,10 @@ # -*- mode: snippet -*- # name: Doom module readme # -- +# -*- mode: doom-docs-org -*- +:PROPERTIES: +:ID: `(doom-docs-generate-id)` +:END: #+title: `(+file-templates-module-for-path)` #+subtitle: #+created: `(format-time-string "%B %d, %Y")` @@ -90,12 +94,12 @@ the purpose of the module and the features/technology(ies) it provides. # # ALSO: Version headings should be linked to the respective heading in # docs/changelog.org. -** [[doom-tag:][v21.12.0]] [2021-12-30] -*** [[doom-ref:a1b2c3d4][commit SUBJECT linked to github commit]] +*** [[doom-tag:][v21.12.0]] [2021-12-30] +**** [[doom-ref:a1b2c3d4][commit SUBJECT linked to github commit]] commit BODY -*** [[doom-ref:a1b2c3d4][commit SUBJECT linked to github commit]] +**** [[doom-ref:a1b2c3d4][commit SUBJECT linked to github commit]] commit BODY -*** [[doom-ref:a1b2c3d4][commit SUBJECT linked to github commit]] +**** [[doom-ref:a1b2c3d4][commit SUBJECT linked to github commit]] commit BODY # If no changelog is available, use: