From d83ffcdbb4026203736f6d7d9313ae2901a1cfab Mon Sep 17 00:00:00 2001 From: Daneel Date: Tue, 24 Feb 2026 14:54:17 +0100 Subject: [PATCH] fix(snippets): ADR ID auto-increments from existing entries in file --- snippets/org-mode/adr | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/snippets/org-mode/adr b/snippets/org-mode/adr index fb8043c..2f51e6c 100644 --- a/snippets/org-mode/adr +++ b/snippets/org-mode/adr @@ -2,14 +2,14 @@ # name: ADR - Architectural Decision Record # key: ;adr # -- -| ID | ${1:ADR-0001} | -| Subject | ${2:Title of the decision} | +| ID | `(let ((max-id 0)) (save-excursion (goto-char (point-min)) (while (re-search-forward "| ID\\s-+|\\s-+ADR-\\([0-9]+\\)" nil t) (setq max-id (max max-id (string-to-number (match-string 1)))))) (format "ADR-%04d" (1+ max-id)))` | +| Subject | ${1:Title of the decision} | |----------------------+-------------------------------------------| -| Problem statement | ${3:What is the problem?} | -| Decision | ${4:What was decided?} | -| Alternatives | ${5:What alternatives were considered?} | -| Justification | ${6:Why this decision?} | -| Implications | ${7:What are the implications?} | -| Derived requirements | ${8:What requirements derive from this?} | -| Status | ${9:Proposed} | +| Problem statement | ${2:What is the problem?} | +| Decision | ${3:What was decided?} | +| Alternatives | ${4:What alternatives were considered?} | +| Justification | ${5:Why this decision?} | +| Implications | ${6:What are the implications?} | +| Derived requirements | ${7:What requirements derive from this?} | +| Status | ${8:Proposed} | $0