bnbeckwith / wc-mode

Wordcount minor mode for Emacs
68 stars 10 forks source link

Does wc-mode work with doom-emacs? #18

Open maikol-solis opened 3 years ago

maikol-solis commented 3 years ago

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.

BlueDrink9 commented 2 years ago

@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?

bnbeckwith commented 2 years ago

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

MattMicheletti commented 2 years ago

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 :)