From 990cc577dce2dc88f90e28e9aee4ee2e0afeb69b Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Tue, 1 Oct 2024 15:11:31 -0700 Subject: [PATCH] Fix annoying bug of possible multiple inserts Now the sprint and inserts are better. --- ha-config.org | 8 +++-- ha-org-sprint.org | 2 +- snippets/org-mode/__sprint | 52 --------------------------------- snippets/org-mode/example-block | 7 ----- snippets/org-mode/quote-block | 7 ----- 5 files changed, 6 insertions(+), 70 deletions(-) delete mode 100644 snippets/org-mode/__sprint delete mode 100644 snippets/org-mode/example-block delete mode 100644 snippets/org-mode/quote-block diff --git a/ha-config.org b/ha-config.org index 46e8647..46c8922 100644 --- a/ha-config.org +++ b/ha-config.org @@ -523,9 +523,11 @@ And since I'll be associating snippets with new files all over my configuration, "Autofill file buffer matching FILENAME-RE regular expression. The contents inserted from the YAS SNIPPET-NAME." ;; The define-auto-insert takes a regular expression and an ACTION: - ;; ACTION may also be a vector containing successive single actions. - (define-auto-insert filename-re - (vector snippet-name 'ha-autoinsert-yas-expand))) + ;; ACTION may also be a vector containing _successive_ single actions. + ;; This means running this twice results in two repeated expansions, so: + (unless (assoc filename-re auto-insert-alist 'equal) + (define-auto-insert filename-re + (vector snippet-name 'ha-autoinsert-yas-expand)))) #+end_src As an example of its use, any Org files loaded in /this project/ should insert my config file: diff --git a/ha-org-sprint.org b/ha-org-sprint.org index 37c7a7d..fcec006 100644 --- a/ha-org-sprint.org +++ b/ha-org-sprint.org @@ -30,7 +30,7 @@ At the beginning of each Sprint, I create a new org file dedicated to it. This w I want a single keybinding that always displays the current Sprint note file, regardless of the Sprint. This means, I need to have functions that can calculate what this is. -To have the Org Capture features to be able to write to correct locations in the current file, I need each file to follow a particular format. I create a [[file:snippets/org-mode/__sprint.org][sprint note template]] that will be automatically expanded with a new sprint. +To have the Org Capture features to be able to write to correct locations in the current file, I need each file to follow a particular format. I create a [[file:templates/sprint.org][sprint note template]] that will be automatically expanded with a new sprint. This template needs the following functions: - =sprint-current-name= to be both the numeric label as well as the nickname diff --git a/snippets/org-mode/__sprint b/snippets/org-mode/__sprint deleted file mode 100644 index 924c795..0000000 --- a/snippets/org-mode/__sprint +++ /dev/null @@ -1,52 +0,0 @@ -# -*- mode: snippet -*- -# name: sprint -# key: __sprint -# -- -#+TITLE: `(sprint-current-name)` -#+AUTHOR: `user-full-name` -#+EMAIL: `user-mail-address` -#+DATE: `(sprint-date-range)` -#+CATEGORY: sprint -#+FILETAGS: :work: - -* Work Issues -$0 - -* Onboarding Work -See [[file:Onboarding-Work.org][Onboard-Work]] for all details. - -* Distractions and Support -Anything that doesn't fit the above goes here. - -* Meeting Notes :meeting: -* Scrum Status :status: - -* Sprint Demonstration -New approach for giving presentations. First create [[file:`(file-name-sans-extension (buffer-name))`-demo.org][`(file-name-sans-extension (buffer-name))`-demo.org]], and then add the bits to the code below. - -#+BEGIN_SRC emacs-lisp :results silent - (defun org-present-file (filename) - (find-file (filename)) - (delete-other-windows) - (org-present)) - - (demo-it-create :advanced-mode :single-window - (org-present-file "`(file-name-sans-extension (buffer-name))`-demo.org") - (org-present-next) - (osx-browse-url-forwork "https://...") - (demo-it-load-fancy-file "~/work/wpc4/wpc/dashboards/wpc4/hypervisor.yml" :line 116 133) - ;; ... - ) -#+END_SRC - -Have fun and start the show: =demo-it-start= and hit ~F5~. -* Notes for Next Sprint - - -#+DESCRIPTION: Notes taken during Sprint #`(sprint-number)` -#+PROPERTY: header-args: :results drawer :tangle no :eval no-export :comments org -#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil skip:nil author:nil email:nil creator:nil timestamp:nil ^:nil - -# Local Variables: -# eval: (org-content 2) -# End: diff --git a/snippets/org-mode/example-block b/snippets/org-mode/example-block deleted file mode 100644 index f2b9b6b..0000000 --- a/snippets/org-mode/example-block +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: example-block -# key: