summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-09-01 17:16:29 -0500
committerCase Duckworth2021-09-01 17:16:29 -0500
commit55c563b37f9d8b4f78f97c92e497eead8ec78744 (patch)
tree015314193543bb544581b2413e6fc84c76dc0912 /lisp
parentFix acdw/org-next-heading-widen (diff)
downloademacs-55c563b37f9d8b4f78f97c92e497eead8ec78744.tar.gz
emacs-55c563b37f9d8b4f78f97c92e497eead8ec78744.zip
Add acdw-org/work-month-headings
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-org.el28
1 files changed, 28 insertions, 0 deletions
diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index d7137b7..89269ab 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el
@@ -386,5 +386,33 @@ instead of the true count."
386 (acdw/org-next-heading-widen (- arg))) 386 (acdw/org-next-heading-widen (- arg)))
387 387
388 388
389;;; Add headings for every day of the work month
390;; Gets rid of weekends.
391
392(defun acdw-org/work-month-headings (&optional month year)
393 (interactive (list
394 (read-number "Month: " (car (calendar-current-date)))
395 (read-number "Year: " (nth 2 (calendar-current-date)))))
396 (let ((offset 0)
397 (month (or month
398 (car (calendar-current-date))))
399 (year (or year
400 (car (last (calendar-current-date))))))
401 (dotimes (day (calendar-last-day-of-month month year))
402 (let* ((day (1+ day))
403 (day-of-week (calendar-day-of-week (list month day year))))
404 (unless (memq day-of-week '(0 6)) ; weekend
405 (end-of-line)
406 (org-insert-heading nil t t)
407 (insert (concat "[" (mapconcat (lambda (n)
408 (format "%02d" n))
409 (list year month day)
410 "-")
411 " "
412 (nth day-of-week '("Sun" "Mon" "Tue" "Wed" "Thu"
413 "Fri" "Sat"))
414 "]")))))))
415
416
389(provide 'acdw-org) 417(provide 'acdw-org)
390;; acdw-org.el ends here 418;; acdw-org.el ends here