wc-mode icon indicating copy to clipboard operation
wc-mode copied to clipboard

Does wc-mode work with doom-emacs?

Open maikol-solis opened this issue 4 years ago • 3 comments

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.

maikol-solis avatar Mar 08 '21 12:03 maikol-solis

@bnbeckwith how does wc-mode update the modeline? I can't see where in the lisp code (eg https://github.com/bnbeckwith/wc-mode/blob/63be1433b8a63cdc3239cc751e36360429c42b51/wc-mode.el#L304) where any variable actually gets set.

Doom modeline supports mode-line-misc-info and global-mode-string, would either of those be worth setting?

Alternatively, if we wanted to manually set those ourselves, which function should we call to return the formatted string?

BlueDrink9 avatar Oct 14 '21 02:10 BlueDrink9

In the mode definition, there is a line that sets the lighter or mode line for vanilla emacs. That line just presents the contents of the (buffer-local) variable wc-buffer-stats. If you have a way to show that variable (and refresh it), then that's what you'll want to set.

https://github.com/bnbeckwith/wc-mode/blob/63be1433b8a63cdc3239cc751e36360429c42b51/wc-mode.el#L350

bnbeckwith avatar Oct 14 '21 13:10 bnbeckwith

Not directly related to Doom Emacs but I was using the Moody mode line and always wondered if this package was broken (it's not). I finally spent some time today to figure this out. I just needed to add the following in my init.el during wc-mode's setup:

(add-to-list 'global-mode-string '(:eval wc-buffer-stats) 'APPEND) ; Add Word Count stats for the current buffer into the global mode line string (updates dynamically per buffer)

Hope this helps anyone who may have the same issue and wonder why the mode line is not showing the word count information.

@bnbeckwith Could I recommend adding a note about the need to configure wc-mode for custom mode lines in the README.org? Perhaps using the aforementioned one-line as an example of a "simple" solution (albeit a naive one, I am sure). It would help people out who may be expecting mode line functionality out of the box.

Thanks for a great little Emacs package BTW :)

MattMicheletti avatar Oct 27 '21 21:10 MattMicheletti