[O] how to replace 'org-drawers'

2014-10-06 Thread Alan Schmitt
Hello,

I'm trying to use org-wc, but it fails because org-drawers no longer
exists. Is there a suggestion to change
https://github.com/dato/org-wc/blob/master/org-wc.el#L55 such that it
works with current org?

Thanks,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7


signature.asc
Description: PGP signature


Re: [O] how to replace 'org-drawers'

2014-10-06 Thread Thorsten Jolitz
Alan Schmitt alan.schm...@polytechnique.org writes:

 Hello,

 I'm trying to use org-wc, but it fails because org-drawers no longer
 exists. 

Not???

I still find this

,
| 510:;;; Greater elements
| 544: Center Block
| 594: Drawer
`

in my org-element.el. I guess you mean something else?

PS

#+BEGIN_SRC emacs-lisp
 (call-interactively 'org-version)
#+END_SRC

#+results:
: Org-mode version 8.3beta (release_8.3beta-408-g39f5f0 @ 
/usr/share/emacs/24.3/lisp/org/lisp/)

-- 
cheers,
Thorsten




Re: [O] how to replace 'org-drawers'

2014-10-06 Thread Rasmus
Hi,

Alan Schmitt alan.schm...@polytechnique.org writes:

 I'm trying to use org-wc, but it fails because org-drawers no longer
 exists. Is there a suggestion to change
 https://github.com/dato/org-wc/blob/master/org-wc.el#L55 such that it
 works with current org?

A pragmatic approach is to approximate the org-wc word count by
exporting to LaTeX and then use texcount (sometimes called
texcount.pl) or plain text and use wc.  The former understands math
environments.

—Rasmus

-- 
With monopolies the cake is a lie!




Re: [O] how to replace 'org-drawers'

2014-10-06 Thread Jonathan Leech-Pepin
Hello Alan

On 6 October 2014 08:23, Alan Schmitt alan.schm...@polytechnique.org
wrote:

 Hello,

 I'm trying to use org-wc, but it fails because org-drawers no longer
 exists. Is there a suggestion to change
 https://github.com/dato/org-wc/blob/master/org-wc.el#L55 such that it
 works with current org?


A quick search for variables reveals `org-drawer-regexp` [ ^[
]*:\\(\\(?:\\w\\|[-_]\\)+\\):[ ]*$ ]

It matches both the name of the drawer and `:END:`.

So the function could be adapted to use `org-drawer-regexp` instead
(untested but should match to the next :END:):

((looking-at org-drawer-regexp)
 (while (or (eobp)
(not (looking-at :END:)))
   (re-search-forward org-drawer-regexp nil t)))

Regards,
Jonathan


 Thanks,

 Alan

 --
 OpenPGP Key ID : 040D0A3B4ED2E5C7



Re: [O] how to replace 'org-drawers'

2014-10-06 Thread Alan Schmitt
On 2014-10-06 14:56, Thorsten Jolitz tjol...@gmail.com writes:

 Alan Schmitt alan.schm...@polytechnique.org writes:

 Hello,

 I'm trying to use org-wc, but it fails because org-drawers no longer
 exists. 

 Not???

 I still find this

 ,
 | 510:;;; Greater elements
 | 544: Center Block
 | 594: Drawer
 `

 in my org-element.el. I guess you mean something else?

I mean that the variable does not exist (I also tested this with an org
file):

ELISP org-drawers
*** Eval error ***  Symbol's value as variable is void: org-drawers
ELISP  (call-interactively 'org-version)
Org-mode version 8.3beta (release_8.3beta-412-g4412fe @ 
/Users/schmitta/.emacs.d/org/emacs/site-lisp/org/)

Best,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7


signature.asc
Description: PGP signature


Re: [O] how to replace 'org-drawers'

2014-10-06 Thread Alan Schmitt
On 2014-10-06 17:00, Rasmus ras...@gmx.us writes:

 Hi,

 Alan Schmitt alan.schm...@polytechnique.org writes:

 I'm trying to use org-wc, but it fails because org-drawers no longer
 exists. Is there a suggestion to change
 https://github.com/dato/org-wc/blob/master/org-wc.el#L55 such that it
 works with current org?

 A pragmatic approach is to approximate the org-wc word count by
 exporting to LaTeX and then use texcount (sometimes called
 texcount.pl) or plain text and use wc.  The former understands math
 environments.

Thank you, but the ulterior motive is this:
https://bitbucket.org/gvol/nanowrimo.el

I'm going to try to fix it using Jonathan's suggestion.

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7


signature.asc
Description: PGP signature


Re: [O] how to replace 'org-drawers'

2014-10-06 Thread Alan Schmitt
Hello Jonathan,

On 2014-10-06 11:13, Jonathan Leech-Pepin jonathan.leechpe...@gmail.com 
writes:

 Hello Alan

 On 6 October 2014 08:23, Alan Schmitt alan.schm...@polytechnique.org
 wrote:

 Hello,
 
 I'm trying to use org-wc, but it fails because org-drawers no
 longer
 exists. Is there a suggestion to change
 https://github.com/dato/org-wc/blob/master/org-wc.el#L55 such that
 it
 works with current org?
 

 A quick search for variables reveals `org-drawer-regexp` [ ^[ ]*:\\
 (\\(?:\\w\\|[-_]\\)+\\):[ ]*$ ]

 It matches both the name of the drawer and `:END:`.

 So the function could be adapted to use `org-drawer-regexp` instead
 (untested but should match to the next :END:):

 ((looking-at org-drawer-regexp)
 (while (or (eobp)
 (not (looking-at :END:)))
 (re-search-forward org-drawer-regexp nil t)))

This was a most helpful suggestion. Looking at the commit that got rid
of org-drawers, I saw there is a `org-in-drawer-p' function that works
great. The code is now simply

 ((org-in-drawer-p)
  (forward-line))

Thanks again,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7


signature.asc
Description: PGP signature