Automatically mark the todo as done when updating data

This commit is contained in:
Bram Schoenmakers 2022-11-26 07:52:00 +01:00
parent 30b4459712
commit a73bc5b1a2
2 changed files with 16 additions and 8 deletions

View file

@ -54,14 +54,18 @@ Put this in ~/.termux/termux.properties for a better Emacs experience inside Ter
A small org file to keep track of some metric in a table, see [[https://orgmode.org/manual/Results-of-Evaluation.html][Results of Evaluation]] in the Org mode manual for more information.
In this case, count the number of packages in my Emacs init file.
In this case, count the number of packages in my Emacs init file. The code will automatically mark the task as DONE (thanks to [[https://emacs.ch/@leadore@toot.cafe/109406486013699362][@leadore@toot.cafe]]).
Press =C-c C-c= inside the code block to add a new entry to the table below.
,#+begin_src elisp :results table append
(with-temp-buffer
(insert-file-contents user-init-file)
(list (format-time-string "%F") (count-matches "(use-package ")))
(save-excursion
(org-back-to-heading t)
(org-todo "DONE")
(with-temp-buffer
(insert-file-contents user-init-file)
(list (format-time-string "%F") (count-matches "(use-package "))))
,#+end_src
,#+RESULTS:

View file

@ -3,14 +3,18 @@ DEADLINE: <2022-11-25 Fri .+1m>
A small org file to keep track of some metric in a table, see [[https://orgmode.org/manual/Results-of-Evaluation.html][Results of Evaluation]] in the Org mode manual for more information.
In this case, count the number of packages in my Emacs init file.
In this case, count the number of packages in my Emacs init file. The code will automatically mark the task as DONE.
Press =C-c C-c= inside the code block to add a new entry to the table below.
#+begin_src elisp :results table append
(with-temp-buffer
(insert-file-contents user-init-file)
(list (format-time-string "%F") (count-matches "(use-package ")))
(save-excursion
(org-back-to-heading t)
(org-todo "DONE")
(with-temp-buffer
(insert-file-contents user-init-file)
(list (format-time-string "%F") (count-matches "(use-package "))))
#+end_src
#+RESULTS: