bnbeckwith / wc-mode Goto Github PK
View Code? Open in Web Editor NEWWordcount minor mode for Emacs
Wordcount minor mode for Emacs
Hello,
wc-mode is very nice but with a 60 000 words buffer, it becomes unusable as emacs becomes very laggy.
I don't know how the package is working, but it seems to scan the whole buffer permanently.
I don't know if the package could take advanvage of the async function and if it would increase performance.
thanks
I'm working on a book, and I tend to leave my manuscript file open between writing sessions.
To set my daily writing goal, I have to call wc-reset
before wc-set-word-goal
, which is kind of a pain.
Would it make sense to reset the original word count before setting a new word goal?
I love wc-mode
๐. Thank you for the package!
It would be fantastic to have an option to exclude comments (or any other markup that would not be exported to a final output) from the count. This would be extremely convenient when writing abstracts or any piece of text (or code) with a limited number of words allowed, to monitor the actual (rather than the total) number of words.
The strings %rw, %rl, and %rc could insert (i) an emptry string if no region is active, or (ii) the word/line/char count in the active region
Stable MELPA currently is providing v1.0 of wc-mode. This is a quite old version and it would be very nice to have a newer stable version available!
Sorry to post this here--it's not really an "issue" per se, but I couldn't find another way to contact you.
I'm stoked about the word goal features, as I was planning on trying to hack something similar together to help me with my goal of writing 1000 words a day.
Any chance you could push the latest version of this plugin to Marmalade?
The current version doesn't include the wc-reset
function, which I want to use.
Thanks!
I installed this package today in doom-emacs, but I can't see any word count in the modeline.
How could I do to enable it ?
Thanks.
I customize mode-line like this:
(setq-default
mode-line-format
(quote
(
(:eval (if (frame-parameter nil 'client)
(propertize " ใ "
'face '(:foreground "#333333" :background "yellow" :weight bold :height 120)
'help-echo "emacsclient frame")))))
Is there wc-mode has a function or variable to show counts in the custom mode-line?
Hi @bnbeckwith,
I've had to deactivate wc-mode again due to scaling issues, but this time I did some semiformal benchmarking, and count-words is consistently at least ~68.7% slower than calling GNU coreutils "wc". I tried a second method to remove wc's potential advantages, and this showed that count-words was 66.20% slower than wc. This is with Emacs 28.2, and with native-compilation enabled, so I'd consider it the best-case scenario.
Consequently, I think the the way forward for wc-mode, for is the following: Call "wc" for the whole region, but only asynchronously, and only as an-autosave-hook (if possible). Failing that, then as a save-hook. In either case writing to disk doesn't need to wait for the process to return.
Impact: All Linux distributions and BSDs have "wc" (MacOS has it too). I suspect WSL is slow, so Windows users would probably use of of these:
https://gnuwin32.sourceforge.net/packages/coreutils.htm
https://learn.microsoft.com/en-gb/powershell/module/microsoft.powershell.utility/measure-object?view=powershell-7.3
After that, I don't see how further optimisation will be possible without introducing some kind of "zones" which tally the words added and removed relative to the global count.
Hello, I'm pretty new to emacs, but I'm already using it extensively for writing.
I have a few questions:
50000-%tw
but it does not do any calculations.<2020-06-08 Mon> 150 words
<2020-06-09 Tue> 500 words
<2020-06-10 Wed> 750 words
<2020-06-11 Thu> 200 words
etc..
Thank you!
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)
(defun my-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 (eq 0 (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 (> count 0)
(wc-reset))
`(,(buffer-name) . ,count)))
(buffer-list)))))
(defun record-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)"
It may be difficult to read char count when it is in the hundred of thousands. Would it be possible to have an option for a thousands separator ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.