You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I put this together to use wc-mode as an activity tracker, since none of the existing options seemed to do what I had in mind.
This is just a first attempt. If something along these lines would be useful to include in the package, please critique it, and I'll make changes and then submit a pull request.
(define-globalized-minor-mode my-global-wc-mode wc-mode
(lambda () (wc-mode 1)))
(my-global-wc-mode 1)
(defunmy-global-wc-report ()
"Produce a list of the buffers that have changed and by how much.In the process reset the per-buffer count for each buffer."
(save-excursion
(remove-if (lambda (bufct) (or (eq0 (cdr bufct))
;; ignore org mode capture buffers and;; the minibuffer
(string-match-p "CAPTURE\\|.*Minibuf.*"
(car bufct))))
(mapcar (lambda (b)
(let ((count wc-words-delta))
(set-buffer b)
(when (>count0)
(wc-reset))
`(,(buffer-name) .,count)))
(buffer-list)))))
(defunrecord-global-wc-report ()
"Provides `org-mode' integration for `my-global-wc-report'.Produce a Note that records the per-buffer changes since last run."
(interactive)
(let* ((modified-buffers (my-global-wc-report))
(ct-mods (length modified-buffers)))
(org-capture nil"n")
(insert (concat "Word Deltas <" (current-time-string) ">"))
(forward-line)
(insert "| Buffer | count | comment |\n|--------+-------+---------|\n" )
(dolist (b modified-buffers)
(insert (format"| %s | %s| |\n" (car b) (cdr b))))
(forward-line (- ct-mods))
(org-table-next-field)
(org-table-next-field)
(org-table-next-field)
(org-table-align)))
;; We want to routinely run `record-global-wc-report'; that can be accomplished;; with a crontab entry like this (to run the command hourly):;; 00 * * * * emacsclient -e "(record-global-wc-report)"
The text was updated successfully, but these errors were encountered:
@holtzermann17, I like this proposed feature! Since it operates on multiple buffers, I feel like it overlaps with my plan at 48a8afd, but progress on that has stalled, and I forget what the local state of my work is. If you'd like to also add async support as well then I'll humbly step out of the way, test your work, and support your PR.
@bnbeckwith, hypothetically, if the best technical solution relies on built-in copy of org-mode for time tracking, would you be opposed to this? Are there any restrictions on oldest supported Emacs version? If older Emacs and org-mode versions wouldn't be supported then I'd propose Emacs 26.x or ELPA org-mode_9.1.14. IIRC Emacs 26.x is the oldest feasible version to add async support without depending on an external library.
@sten0 I'm late to the party on this one. I think that the dependency on org-mode is fine. I suspect that even that can be optional if folks do not wish to use the reporting in pre-compatible versions of emacs.
I put this together to use
wc-mode
as an activity tracker, since none of the existing options seemed to do what I had in mind.This is just a first attempt. If something along these lines would be useful to include in the package, please critique it, and I'll make changes and then submit a pull request.
The text was updated successfully, but these errors were encountered: