It is so easy to overestimate the importance of one defining moment and underestimate the value of making small improvements on a daily basis. Too often, we convince ourselves that massive success requires massive action. Whether it is losing weight, building a business, writing a book, winning a championship, or achieving any other goal, we put pressure on ourselves to make some earth-shattering improvement that everyone will talk about.
- Clear, J. (2018). Atomic habits: an easy & proven way to build good habits & break bad ones. : Penguin.
Sorry, I do not know how to write it into single script installation. It needs manually installation. The user is expected to know how to setup a `.dir-locals.el` file to make it run.
(add-to-list 'load-path "~/.emacs.d/nyan-mode")
(require 'tweak-nyan-mode)
(define-minor-mode wr-org-roam-mode
"Show today and yesterday's efforts on mode-line"
:init-value nil
:lighter " wr-roam"
:group 'wr-roam)
(defcustom wr-org-roam-mode-hook nil
"Mode hook for my tweak mode run after the mode was turned on."
:group 'wr-roam
:type 'hook)
(defcustom my-org-roam-dir-local-flag nil
"enable wr-org-roam-mode-hook only in zk folder"
:group 'wr-roam
:type '(boolean))
(defun external-script-to-write-today-effort ()
"data written into a file"
(shell-command-to-string "sh ~/Dropbox/myNote/zk/output/count-today-effort.sh"))
(defun wr/org-roam-notes-today-effort-update ()
"Update the LAST_MODIFIED file property in the preamble."
(when my-org-roam-dir-local-flag
(external-script-to-write-today-effort)))
(add-hook 'org-mode-hook 'wr-org-roam-mode)
(add-hook 'org-roam-mode-hook 'wr-org-roam-mode)
(add-hook 'wr-org-roam-mode-hook 'wr-org-roam-mode-line-need-more-effort)
(add-hook 'before-save-hook #'wr/org-roam-notes-today-effort-update)
Please put this file `.dir-locals.el` in the `org-roam` directory:
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((org-mode . ((my-dir-local-flag . t)
(my-org-roam-dir-local-flag . t))))
I end up using external shell script to walk around the performance issue.
#!/bin/bash
TODAY=`date +"%Y%m%d"`
ls -l ORG_ROAM_FOLDER_PATH | grep "$TODAY" | grep -v "~" | awk '{print $9}' | wc -l > ORG_ROAM_FOLDER_PATH/output/log.today_effort 2>&1