A method for blocking access to emacs commands based on time.
This package requires
handle time parsing.
time-block.el to somewhere on your
To use this package it's necessary to do two things: define time blocking groups and define time blocked commands.
Customize the variable
time-block-groups. An example of a groups definition is below.
(setf time-block-groups '((workday . ((1 . (("09:00" . "17:00"))) (2 . (("09:00" . "17:00"))) (3 . (("09:00" . "17:00"))) (4 . (("09:00" . "17:00"))) (5 . (("09:00" . "17:00")))))))
Commands are only time-blocked if they're defined. This is done using
define-time-blocked-command macro, which behaves similarly to
defun. After the lambda list, it has a list describing blocking and
blocking messages. This is composed of a symbol (a key in
time-block-groups) a block message, and an optional override prompt
(if present, the command will ask if you'd like to override the block
yes-or-no-p). An example is shown below.
(define-time-blocked-command my/start-elfeed () (workday "You have decided not to check news currently." "You have decided not to check news currently.\nStill start elfeed?") "Start `elfeed'. Time blocked according to `time-block-groups'." (interactive) (elfeed))
Commands can also be advised to use timeblocking. This works for
simpler commands, and as a bonus, can make it harder to access the
commands when blocked. Overall, the arguments for
override-prompt are as above. Consider the
(time-block-advice my/elfeed-block-advice 'elfeed workday "You have decided not to check news currently." "You have decided not to check news currently.\nStill start elfeed?")
If you find an error or a bug, send an email to