Re: [O] Word-counting in a subtree

2017-08-22 Thread Simon Guest
[copy to list]

A few years ago I wrote org-wc.el, which is on MELPA.  It uses overlays to
display a word count against each heading.

Just install the package, and run org-wc-display.

https://github.com/tesujimath/org-wc

Hope that helps.

cheers,
Simon

On 22 August 2017 at 09:34, Jacopo De Simoi  wrote:

> On Monday, August 21, 2017 2:09:25 PM EDT Eric S Fraga wrote:
> > On Monday, 21 Aug 2017 at 13:21, Jacopo De Simoi wrote:
> > > tl;dr
> > >
> > > Is there a way to create a token on a subtree header that would count
> > > words in the subtree and [optionally] mark a maximum allowed number of
> > > words?
> > I cannot help you directly but what I do is: narrow the region to the
> > sub-tree while writing and then simply execute M-x count-words RET every
> > now and again.
>
> this has the drawback that it also counts words in the header line; except
> this, could work as a temporary solution, but I'd still like to cook up
> some
> tag integrated with org
>
> >
> > There is a wc-mode which displays the number of words/chars in the
> > modeline but my modeline is already too busy for this...
>
> Indeed modelines are crowded these days…
>
>
>


[O] Unbundling contrib from org-plus-contrib package?

2017-08-10 Thread Simon Guest
Hiding in the ox-taskjuggler thread is a discussion of some of the problems
caused by having contrib bundled up in the org-plus-contrib package.  (See
that thread for the details.)

However, a general question remains, as asked by Tim Cross, whom I will
quote if I may:

There are also some other alternatives on the emacs-devel list from when
> I asked as a general question regarding package.el and dependencies.
> Should be noted that this issue is primarily caused because, fro the
> package.el perspective, org-plus-contrib is different to the org
> package. Other ELPA/MELPA/etc packages have org as a dependency and not
> org-plus-contrib. There is no support in package.el for alternative
> dependencies.
> I would be interested in understanding the rationale for having
> org-plus-contrib rather than just an org package and an org-contrib
> package? It should be possible to just have an org-contrib package which
> depends on an org package (of same version). This would then avoid this
> issue. As this is an obvious solution, I suspect there is something
> subtle which unpins the rationale to have an org and org-plus-contrib
> package approach, but don't know what that is.


So, is there an answer to this good and as-yet unanswered question about
unbundling contrib into its own package?

cheers,
Simon


Re: [O] ox-taskjuggler on MELPA useful despite org-plus-contrib

2017-08-09 Thread Simon Guest
This is indeed useful, thanks.

I think this may be best done by some startup code, which when installing
org-plus-contrib with require-package, deletes any existing org package,
and makes this dummy org package.

Would it be useful if such code appeared within the org-plus-contrib
package itself, so we could have this sort of usage in our .emacs:

(require-package 'org-plus-contrib)
(org-plus-contrib-remove-and-stub-org-pkg)

I'm not particularly attached to the name, but you get the point.

What do you think?

cheers,
Simon

On 10 August 2017 at 07:37, Thomas S. Dye  wrote:

> In case it is useful, here is Achim's post:
>
> From: Achim Gratz
> To: emacs-orgmode@gnu.org
> Subject: Re: [O] Stable releases
> Flags: replied, seen, list
> Date: Sat Aug 22 07:44:14 2015
> Maildir: /TSDYE/INBOX
> List: emacs-orgmode.gnu.org
>
> Thomas S. Dye writes:
> > I do have a technical question that you or someone else on the list
> > might be able to answer for me.  When I downloaded the Babel languages
> > from melpa just now, the elpa version of Org mode was also downloaded
> > and installed, even though I didn't ask for it.  Why is this?
>
> Although you don't say which package you tried, I would guess that the
> "org" package is specified as a dependency, likely with some minimum
> version.
>
> > Can it be disabled? Must the elpa Org mode be installed and activated
> > in order for the Org mode packages to work?
>
> From the point of package manager anything installed from the outside
> doesn't exist.  You can fake that in various way, for instance by
> creating a package directory "org-21991231" and putting an org-pkg.el
> with
>
> (define-package "org" "21991231" "Fake Org package for dependency
> resolution" 'nil)
>
> in it.
>
>
> Regards,
> Achim.
> --
> +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
>
> Waldorf MIDI Implementation & additional documentation:
> http://Synth.Stromeko.net/Downloads.html#WaldorfDocs
>
>
> Achim Gratz writes:
>
> > Adam Porter writes:
> >> I've had the same problem, I have to manually delete the extra org
> >> package now and then.  I wonder if a dummy package would prevent
> >> package.el from reinstalling it...
> >
> > Yes it does and I've provided instructions on how to do that quite some
> > time ago on this list.
> >
> >
> > Regards,
> > Achim.
>
>
> --
> Thomas S. Dye
> http://www.tsdye.com
>
>


Re: [O] ox-taskjuggler on MELPA useful despite org-plus-contrib

2017-08-08 Thread Simon Guest
Hi Nicolas,

My problem with org-plus-contrib exhibited itself when using a .emacs.d
based on Steve Purcell's, https://github.com/purcell/emacs.d. Specfically,
when loading ob-R, I got this error:

Invalid function: org-babel-header-args-safe-fn

In response to your email, just now I stripped that config right back to
basics, and found that my problem went away, and I was able to load ob-R
after all.  Sorry, I should have done that before.

Having realised that, I think I should report this against Steve Purcell's
.emacs.d, and leave you guys alone.

Thanks for your help.

cheers,
Simon

On 8 August 2017 at 19:50, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote:

> Hello,
>
> Simon Guest <s...@cantab.net> writes:
>
> > Well, almost as soon as I started on that, I see some issues around
> mixing
> > old/new org-mode functionality, so this seems like a not-so-good idea
> after
> > all.
> >
> > In particular, ox-taskjuggler is using the very new org-duration
> > library.
>
> You could use "ox-taskjuggler" from maint.
>
> > I'll think of another approach, not using MELPA.
>
> I suggest to use GNU ELPA instead.
>
> > At least until the underlying problem with org-plus-contrib is
> > resolved.
>
> What exactly is the underlying problem?
>
> Regards,
>
> --
> Nicolas Goaziou
>
>


Re: [O] ox-taskjuggler on MELPA useful despite org-plus-contrib

2017-08-07 Thread Simon Guest
Well, almost as soon as I started on that, I see some issues around mixing
old/new org-mode functionality, so this seems like a not-so-good idea after
all.

In particular, ox-taskjuggler is using the very new org-duration library.

I'll think of another approach, not using MELPA.  At least until the
underlying problem with org-plus-contrib is resolved.

cheers,
Simon

On 8 August 2017 at 10:57, Simon Guest <s...@cantab.net> wrote:

> Well, I see now that org-plus-contrib has its issues.  Specifically I am
> hitting the same issue as reported here, which I see has been a problem for
> nearly 2 years.
> https://github.com/purcell/emacs.d/issues/297
>
> Therefore, unless I hear another idea or an objection here, I intend to
> proceed with getting ox-taskjuggler in isolation onto MELPA, unless its
> author and/or maintainer would prefer not.
>
> cheers,
> Simon
>
>>
>> On 5/08/2017 10:51 PM, "Adam Porter" <a...@alphapapa.net> wrote:
>>
>>>
>>> Actually all you need to do is install the org-plus-contrib package from
>>> ELPA, which includes contrib.  Then you'll get the latest release of
>>> Org, too.  ;)
>>>
>>>
>>>
>


[O] ox-taskjuggler on MELPA useful despite org-plus-contrib

2017-08-07 Thread Simon Guest
Well, I see now that org-plus-contrib has its issues.  Specifically I am
hitting the same issue as reported here, which I see has been a problem for
nearly 2 years.
https://github.com/purcell/emacs.d/issues/297

Therefore, unless I hear another idea or an objection here, I intend to
proceed with getting ox-taskjuggler in isolation onto MELPA, unless its
author and/or maintainer would prefer not.

cheers,
Simon

>
> On 5/08/2017 10:51 PM, "Adam Porter"  wrote:
>
>>
>> Actually all you need to do is install the org-plus-contrib package from
>> ELPA, which includes contrib.  Then you'll get the latest release of
>> Org, too.  ;)
>>
>>
>>


Re: [O] Getting ox-taskjuggler on MELPA

2017-08-05 Thread Simon Guest
Hi Adam,

Ah, didn't spot that! Thanks for the hint.

Cheers, Simon

On 5/08/2017 10:51 PM, "Adam Porter" <a...@alphapapa.net> wrote:

> Simon Guest <s...@cantab.net> writes:
>
> > I am a user of ox-taskjuggler. Since I am currently running the
> > version of org mode bundled with Emacs, this doesn't include the
> > contrib stuff like ox-taskjuggler. So currently I have had to grab a
> > copy of ox-taskjuggler.el manually, and stick it on my load path,
> > manually.
> >
> > Since all my other Emacs packages are loaded from MELPA et al, I would
> > like to do the same with ox-taskjuggler.
> >
> > It would seem to be somewhat rude of me simply to submit
> > ox-taskjuggler to MELPA since I am neither the author nor the
> > maintainer. Which is why I am asking here.
>
> Hi Simon,
>
> Actually all you need to do is install the org-plus-contrib package from
> ELPA, which includes contrib.  Then you'll get the latest release of
> Org, too.  ;)
>
>
>


[O] Getting ox-taskjuggler on MELPA

2017-08-05 Thread Simon Guest
Dear Org People,

I am a user of ox-taskjuggler.  Since I am currently running the version of
org mode bundled with Emacs, this doesn't include the contrib stuff like
ox-taskjuggler. So currently I have had to grab a copy of ox-taskjuggler.el
manually, and stick it on my load path, manually.

Since all my other Emacs packages are loaded from MELPA et al, I would like
to do the same with ox-taskjuggler.

It would seem to be somewhat rude of me simply to submit ox-taskjuggler to
MELPA since I am neither the author nor the maintainer.  Which is why I am
asking here.

What is the protocol for this?

cheers,
Simon


Re: [O] Latex export of longtable with multiline heading

2013-04-06 Thread Simon Guest
At Sat, 6 Apr 2013 13:07:03 -0500,
John Hendy wrote:
 
 What's the output of =M-x org-version= ?

Hi John,

I was using 7.9.2.  Following your suggestions, I upgraded to 8.0-pre,
and switched to the new syntax for selecting longtable.  It's all
perfect now, thanks, very much appreciated!

cheers,
Simon



[O] Latex export of longtable with multiline heading

2013-04-05 Thread Simon Guest
Dear Org-mode people,

I have an Org mode document containing a longtable, which has its
heading row split over two lines.  Exporting this to Latex doesn't work.

Here's a really small example (for which I wouldn't need longtable,
but you get the point):

#+ATTR_LaTeX: longtable align=|r|r|
|---+-|
| First | Age |
| Name  | (years) |
|---+-|
| Bob   |   6 |
| Dave  |   7 |
| Wendy |   9 |
|---+-|

The PDF document is missing the first line of the header.  Looking at
the Latex file which is generated, there appear to be too many
(i.e. 2) instances of \endhead (but I'm no expert on longtables in
Latex).

It's important that I get this working, or find a work-around.

Any suggestions?

cheers,
Simon



Re: [O] v3, with support for narrowing

2011-05-15 Thread Simon Guest
At Sat, 14 May 2011 15:48:10 -0700,
Samuel Wales wrote:
 What I meant was, if desired you can make the call to the word count
 function be (funcall variable) to allow substitution of that function.
 
 (Actually I'm finding that using w3m to count exact words is pretty fast.)
 
Hi Samuel,

OK, I see now.  That's clearly a good idea.

Next time I fiddle with this code (don't know when that might be),
I'll try to remember that.  Otherwise anyone else please feel free to
do what is necessary.

cheers,
Simon



Re: [O] v3, with support for narrowing

2011-04-29 Thread Simon Guest
At Fri, 29 Apr 2011 10:56:51 -0400,
Nick Dokos wrote:
 Indeed: it would require a bit of refactoring of Simon's code to provide the
 function(s) to apply to each entry, and changes to the top level functions to
 use the mapping API instead of looping explicitly.

That sounds like a good idea.  I may at some stage want to exclude
counting certain trees, and then I may have another look at this if
someone else hasn't already done it.

But for now, time pressure dictates I stop hacking on my word count
function.

cheers,
Simon



[O] Sub-tree word count v2

2011-04-28 Thread Simon Guest
At Thu, 28 Apr 2011 09:34:35 +0100,
Eric S Fraga wrote:
 However, it would be helpful if the modification flag were not changed
 by asking for the word count.  I don't know enough elisp to suggest what
 to change but you should be able to add the text properties without
 causing the buffer modification flag to change?  Column view, for
 instance, doesn't do this.

Hi Eric,

OK, I fixed this.  Now buffer modification state is preserved.  Also
now handles empty sections properly.

Version 2 attached below.

cheers,
Simon

;; org-wc.el
;;
;; Count words in org mode trees.
;; Shows word count per heading line, summed over sub-headings.
;; Aims to be fast, so doesn't check carefully what it's counting.  ;-)
;;
;; Simon Guest, 23/4/11
;;
;; Implementation based on:
;; - Paul Sexton's word count posted on org-mode mailing list 21/2/11.
;; - clock overlays
;;
;; v2 
;; 29/4/11
;; Don't modify buffer, and fixed handling of empty sections.

(defun org-in-heading-line ()
  Is point in a line starting with `*'?
  (equal (char-after (point-at-bol)) ?*))

(defun org-word-count (beg end) 
  Report the number of words in the Org mode buffer or selected region.
  (interactive r)
  (unless mark-active
(setf beg (point-min)
  end (point-max)))
  (let ((wc (org-word-count-aux beg end)))
(message (format %d words in %s. wc
 (if mark-active region buffer)

(defun org-word-count-aux (beg end)
  Report the number of words in the selected region.
Ignores: heading lines,
 blocks,
 comments,
 drawers.
LaTeX macros are counted as 1 word.

  (let ((wc 0)
(block-begin-re ^#\\\+BEGIN)
(block-end-re ^#\\+END)
(latex-macro-regexp [A-Za-z]+\\(\\[[^]]*\\]\\|\\){\\([^}]*\\)})
(drawers-re (concat ^[ \t]*:\\(
(mapconcat 'regexp-quote org-drawers \\|)
\\):[ \t]*$))
(drawers-end-re ^[ \t]*:END:))
(save-excursion
  (goto-char beg)
  (while ( (point) end)
(cond
 ;; Ignore heading lines.
 ((org-in-heading-line)
  (forward-line))
 ;; Ignore blocks.
 ((looking-at block-begin-re)
  (re-search-forward block-end-re))
 ;; Ignore comments.
 ((org-in-commented-line)
  (forward-line))
 ;; Ignore drawers.
 ((looking-at drawers-re)
  (re-search-forward drawers-end-re nil t))
 ;; Count latex macros as 1 word, ignoring their arguments.
 ((save-excursion
(backward-char)
(looking-at latex-macro-regexp))
  (goto-char (match-end 0))
  (setf wc (+ 2 wc)))
 (t
  (progn
(and (re-search-forward \\w+\\W* end 'skip)
 (incf wc)))
wc))

(defun org-wc-count-subtrees ()
  Count words in each subtree, putting result as the property :org-wc on that 
heading.
  (interactive)
  (remove-text-properties (point-min) (point-max)
  '(:org-wc t))
  (save-excursion
(goto-char (point-max))
(while (outline-previous-heading)
  (org-narrow-to-subtree)
  (let ((wc (org-word-count-aux (point-min) (point-max
(put-text-property (point) (point-at-eol) :org-wc wc)
(goto-char (point-min))
(widen)

(defun org-wc-display (beg end total-only)
  Show subtree word counts in the entire buffer.
With prefix argument, only show the total wordcount for the buffer or region
in the echo area.

Use \\[org-wc-remove-overlays] to remove the subtree times.

Ignores: heading lines,
 blocks,
 comments,
 drawers.
LaTeX macros are counted as 1 word.
  (interactive r\nP)
  (org-wc-remove-overlays)
  (unless total-only
(let ((bmp (buffer-modified-p))
  wc 
  p)
  (org-wc-count-subtrees)
  (save-excursion
(goto-char (point-min))
(while (or (and (equal (setq p (point)) (point-min))
(get-text-property p :org-wc))
   (setq p (next-single-property-change
(point) :org-wc)))
  (goto-char p)
  (when (setq wc (get-text-property p :org-wc))
(org-wc-put-overlay wc (funcall outline-level
;; Arrange to remove the overlays upon next change.
(when org-remove-highlights-with-change
  (org-add-hook 'before-change-functions 'org-wc-remove-overlays
nil 'local)))
(set-buffer-modified-p bmp)))
  (if mark-active
  (org-word-count beg end)
(org-word-count (point-min) (point-max

(defvar org-wc-overlays nil)
(make-variable-buffer-local 'org-wc-overlays)

(defun org-wc-put-overlay (wc optional level)
  Put an overlays on the current line, displaying word count.
If LEVEL is given, prefix word count with a corresponding number of stars.
This creates a new overlay and stores it in `org-wc-overlays', so that it
will be easy to remove.
  (let* ((c 60)
 (l

[O] v3, with support for narrowing

2011-04-28 Thread Simon Guest
At Thu, 28 Apr 2011 15:47:07 -0700,
Samuel Wales wrote:
 Is it possible to make it so that you can show the overlays for just a
 subtree or region instead of the entire buffer?

Hi Samuel,

Good idea!  So I just fixed it to handle narrowing properly, so narrow
to your region or subtree of interest first, and then count as usual.

Attached v3 which does this.  I'm not normally this responsive, you
just caught me at a good time.  ;-)

 Also, I have a plugin-compatible backend that will get you the /exact/
 word count (uses w3m).  If you're interested you can have it be an
 alternate backend.

I'm not that interested in higher fidelity counting.  I'm especially
interested in speed.

cheers,
Simon

;; org-wc.el
;;
;; Count words in org mode trees.
;; Shows word count per heading line, summed over sub-headings.
;; Aims to be fast, so doesn't check carefully what it's counting.  ;-)
;;
;; Simon Guest, 23/4/11
;;
;; Implementation based on:
;; - Paul Sexton's word count posted on org-mode mailing list 21/2/11.
;; - clock overlays
;;
;; v2 
;; 29/4/11
;; Don't modify buffer, and fixed handling of empty sections.
;;
;; v3
;; 29/4/11
;; Handle narrowing correctly, so partial word count works on narrowed regions.
(defun org-in-heading-line ()
  Is point in a line starting with `*'?
  (equal (char-after (point-at-bol)) ?*))

(defun org-word-count (beg end) 
  Report the number of words in the Org mode buffer or selected region.
  (interactive r)
  (unless mark-active
(setf beg (point-min)
  end (point-max)))
  (let ((wc (org-word-count-aux beg end)))
(message (format %d words in %s. wc
 (if mark-active region buffer)

(defun org-word-count-aux (beg end)
  Report the number of words in the selected region.
Ignores: heading lines,
 blocks,
 comments,
 drawers.
LaTeX macros are counted as 1 word.

  (let ((wc 0)
(block-begin-re ^#\\\+BEGIN)
(block-end-re ^#\\+END)
(latex-macro-regexp [A-Za-z]+\\(\\[[^]]*\\]\\|\\){\\([^}]*\\)})
(drawers-re (concat ^[ \t]*:\\(
(mapconcat 'regexp-quote org-drawers \\|)
\\):[ \t]*$))
(drawers-end-re ^[ \t]*:END:))
(save-excursion
  (goto-char beg)
  (while ( (point) end)
(cond
 ;; Ignore heading lines.
 ((org-in-heading-line)
  (forward-line))
 ;; Ignore blocks.
 ((looking-at block-begin-re)
  (re-search-forward block-end-re))
 ;; Ignore comments.
 ((org-in-commented-line)
  (forward-line))
 ;; Ignore drawers.
 ((looking-at drawers-re)
  (re-search-forward drawers-end-re nil t))
 ;; Count latex macros as 1 word, ignoring their arguments.
 ((save-excursion
(backward-char)
(looking-at latex-macro-regexp))
  (goto-char (match-end 0))
  (setf wc (+ 2 wc)))
 (t
  (progn
(and (re-search-forward \\w+\\W* end 'skip)
 (incf wc)))
wc))

(defun org-wc-count-subtrees ()
  Count words in each subtree, putting result as the property :org-wc on that 
heading.
  (interactive)
  (remove-text-properties (point-min) (point-max)
  '(:org-wc t))
  (save-excursion
(goto-char (point-max))
(while (outline-previous-heading)
  (save-restriction
(org-narrow-to-subtree)
(let ((wc (org-word-count-aux (point-min) (point-max
  (put-text-property (point) (point-at-eol) :org-wc wc)
  (goto-char (point-min)))

(defun org-wc-display (beg end total-only)
  Show subtree word counts in the entire buffer.
With prefix argument, only show the total wordcount for the buffer or region
in the echo area.

Use \\[org-wc-remove-overlays] to remove the subtree times.

Ignores: heading lines,
 blocks,
 comments,
 drawers.
LaTeX macros are counted as 1 word.
  (interactive r\nP)
  (org-wc-remove-overlays)
  (unless total-only
(let ((bmp (buffer-modified-p))
  wc 
  p)
  (org-wc-count-subtrees)
  (save-excursion
(goto-char (point-min))
(while (or (and (equal (setq p (point)) (point-min))
(get-text-property p :org-wc))
   (setq p (next-single-property-change
(point) :org-wc)))
  (goto-char p)
  (when (setq wc (get-text-property p :org-wc))
(org-wc-put-overlay wc (funcall outline-level
;; Arrange to remove the overlays upon next change.
(when org-remove-highlights-with-change
  (org-add-hook 'before-change-functions 'org-wc-remove-overlays
nil 'local)))
(set-buffer-modified-p bmp)))
  (if mark-active
  (org-word-count beg end)
(org-word-count (point-min) (point-max

(defvar org-wc-overlays nil)
(make-variable-buffer-local 'org-wc-overlays)

(defun org-wc-put

Re: [O] Implemented word count for subtrees

2011-04-27 Thread Simon Guest
At Wed, 27 Apr 2011 18:51:06 +0100,
Eric S Fraga wrote:
 This is quite nice.  Thanks!
 
 I cannot help you with the mark problem; hopefully others can.
 
 One suggestion, however: I wonder if you could introduce the word count
 in a different way?  I do use my headings and having the dots and the
 actual count inserted is not great (although easy work around:
 org-wc-display and then undo immediately after looking at the
 counts...).  Maybe you could automatically define a tag for each
 heading, something like :wc:?  Of course, this won't be good for
 anybody that wishes to export documents *with* tags...
 
 Anyway, I've incorporated your code into my emacs configuration.  Thanks
 again!

Hi Eric,

Thanks for your comments.

The counts are not actually inserted as text in the file.  It's just
an overlay, done with text properties like the clock durations (from
where I stole the code).  They don't get saved in the file, and in
fact as soon as you edit the buffer, they all disappear.  At least,
they do for me.

Does it do something different for you?  If so, it may be something to
do with the file coding system that is letting them get saved.  Is
your Org mode file a simple ASCII file, or something else?

cheers,
Simon



[O] Implemented word count for subtrees

2011-04-23 Thread Simon Guest
Dear Org mode people,

I implemented word counting for Org mode sub-trees.  That is, count
each sub-tree, and accumulate totals into the parent heading lines.
Others have asked about this, so I attach my code below.

I started with Paul Sexton's code posted to the list on 21/2/11.  I
had some different requirements, so I hacked this mercilessly.  Sorry,
Paul.

I was most concerned about speed, so I removed any check that caused
repeated hunting around in the org mode buffer - all the contextual
stuff.

I also skip heading lines, as I didn't want them in my total.
(I'm using the wonderful Org mode to write a novel, and the heading
lines are for my organisation only, not part of the text.)

Anyway, here it is.  I use this key-binding in my .emacs.
 (define-key org-mode-map \C-c\C-xw 'org-wc-display)

By the way, it complains if you call it without mark being set.  I
want to use (interactive r) to handle regions, but don't know how to
handle this error case.  Suggestions welcome.

cheers,
Simon

;; org-wc.el
;;
;; Count words in org mode trees.
;; Shows word count per heading line, summed over sub-headings.
;; Aims to be fast, so doesn't check carefully what it's counting.  ;-)
;;
;; Simon Guest, 23/4/11
;;
;; Implementation based on:
;; - Paul Sexton's word count posted on org-mode mailing list 21/2/11.
;; - clock overlays

(defun org-in-heading-line ()
  Is point in a line starting with `*'?
  (equal (char-after (point-at-bol)) ?*))

(defun org-word-count (beg end) 
  Report the number of words in the Org mode buffer or selected region.
  (interactive r)
  (unless mark-active
(setf beg (point-min)
  end (point-max)))
  (let ((wc (org-word-count-aux beg end)))
(message (format %d words in %s. wc
 (if mark-active region buffer)

(defun org-word-count-aux (beg end)
  Report the number of words in the selected region.
Ignores: heading lines,
 blocks,
 comments,
 drawers.
LaTeX macros are counted as 1 word.

  (let ((wc 0)
(block-begin-re ^#\\\+BEGIN)
(block-end-re ^#\\+END)
(latex-macro-regexp [A-Za-z]+\\(\\[[^]]*\\]\\|\\){\\([^}]*\\)})
(drawers-re (concat ^[ \t]*:\\(
(mapconcat 'regexp-quote org-drawers \\|)
\\):[ \t]*$))
(drawers-end-re ^[ \t]*:END:))
(save-excursion
  (goto-char beg)
  (while ( (point) end)
(cond
 ;; Ignore heading lines.
 ((org-in-heading-line)
  (forward-line))
 ;; Ignore blocks.
 ((looking-at block-begin-re)
  (re-search-forward block-end-re))
 ;; Ignore comments.
 ((org-in-commented-line)
  (forward-line))
 ;; Ignore drawers.
 ((looking-at drawers-re)
  (re-search-forward drawers-end-re nil t))
 ;; Count latex macros as 1 word, ignoring their arguments.
 ((save-excursion
(backward-char)
(looking-at latex-macro-regexp))
  (goto-char (match-end 0))
  (setf wc (+ 2 wc)))
 (t
  (progn
(re-search-forward \\w+\\W*)
(incf wc))
wc))

(defun org-wc-count-subtrees ()
  Count words in each subtree, putting result as the property :org-wc on that 
heading.
  (interactive)
  (remove-text-properties (point-min) (point-max)
  '(:org-wc t))
  (save-excursion
(goto-char (point-max))
(while (outline-previous-heading)
  (org-narrow-to-subtree)
  (let ((wc (org-word-count-aux (point-min) (point-max
(put-text-property (point) (point-at-eol) :org-wc wc)
(goto-char (point-min))
(widen)

(defun org-wc-display (beg end total-only)
  Show subtree word counts in the entire buffer.
With prefix argument, only show the total wordcount for the buffer or region
in the echo area.

Use \\[org-wc-remove-overlays] to remove the subtree times.

Ignores: heading lines,
 blocks,
 comments,
 drawers.
LaTeX macros are counted as 1 word.
  (interactive r\nP)
  (org-wc-remove-overlays)
  (unless total-only
(let (wc p)
  (org-wc-count-subtrees)
  (save-excursion
(goto-char (point-min))
(while (or (and (equal (setq p (point)) (point-min))
(get-text-property p :org-wc))
   (setq p (next-single-property-change
(point) :org-wc)))
  (goto-char p)
  (when (setq wc (get-text-property p :org-wc))
(org-wc-put-overlay wc (funcall outline-level
;; Arrange to remove the overlays upon next change.
(when org-remove-highlights-with-change
  (org-add-hook 'before-change-functions 'org-wc-remove-overlays
nil 'local)
  (if mark-active
  (org-word-count beg end)
(org-word-count (point-min) (point-max

(defvar org-wc-overlays nil)
(make-variable-buffer-local 'org-wc-overlays)

(defun org

[Orgmode] Links to datestamped headings broken?

2011-02-23 Thread Simon Guest
I have an Org mode file with some date-stamped headers, e.g.
** 2011-04-06 Wed National Bank

When I org-store-link (C-c l) on that line, I get
Stored: 2011-04-06 Wed National Bank
which seems right.

When I org-insert-link in another org-mode file, I get
 [[file:~/share/notes/maths-competitions.org::*%20National%20Bank][2011-04-06 
Wed National Bank]]
which looks wrong, and doesn't work.

I expected to see the date in the URL part of the link.

Am I confused, or is something broken?

cheers,
Simon

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: Agenda and weather forecast

2010-09-10 Thread Simon Guest
At Thu, 09 Sep 2010 09:30:11 -0400,
George McNinch wrote:
 I had the same trouble at first. Fixed by making sure
 that 
 
 %%(org-google-weather) 
 
 isn't literally at the top of a .org file. 

Together with the recent patch, this works just fine.  Now using
version 5bea6c8 from Thursday 9th September.  All is good.

cheers,
Simon

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Agenda and weather forecast

2010-09-09 Thread Simon Guest
At Thu, 09 Sep 2010 08:19:17 +0200,
Julien Danjou wrote:
 If anybody is interested, I've wrote an small extension to put some
 weather forecasts in the agenda.

Hi Julien,

This looks really cool.

I downloaded google-weather-el-236b269, and stuck 
%%(org-google-weather)
at the top of one of my org files, but when building the agenda, Emacs
complains, after contacting host www.google.com:80, 
bad sexp at line 1 in /home/sjg/share/notes/journal.org: (org-google-weather)

I tried calling directly
(google-weather-get-data New York)
but I just get

Contacting host: www.google.com:80
Reading 453 bytes...
save-current-buffer: Search failed: 



It's not leaving anything around in a buffer for me to see what data
it did or didn't fetch.

Any suggestions?

cheers,
Simon

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Bug in org-colview/org-beamer?

2010-07-31 Thread Simon Guest
Hi,

I'm making my first real Org mode Beamer presentation, using org-mode
7.01g, and trying to set the ignore_heading for a multi-column slide.

In column mode, when I hit 'e' in the Env column, Emacs says:
Wrong type argument: commandp, org-beamer-set-environment-tag
(and org-beamer-set-environment-tag does not appear to be defined
anywhere).

It's triggered from this code in org-colview.el
 ((equal key BEAMER_env)
  (setq eval '(org-with-point-at pom
(call-interactively 'org-beamer-set-environment-tag

Any idea what's wrong?

Please tell me if I should use the bug tracker for this, rather than ask on
the list.

cheers,
Simon

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Choosing external app at runtime?

2010-04-18 Thread Simon Guest
At Sun, 18 Apr 2010 08:24:41 +0200,
Carsten Dominik wrote:
 
 
 On Apr 16, 2010, at 7:35 AM, Simon Guest wrote:
  When I follow a link, Org mode knows what application to use.  Except
  that sometimes I want to override that choice.
 
 Currently we do not have this.  I can see that this could be both  
 useful and annoying, if you have to answer a prompt each time.

If the choice was only offered when a C-u prefix was given, it
wouldn't be annoying.

What do you think?

cheers,
Simon


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Choosing external app at runtime?

2010-04-15 Thread Simon Guest
Hi all,

When I follow a link, Org mode knows what application to use.  Except
that sometimes I want to override that choice.

For example, I have a collection of PDF files.  Mostly I want to open
them in my statically configured PDF viewer, which is fine.  But
sometimes I want to open one in Xournal, say, to annotate it.

My mail client Wanderlust will ask me in cases like this: if multiple
mailcap entries match, I get to choose when opening the attachment.

Any chance we could do a similar thing in Org mode?

cheers,
Simon


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Ordered lists with alphabetic tags?

2010-02-17 Thread Simon Guest
At Mon, 15 Feb 2010 14:51:49 +0100,
Darlan Cavalcante Moreira wrote:
 
 
 Maybe there is a better solution, but you can achieve this with
 
 ** What's your favourite subject?
 #+LaTeX: \renewcommand{\theenumi}{\Alph{enumi}}
 1. Math
 2. Science
 3. English
 #+LaTeX: \renewcommand{\theenumi}{\arabic{enumi}}
 
 The second #+Latex is just to go back to the default behaviour. Also, use
 \alph if you want lowercase and \Alph if you want uppercase.
 
Hi Darlan,

Thanks for that, it works a treat.

cheers,
Simon

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Ordered lists with alphabetic tags?

2010-02-15 Thread Simon Guest
Hi,

I'd like to produce multi-choice questions using Org mode, exporting
via Latex and Beamer mode to PDF.  My choices need to be alphabetic: A
B C, etc, since I am using a set of classroom clickers (aka voting
buttons) for students to select answers, which have buttons labelled A
to H.

So far, I found no way to change numeric to alphabetic in lists, and
the best I can come up with is

** What's your favourite subject?
+ A Maths
+ B Science
+ C English

etc.

I note that numeric lists are formatted really nicely on slides.  Is
there a way of achieving similar with alphabetic?  Would this be a
useful enhancement?

cheers,
Simon

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: Only one org-open-at-point at a time?

2007-10-06 Thread Simon Guest
At Sat, 6 Oct 2007 07:52:03 + (UTC),
Renzo Been wrote:
 
 You could try using a shell link instead of a file link...
 Something like: 
 
 [[shell:kpdf%20foo.pdf][foo.pdf] 
 
 If that doesn't work, you could try to design your own hyperlink type for pdf-
 files.
 See the org-manual (pdf version):
 Appendix A.2 Adding hyperlink types 
 
 Off-course it can also be that your kpdf viewer only allows on file opened at 
 a 
 time?

Hi Renzo,

Bastien already supplied a nice fix which works well - see his email.

cheers,
Simon


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode