This Emacs Lisp package provides streak-mode, a minor mode for tracking some
daily streak. Exercising? Learning a language? Trying to quit a bad habit? Track
your success in your mode line!
Note: this package requires at least Emacs 27.1
You can install streak in the usual way:
M-x package-install RET streak
And configure it like so:
(use-package streak
:ensure t)Place the following in your packages.el:
(package! streak)This should automatically pull streak from Melpa. Now make sure to run doom sync
-u. Then in your config.el:
(use-package! streak
:config
(streak-mode))This will start streak-mode when Doom opens.
streak-mode stores your data in its “streak file”. This file will be created
automatically the first time a streak is made with streak-new:
M-x streak-new
You’ll be asked to name your streak. You can keep this simple (a single word) since this label won’t appear as-is in your modeline. How the modeline actually appears can be fully customized by you (see below).
Once you’ve started your streak, it will increment (in the mode line) automatically day by day.
Consider these functions for manual control over the specific streak values:
streak-reset: Reset a streak, with “now” as the new starting point.streak-increment: Increase a streak by 24 hours worth.streak-decrement: The opposite of the above.streak-update: Reread the streak file and manually update the mode line.streak-remove: Remove a streak that you no longer want to track.
The following aspects of streak can be customized (all found under the streak
customization group):
streak-file: A filepath to the “streak file” where your records are kept.streak-formatters: Analistof functions to customize how each streak is formatted. The key of each pair must be a string that matches a streak name found in your streak file, while the value must be a function that accepts the days of that streak and returns a string.(setq streak-formatters '(("study" . (lambda (days) (format "Study: %d Days" days))) ("running" . (lambda (days) (format "Run: %d Days" days)))))
So a full Doom config would look like:
(use-package! streak
:config
(setq streak-formatters '(("study" . (lambda (days) (format "Study: %d Days" days)))
("running" . (lambda (days) (format "Run: %d Days" days)))))
(streak-mode))TODO (Feel free to PR a working setup!)
org-habit is useful for tracking repeated tasks/events that occur over an
interval, like “Vaccuum every Saturday”. streak on the other hand is for
maintaining a daily streak of some initiative you’re pursuing, like “Study
German every day” or “Stop eating ice cream”. Further, streak shows you your
current record in the mode line, thus visible at all times to keep up your
motivation.
