Giter VIP home page Giter VIP logo

wc-mode's People

Contributors

bnbeckwith avatar dato avatar jgkamat avatar lightquake avatar spwhitton avatar sten0 avatar syohex avatar tarsius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wc-mode's Issues

wc-mode slows emacs down

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

Reset counts when setting a new goal?

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?

Feature request: exclude comments from count

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.

Update latest version in Marmalade repo?

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!

How to show wc-mode counts in a custom mode-line?

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?

Findings from benchmarking wc-mode

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.

Tracking between sessions

Hello, I'm pretty new to emacs, but I'm already using it extensively for writing.

I have a few questions:

  1. How do I display how many words left until goal is reached in mode line format? I tried sth like this 50000-%tw but it does not do any calculations.
  2. How do I save my word goal for future sessions? (I am writing a novel and have 50K words goal). but I don't want to set a goal every time I launch emacs
  3. Is there a way to save the progress of each session, i.e.
<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!

feature request (w/ initial implementation): globalized wc mode for activity tracking

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.