* Re: Context-sensitive word count in org mode (elisp)
@ 2011-02-16 16:22 Benjamin Beckwith
2011-02-16 16:32 ` Bastien
2011-02-16 23:31 ` Paul Sexton
0 siblings, 2 replies; 10+ messages in thread
From: Benjamin Beckwith @ 2011-02-16 16:22 UTC (permalink / raw)
To: Paul Sexton, emacs-orgmode
Hi Paul,
I have a small emacs project that creates a word-count mode and function
for use. It currently does not ignore sections like your proposal, but I think
that would be interesting functionality.
Mine does keep a running tally of adds/delete in the mode line. It also
lets you set a goal and provides a visual indication when that goal is
met -- I believe that this feature may be of interest to you.
You can find it at:
https://github.com/bnbeckwith/wc-mode
Regards,
Ben
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: Context-sensitive word count in org mode (elisp)
2011-02-16 16:22 Context-sensitive word count in org mode (elisp) Benjamin Beckwith
@ 2011-02-16 16:32 ` Bastien
2011-02-16 18:56 ` Benjamin Beckwith
2011-02-16 23:31 ` Paul Sexton
1 sibling, 1 reply; 10+ messages in thread
From: Bastien @ 2011-02-16 16:32 UTC (permalink / raw)
To: Benjamin Beckwith; +Cc: emacs-orgmode, Paul Sexton
Hi Benjamin,
Benjamin Beckwith <bnbeckwith@gmail.com> writes:
> You can find it at:
> https://github.com/bnbeckwith/wc-mode
Nice. How hard would it be to make it org-aware (i.e. don't count
syntactic elements in an org buffer)?
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: Context-sensitive word count in org mode (elisp)
2011-02-16 16:32 ` Bastien
@ 2011-02-16 18:56 ` Benjamin Beckwith
0 siblings, 0 replies; 10+ messages in thread
From: Benjamin Beckwith @ 2011-02-16 18:56 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode, Paul Sexton
> Nice. How hard would it be to make it org-aware (i.e. don't count
> syntactic elements in an org buffer)?
I use the how-many function to get the search. I'm not sure off the
top of my head, but there would be some rework required to make it
work properly and ignore those items.
I'll gladly accept any ideas or patches into my code to make it org-friendly.
-Ben
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Context-sensitive word count in org mode (elisp)
2011-02-16 16:22 Context-sensitive word count in org mode (elisp) Benjamin Beckwith
2011-02-16 16:32 ` Bastien
@ 2011-02-16 23:31 ` Paul Sexton
1 sibling, 0 replies; 10+ messages in thread
From: Paul Sexton @ 2011-02-16 23:31 UTC (permalink / raw)
To: emacs-orgmode
That looks really good. My suggestion would be to modify it so that
'wc-count' can be redefined on a per-major-mode or per-buffer basis,
eg via a buffer-local variable 'wc-count-function'.
Then my org-word-count function could be slotted in fairly easily -
I would just have to modify it so that it *returns* the count, rather
than reporting it.
Paul
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: Context-sensitive word count in org mode (elisp)
2011-02-16 20:34 ` Paul Sexton
@ 2011-02-17 10:02 ` Christian Moe
2011-02-17 18:57 ` Eric Schulte
0 siblings, 1 reply; 10+ messages in thread
From: Christian Moe @ 2011-02-17 10:02 UTC (permalink / raw)
To: Paul Sexton; +Cc: emacs-orgmode
Hi,
> I don't agree with changing '(match-end 0)' to '(match-beginning 2)'
> however. For most latex macros, I don't want to count the words inside
> the macro's arguments.
Maybe you're right. I rarely use latex, so I can't think of a use case
off the top of my head. Default no, optional yes sounds good.
Yours,
Christian
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: Context-sensitive word count in org mode (elisp)
2011-02-16 23:28 ` Paul Sexton
@ 2011-02-17 16:50 ` Samuel Wales
2011-02-18 14:34 ` Bastien
1 sibling, 0 replies; 10+ messages in thread
From: Samuel Wales @ 2011-02-17 16:50 UTC (permalink / raw)
To: Paul Sexton; +Cc: emacs-orgmode
This looks great.
How hard do you think it would be to show how many words there are for
every subtree in a similar way to how clock durations are summed in
c-c c-x c-d and displayed in the subtree itself in reverse video?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: Context-sensitive word count in org mode (elisp)
2011-02-17 10:02 ` Christian Moe
@ 2011-02-17 18:57 ` Eric Schulte
0 siblings, 0 replies; 10+ messages in thread
From: Eric Schulte @ 2011-02-17 18:57 UTC (permalink / raw)
To: mail; +Cc: emacs-orgmode, Paul Sexton
Christian Moe <mail@christianmoe.com> writes:
> Hi,
>
>> I don't agree with changing '(match-end 0)' to '(match-beginning 2)'
>> however. For most latex macros, I don't want to count the words inside
>> the macro's arguments.
>
> Maybe you're right. I rarely use latex, so I can't think of a use case
> off the top of my head. Default no, optional yes sounds good.
>
I find the following handy for word-count of latex documents...
#+begin_src sh :var basename=(file-name-sans-extension (buffer-file-name))
pdftotext $basename.pdf - |wc -w
#+end_src
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: Context-sensitive word count in org mode (elisp)
2011-02-16 23:28 ` Paul Sexton
2011-02-17 16:50 ` Samuel Wales
@ 2011-02-18 14:34 ` Bastien
2011-02-20 21:49 ` Paul Sexton
[not found] ` <4D601314.8000701@xnet.co.nz>
1 sibling, 2 replies; 10+ messages in thread
From: Bastien @ 2011-02-18 14:34 UTC (permalink / raw)
To: Paul Sexton; +Cc: emacs-orgmode
Hi Paul,
Paul Sexton <psexton@xnet.co.nz> writes:
> Thanks for all the suggestions. Here is version 2.
Thanks for that. Maybe you could put if on Worg/org-hacks.org?
> I would still like to count hyperlink descriptions but am not sure
> how -- is there a function that fetches the description of the hyperlink
> at point?
#+begin_src emacs-lisp
(when (looking-at org-bracket-link-analytic-regexp)
(match-string-no-properties 5))
#+end_src emacs-lisp
HTH,
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: Context-sensitive word count in org mode (elisp)
2011-02-20 21:49 ` Paul Sexton
@ 2011-02-21 23:30 ` Samuel Wales
0 siblings, 0 replies; 10+ messages in thread
From: Samuel Wales @ 2011-02-21 23:30 UTC (permalink / raw)
To: Paul Sexton; +Cc: emacs-orgmode
Out of curiosity, has anybody compared the results that this provides
with exporting to HTML, rendering with a browser (including
emacs-w3m), and counting words that way?
--
The Kafka Pandemic:
http://thekafkapandemic.blogspot.com/2010/12/welcome-to-kafka-pandemic-two-forces_9182.html
I support the Whittemore-Peterson Institute (WPI)
===
I want to see the original (pre-hold) Lo et al. 2010 NIH/FDA/Harvard MLV paper.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: Context-sensitive word count in org mode (elisp)
[not found] ` <4D601314.8000701@xnet.co.nz>
@ 2011-02-22 11:28 ` Bastien
0 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2011-02-22 11:28 UTC (permalink / raw)
To: Paul Sexton; +Cc: emacs-orgmode
Hi Paul,
Paul Sexton <psexton@xnet.co.nz> writes:
> The process of contributing to Worg is too complicated for me.
You can clone the Worg.git repository with
$ git clone git://repo.or.cz/Worg.git
Then make some edit on Worg.
Then commit your changes with
$ git commit -a -m "Your message"
Then create a patch with
$ git format-patch master
Then send the patch.
> If someone else wants to add it somewhere on my behalf that is fine
> with me.
I added a section "Count words in an Org buffer" with your code in
Worg/org-hacks.org. Thanks.
> Have you thought of making Worg a wiki?
> Wikis hosted on github can be written in org-mode format.
Yes, but this format is limited. I think it's good to have all Org's
functionalities in Worg, not only the one needed for publication. In
particular, org-issues.org contains lots of information that we want
to handle locally, not just for publishing.
Best,
--
Bastien
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-02-22 11:29 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-16 16:22 Context-sensitive word count in org mode (elisp) Benjamin Beckwith
2011-02-16 16:32 ` Bastien
2011-02-16 18:56 ` Benjamin Beckwith
2011-02-16 23:31 ` Paul Sexton
-- strict thread matches above, loose matches on Subject: below --
2011-02-16 3:51 Paul Sexton
2011-02-16 9:45 ` Christian Moe
2011-02-16 20:34 ` Paul Sexton
2011-02-17 10:02 ` Christian Moe
2011-02-17 18:57 ` Eric Schulte
2011-02-16 23:28 ` Paul Sexton
2011-02-17 16:50 ` Samuel Wales
2011-02-18 14:34 ` Bastien
2011-02-20 21:49 ` Paul Sexton
2011-02-21 23:30 ` Samuel Wales
[not found] ` <4D601314.8000701@xnet.co.nz>
2011-02-22 11:28 ` Bastien
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).