Re: [O] Table of contents for just one section?

2014-10-26 Thread Nicolas Goaziou
Hello,

D. C. Toedt d...@toedt.com writes:

 The local keyword would be great.

The following patch implements local tocs for ascii, html and odt export
back-ends. I skipped latex because using minitoc looks too tricky to
automate.

Feedback welcome.


Regards,

-- 
Nicolas Goaziou
From 56e720f11c172b16a72fb1ddb9ad78405361646d Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou m...@nicolasgoaziou.fr
Date: Sat, 25 Oct 2014 17:14:34 +0200
Subject: [PATCH] ox: Implement local table of contents

* lisp/ox.el (org-export-collect-headlines): Allow to collect
  headlines locally.
* testing/lisp/test-ox.el (test-org-export/collect-headlines): Add
  tests.

* lisp/ox-ascii.el (org-ascii--build-toc):
(org-ascii-keyword):
* lisp/ox-html.el (org-html-toc):
(org-html-keyword):
* lisp/ox-latex.el (org-latex-keyword):
* lisp/ox-odt.el (org-odt-toc): Allow local table of contents.
---
 lisp/ox-ascii.el| 33 +
 lisp/ox-html.el | 21 +++--
 lisp/ox-latex.el| 16 +++-
 lisp/ox-odt.el  | 35 ++-
 lisp/ox.el  | 31 ++-
 testing/lisp/test-ox.el | 14 +-
 6 files changed, 88 insertions(+), 62 deletions(-)

diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el
index daad00f..ff0a5f4 100644
--- a/lisp/ox-ascii.el
+++ b/lisp/ox-ascii.el
@@ -744,7 +744,7 @@ caption keyword.
 		 (org-export-data caption info))
 	 (org-ascii--current-text-width element info) info)
 
-(defun org-ascii--build-toc (info optional n keyword)
+(defun org-ascii--build-toc (info optional n keyword local)
   Return a table of contents.
 
 INFO is a plist used as a communication channel.
@@ -753,7 +753,10 @@ Optional argument N, when non-nil, is an integer specifying the
 depth of the table.
 
 Optional argument KEYWORD specifies the TOC keyword, if any, from
-which the table of contents generation has been initiated.
+which the table of contents generation has been initiated.
+
+When optional argument LOCAL is non-nil, build a table of
+contents according to the current headline.
   (let ((title (org-ascii--translate Table of Contents info)))
 (concat
  title \n
@@ -775,7 +778,7 @@ which the table of contents generation has been initiated.
 	  (or (not (plist-get info :with-tags))
 		  (eq (plist-get info :with-tags) 'not-in-toc))
 	  'toc
-	(org-export-collect-headlines info n) \n)
+	(org-export-collect-headlines info n keyword) \n)
 
 (defun org-ascii--list-listings (keyword info)
   Return a list of listings.
@@ -1452,24 +1455,22 @@ contextual information.
   Transcode a KEYWORD element from Org to ASCII.
 CONTENTS is nil.  INFO is a plist holding contextual
 information.
-  (let ((key (org-element-property :key keyword)))
+  (let ((key (org-element-property :key keyword))
+	(value (org-element-property :value keyword)))
 (cond
- ((string= key ASCII)
-  (org-ascii--justify-element
-   (org-element-property :value keyword) keyword info))
+ ((string= key ASCII) (org-ascii--justify-element value keyword info))
  ((string= key TOC)
   (org-ascii--justify-element
-   (let ((value (downcase (org-element-property :value keyword
+   (let ((case-fold-search t))
 	 (cond
-	  ((string-match \\headlines\\ value)
-	   (let ((depth (or (and (string-match [0-9]+ value)
- (string-to-number (match-string 0 value)))
-			(plist-get info :with-toc
-	 (org-ascii--build-toc
-	  info (and (wholenump depth) depth) keyword)))
-	  ((string= tables value)
+	  ((org-string-match-p \\headlines\\ value)
+	   (let ((depth (and (string-match \\[0-9]+\\ value)
+			 (string-to-number (match-string 0 value
+		 (localp (org-string-match-p \\local\\ value)))
+	 (org-ascii--build-toc info depth keyword localp)))
+	  ((org-string-match-p \\tables\\ value)
 	   (org-ascii--list-tables keyword info))
-	  ((string= listings value)
+	  ((org-string-match-p \\listings\\ value)
 	   (org-ascii--list-listings keyword info
keyword info)
 
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index c2152d9..276cb67 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2017,16 +2017,17 @@ a plist used as a communication channel.
 
 ;;; Tables of Contents
 
-(defun org-html-toc (depth info)
+(defun org-html-toc (depth info optional scope)
   Build a table of contents.
-DEPTH is an integer specifying the depth of the table.  INFO is a
-plist used as a communication channel.  Return the table of
-contents as a string, or nil if it is empty.
+DEPTH is an integer specifying the depth of the table.  INFO is
+a plist used as a communication channel.  Optional argument SCOPE
+is an element defining the scope of the table.  Return the table
+of contents as a string, or nil if it is empty.
   (let ((toc-entries
 	 (mapcar (lambda (headline)
 		   (cons (org-html--format-toc-headline headline info)
 			 (org-export-get-relative-level headline 

[O] Using sessions.

2014-10-26 Thread abonnements

Hi,
   I would like to know if it is possible to desactivate a previously 
open session.

Example :
* Test
:PROPERTIES:
:HEAGER-ARGS: :session SESS-TEST
:END:

 some code in session mode

#+begin_src python
... some code for which I dont what to use the session.
#+end_src

Is there something like :session NONE or :session DISABLE?

Thanks.
Thierry



[O] Hidden named blocks.

2014-10-26 Thread abonnements

Hello,
I would like to know if there is, or if it is simple, to have a 
#+STARTUP: hideblocks like option which allow to fold named blocks 
leaving only the #+name:


Example
#+name: test
#+header: :var foo=10
#+begin_src python
...
#+end_src

is displayed on the opening of the file folded this way
#+name: test ...

instead of
#+name: test
#+header: :var foo=10
#+begin_src python ...

Ta.
Thierry



Re: [O] Hidden named blocks.

2014-10-26 Thread Nicolas Goaziou
Hello,

abonnements abonneme...@thierry-pelle.eu writes:

  I would like to know if there is, or if it is simple, to have a 
 #+STARTUP: hideblocks like option which allow to fold named blocks 
 leaving only the #+name:

 Example
 #+name: test
 #+header: :var foo=10
 #+begin_src python
 ...
 #+end_src

 is displayed on the opening of the file folded this way
 #+name: test ...

 instead of
 #+name: test
 #+header: :var foo=10
 #+begin_src python ...

There is no such option. Note that order between name and header may
be reversed, which could be confusing.


Regards,

-- 
Nicolas Goaziou



Re: [O] Hidden named blocks.

2014-10-26 Thread abonnements

Thanks, that's what I supposed.

But when you hit TAB on a #+name:  line it fold the block to the 
#+end_XXX.

This is not the case for a #+header: line.

So such a folding stuff may be easy to implement no?

Thierry

Le 26/10/2014 11:19, Nicolas Goaziou a écrit :

Hello,

abonnements abonneme...@thierry-pelle.eu writes:


  I would like to know if there is, or if it is simple, to have a
#+STARTUP: hideblocks like option which allow to fold named blocks
leaving only the #+name:

Example
#+name: test
#+header: :var foo=10
#+begin_src python
...
#+end_src

is displayed on the opening of the file folded this way
#+name: test ...

instead of
#+name: test
#+header: :var foo=10
#+begin_src python ...

There is no such option. Note that order between name and header may
be reversed, which could be confusing.


Regards,






Re: [O] Table of contents for just one section?

2014-10-26 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Hello,

 D. C. Toedt d...@toedt.com writes:

 I'd like to do sub-TOCs for individual sections and subsections.

 We could add a local keyword to TOC lines, e.g.,

   #+TOC: headlines 1 local

 would mean only top level children in current headline.

 This feature is trivial to add to ox-ascii, probably easy for ox-html or
 ox-odt, assuming someone can provide the expected code.

 Implementing it in ox-latex probably boils down to requiring another
 package (minitoc?).

I'm pretty sure you need an exernal package.  titletoc or minitoc.  At
least memoir seems to have issues with minitoc.  KOMA-Script seems to
be ok.  titletoc scores points for having a 24 pages manual, versus
800+ pages.  Personally, I don't like the default style of minitoc.

 WDYT?

It's neat and I'd probably never use it.

—Rasmus

-- 
Hooray!




Re: [O] Table of contents for just one section?

2014-10-26 Thread D. C. Toedt
Many thanks!  I'll wait till this shows up in the package updater (I've
toyed with Git only enough to be dangerous) but am eagerly looking forward
to trying it.



D. C. (Dell Charles) Toedt III  *(my** last name is pronounced Tate) *
Attorney and neutral arbitrator -- tech contracts and intellectual property
Lecturer, University of Houston Law Center
​Editor, ​​​Common Draft http://www.commondraft.org/ contract form file
d...@toedt.com LinkedIn: dctoedt http://www.linkedin.com/in/dctoedt
Calendar
https://www.google.com/calendar/embed?src=dc.to...@toedt.commode=WEEK
(redacted)
O: +1 (713) 364-6545C: +1 (713) 516-8968
​​

​
Houston, Texas (Central time zone)

Unless expressly stated otherwise, this message is not intended
to serve as an electronic signature nor as assent to an agreement.



On Sun, Oct 26, 2014 at 3:15 AM, Nicolas Goaziou m...@nicolasgoaziou.fr
wrote:

 Hello,

 D. C. Toedt d...@toedt.com writes:

  The local keyword would be great.

 The following patch implements local tocs for ascii, html and odt export
 back-ends. I skipped latex because using minitoc looks too tricky to
 automate.

 Feedback welcome.


 Regards,

 --
 Nicolas Goaziou



Re: [O] Table of contents for just one section?

2014-10-26 Thread Rasmus
Hi,

Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 I skipped latex because using minitoc looks too tricky to
 automate.

Sorry, I didn't see this when I posted my other post.

I think we can do it with titletoc.  I have used other functionality
of titletoc, and it 'doesn't sucks'ᵀᴹ.  Below is an example.  The
output is more inline with normal tocs, but you can also style it
[I've used this for making paragraph-TOCs in the past].

So ox-latex needs to insert at least the following to initialize a
local TOC

   \startcontents[ID-level] % need not be unique and might not be neceasary
   \printcontents[ID-level]{}{(1+ level)}{TOC OPTIONS}

And, importantly — and mildely annoyingly — \startcontents[ID] *after*
the next heading of the same level.  There are some preamble options,
but since we are doing it programically, it might be safer to insert
it into the body.

It seems it need not be same unique ID.

An example:

\documentclass{book}
\usepackage{titletoc}
\begin{document}
\part{p1}
\startcontents[level-0]
\printcontents[level-0]{}{0}{\setcounter{tocdepth}{2}}
\chapter{c1}
\startcontents[level-1]
\printcontents[level-1]{}{1}{\setcounter{tocdepth}{1}}
\section{s1} \subsection{s2}
\chapter{c2}
\startcontents[level-1]
\section{s3}
\part{p2}
\startcontents[level-0]
\chapter{c3}
\end{document}

The only challenge is to insert \startcontents[ID] in the next
headline of same level.  The brute force method would be very bad.
Maybe doing it like section numbers are determined?

Let me know what you think and whether you will do it.

—Rasmus

-- 
What will be next?




Re: [O] Hidden named blocks.

2014-10-26 Thread Nicolas Goaziou
abonnements abonneme...@thierry-pelle.eu writes:

 Thanks, that's what I supposed.

 But when you hit TAB on a #+name:  line it fold the block to the
 #+end_XXX.
 This is not the case for a #+header: line.

I think you're using an outdated Org.

 So such a folding stuff may be easy to implement no?

As I wrote already, it would be confusing. The current behaviour (in
a recent Org) makes more sense.


Regards,

-- 
Nicolas Goaziou



Re: [O] Table of contents for just one section?

2014-10-26 Thread Nicolas Goaziou
Hello,

Rasmus ras...@gmx.us writes:

 I think we can do it with titletoc.  I have used other functionality
 of titletoc, and it 'doesn't sucks'ᵀᴹ.  Below is an example.  The
 output is more inline with normal tocs, but you can also style it
 [I've used this for making paragraph-TOCs in the past].

 So ox-latex needs to insert at least the following to initialize a
 local TOC

\startcontents[ID-level] % need not be unique and might not be neceasary
\printcontents[ID-level]{}{(1+ level)}{TOC OPTIONS}

 And, importantly — and mildely annoyingly — \startcontents[ID] *after*
 the next heading of the same level.

I don't quite get this part. Does that string need to be inserted only
after the second sibling (i.e., not after the third, too)? What happens
if there is no other sibling?

 There are some preamble options, but since we are doing it
 programically, it might be safer to insert it into the body.

The patch will not insert \usepackage{titletoc} for the user, however,
à la `org-latex-listings'.

 It seems it need not be same unique ID.

 An example:

 \documentclass{book}
 \usepackage{titletoc}
 \begin{document}
 \part{p1}
 \startcontents[level-0]
 \printcontents[level-0]{}{0}{\setcounter{tocdepth}{2}}
 \chapter{c1}
 \startcontents[level-1]
 \printcontents[level-1]{}{1}{\setcounter{tocdepth}{1}}
 \section{s1} \subsection{s2}
 \chapter{c2}
 \startcontents[level-1]
 \section{s3}
 \part{p2}
 \startcontents[level-0]
 \chapter{c3}
 \end{document}

 The only challenge is to insert \startcontents[ID] in the next
 headline of same level.  The brute force method would be very bad.

What do you call the brute force?

 Maybe doing it like section numbers are determined?

What do you mean?

 Let me know what you think and whether you will do it.

I can try to implement it.

I also note that these tocs do not have any title. Would it make sense
to remove title from local tocs in other back-ends too?

Thanks for your feedback.


Regards,

-- 
Nicolas Goaziou



Re: [O] working with tables freezes emacs

2014-10-26 Thread Nicolas Goaziou
Hello,

Rasmus ras...@gmx.us writes:

 It happened to me now when I was editing a table and clicked TAB.

 Debugger entered--beginning evaluation of function call form:
 * (byte-code \301\302\303!\207 [quit-flag t eval (ignore nil)] 2)
   flyspell-post-command-hook()
   recursive-edit()
   debug(error (quit))

 flyspell-post-command-hook

 This function is advised by

  :around advice: `ad-Advice-flyspell-post-command-hook'

 From ac.  I have not removed this since I don't use ac anymore.  Maybe
 this will solve the issue.

Unfortunately there is not much information to chew on, so I cannot
tell.


Regards,

-- 
Nicolas Goaziou



Re: [O] Hidden named blocks.

2014-10-26 Thread abonnements

When I write my first post i was using version 8.2.7c.

The behaviour of TAB on an #+name: ligne is the same with 8.2.10 
(installed with package-install from elpa)...


Sorry but can you explain me the normal behavour of TAB.
Thanks.

Le 26/10/2014 13:42, Nicolas Goaziou a écrit :

abonnements abonneme...@thierry-pelle.eu writes:


Thanks, that's what I supposed.

But when you hit TAB on a #+name:  line it fold the block to the
#+end_XXX.
This is not the case for a #+header: line.

I think you're using an outdated Org.


So such a folding stuff may be easy to implement no?

As I wrote already, it would be confusing. The current behaviour (in
a recent Org) makes more sense.


Regards,






Re: [O] Hidden named blocks.

2014-10-26 Thread Nicolas Goaziou
abonnements abonneme...@thierry-pelle.eu writes:

 When I write my first post i was using version 8.2.7c.

 The behaviour of TAB on an #+name: ligne is the same with 8.2.10
 (installed with package-install from elpa)...

 Sorry but can you explain me the normal behavour of TAB.
 Thanks.

  #+header: test
  #+name: test
  #+BEGIN_SRC emacs-lisp
  (+ 1 1)
  #+END_SRC

=

  #+header: test
  #+name: test
  #+BEGIN_SRC emacs-lisp ...


and

  #+name: test
  #+header: test
  #+BEGIN_SRC emacs-lisp
  (+ 1 1)
  #+END_SRC

=

  #+name: test
  #+header: test
  #+BEGIN_SRC emacs-lisp ...

IOW, affiliated keywords are never hidden.


Regards,

-- 
Nicolas Goaziou



Re: [O] Using sessions.

2014-10-26 Thread Andreas Leha
Hi Thierry,

abonnements abonneme...@thierry-pelle.eu writes:
 Hi,
 I would like to know if it is possible to desactivate a previously 
 open session.
 Example :
 * Test
 :PROPERTIES:
 :HEAGER-ARGS: :session SESS-TEST
 :END:

  some code in session mode

 #+begin_src python
 ... some code for which I dont what to use the session.
 #+end_src

 Is there something like :session NONE or :session DISABLE?


There is:  :session none

Best,
Andreas




Re: [O] Table of contents for just one section?

2014-10-26 Thread Rasmus
Hi,

Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Rasmus ras...@gmx.us writes:

 I think we can do it with titletoc.  I have used other functionality
 of titletoc, and it 'doesn't sucks'ᵀᴹ.  Below is an example.  The
 output is more inline with normal tocs, but you can also style it
 [I've used this for making paragraph-TOCs in the past].

 So ox-latex needs to insert at least the following to initialize a
 local TOC

\startcontents[ID-level] % need not be unique and might not be neceasary
\printcontents[ID-level]{}{(1+ level)}{TOC OPTIONS}

 And, importantly — and mildely annoyingly — \startcontents[ID] *after*
 the next heading of the same level.

 I don't quite get this part. Does that string need to be inserted only
 after the second sibling (i.e., not after the third, too)? What happens
 if there is no other sibling?

Ah, it's much easier to use \stopcontents[level-i] to end contents
collection.  Revising the example:

 \documentclass{book}
 \usepackage{titletoc}
 \begin{document}
 \part{p1}
 \startcontents[level-0]
 \printcontents[level-0]{}{0}{\setcounter{tocdepth}{2}}
 \chapter{c1}
 \startcontents[level-1]
 \printcontents[level-1]{}{1}{\setcounter{tocdepth}{1}}
 \section{s1} \subsection{s2}
 \stopcontents[level-1]
 \chapter{c2}
 \section{s3}
 \stopcontents[level-0]
 \part{p2}\chapter{c3}
 \end{document}

Note that the contents is determined by the .pcf file.  Maybe that's
easier to to understand than my babeling.  Also, pcf should be added
to `org-latex-logfiles-extensions'.

 There are some preamble options, but since we are doing it
 programically, it might be safer to insert it into the body.

 The patch will not insert \usepackage{titletoc} for the user, however,
 à la `org-latex-listings'.

Great.

 What do you call the brute force?

I meant to insert \startcontents[ID-level] after each, say, chapter
unconditionally rather than inserterting as few
\startcontents[ID-level] as possible.  But ignore that:
\stopcontents[ID-level] it's much cleaner.

 Let me know what you think and whether you will do it.

 I can try to implement it.

 I also note that these tocs do not have any title. Would it make sense
 to remove title from local tocs in other back-ends too?

No idea.  Both makes sense, but maybe including the TOC-title is too
verbose?  In any case, I think it's easy to add a title if you.  Based
on article.cls and book.cls, I think we can generalize the toc-title
to heading one level down in level and unnumbered with title
\contentsname.  The TOC title for chapter is thus
\section*{\contentsname}.  For \part it's \chapter*{\contentsname}.  I
guess you can use the cdr in level part of `org-latex-classes', though
it would be incompatible with e.g. \addsec{·} of KOMA-Script.

—Rasmus

Article.cls:

\newcommand\tableofcontents{%
\section*{\contentsname
\@mkboth{%
   \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\@starttoc{toc}%
}

Book.cls:

\newcommand\tableofcontents{%
\if@twocolumn
  \@restonecoltrue\onecolumn
\else
  \@restonecolfalse
\fi
\chapter*{\contentsname
\@mkboth{%
   \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\@starttoc{toc}%
\if@restonecol\twocolumn\fi
}

—Rasmus

-- 
And I faced endless streams of vendor-approved Ikea furniture. . .




Re: [O] working with tables freezes emacs

2014-10-26 Thread Rasmus
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Rasmus ras...@gmx.us writes:

 It happened to me now when I was editing a table and clicked TAB.

 Debugger entered--beginning evaluation of function call form:
 * (byte-code \301\302\303!\207 [quit-flag t eval (ignore nil)] 2)
   flyspell-post-command-hook()
   recursive-edit()
   debug(error (quit))

 flyspell-post-command-hook

 This function is advised by

  :around advice: `ad-Advice-flyspell-post-command-hook'

 From ac.  I have not removed this since I don't use ac anymore.  Maybe
 this will solve the issue.

 Unfortunately there is not much information to chew on, so I cannot
 tell.

I'm still unable to make an example that will break down Emacs.

However, working with {entities, tables and flyspell} does give a
slowdown even in emacs -q, though not to the extend that Emacs becomes
unusable.

—Rasmus

-- 
This is the kind of tedious nonsense up with which I will not put




[O] Add links with capture mode

2014-10-26 Thread Sikandar Mashayak
Hi,

I have recently started using org mode. And I am trying out capture mode. I
have two org files one for tasks and another for notes. I keep all the
todos in tasks.org and notes in notes.org. So whenever, I need to record
some notes related a todo item in tasks.org I use capture mode and enter
notes in the notes.org. From the org mode manual, I could figure out how to
automatically enter a link to the todo item in the notes.org, i.e., by
using %a template expansion.

However, my question is that how to automatically enter a link to the notes
item near the todo item in the tasks.org?

Thanks,
Sikandar


Re: [O] Table of contents for just one section?

2014-10-26 Thread Rasmus
Rasmus ras...@gmx.us writes:

 I also note that these tocs do not have any title. Would it make sense
 to remove title from local tocs in other back-ends too?

 No idea.  Both makes sense, but maybe including the TOC-title is too
 verbose?  In any case, I think it's easy to add a title if you.  Based
 on article.cls and book.cls, I think we can generalize the toc-title
 to heading one level down in level and unnumbered with title
 \contentsname.  The TOC title for chapter is thus
 \section*{\contentsname}.  For \part it's \chapter*{\contentsname}.  I
 guess you can use the cdr in level part of `org-latex-classes', though
 it would be incompatible with e.g. \addsec{·} of KOMA-Script.

To be clear for chapters the command would be:

\printcontents[level-1]{}{0}{\setcounter{tocdepth}{1}%
\section*{\contentsname}}

-- 
C is for Cookie




Re: [O] [RFC] Change property drawer syntax

2014-10-26 Thread Nicolas Goaziou
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 As discussed previously, I would like to modify property drawers syntax.
 The change is simple: they must be located right after a headline and
 its planning line, if any.

[...]

 I pushed a new branch, top-properties in the repository for code
 review and testing. It includes unit tests, documentation and an
 ORG-NEWS entry.

 Feedback welcome.

If there is no more feedback or objection, I will merge the branch on
Tuesday.



[O] how to avoid item expansion when changing status?

2014-10-26 Thread Maciej Kalisiak
When I do C-c t d (TODO - DONE) or similar status change on a TODO item,
it accumulates meta-data like:
  CLOSED: [2014-10-26 Sun 11:25]
  - State DONE   from TODO   [2014-10-26 Sun 11:25]
So each such item blows up on screen from 1 line to 3 lines.

I do want to collect this data, but I do not want to necessarily see it
when I'm just marking things DONE... there is no value to me seeing this at
that point.

However, in some situations, I wish I knew which, when I change the status,
the metadata is added BUT the item remains collapsed. I'd like to have this
always happen. Can anyone suggest how to achieve this?


Re: [O] Org-mode Habit with Varying Description

2014-10-26 Thread Eric Abrahamsen
Pete Ley peteley11...@gmail.com writes:

 All I've got now are a function that finds the logbook, and another that
 parses the log items and normalizes them: extracts the TODO
 states/timestamps/key-values and sets them as properties on the items
 themselves. Then you've got a pretty good basis from which to do
 reporting.

 Hooking into note-taking and todo state-change logging to prompt for
 values should be easy.

 I don't know yet how to approach the reporting part, mostly because I
 haven't sat down and thought about how this would be most useful. It
 will also require reading org-clock and org-habit in detail -- clearly
 reporting to a table like they do is the right way to go.

 How to get the most out of the data? I was thinking of having
 COLUMN_FORMULA and TABLE_FORMULA properties on the heading. When you
 report from the heading, each key in the logbook data creates a table
 column. Each column formula property creates another column, populated
 by that formula (presumably calculated from the data columns). Then the
 table formula gets slapped on to the bottom of it, and the whole thing
 runs.

 So if you had a heading like this:

 * TODO Anneal galoshes
   :LOGBOOK:
   GALOSHES: 15; CLOCK: [2014-10-15 Wed 09:07]--[2014-10-15 Wed 17:10] =  
 8:03
   GALOSHES: 13; CLOCK: [2014-10-14 Tue 08:50]--[2014-10-14 Tue 16:30] =  
 7:40
   GALOSHES: 14; CLOCK: [2014-10-13 Mon 09:30]--[2014-10-13 Mon 17:06] =  
 7:36
   :END:

 You'd end up with a table with two data columns. Then you could have a
 COLUMN_FORMULA property that created a third column, displaying galoshes
 annealed per hour. And a TABLE_FORMULA property that did... something...
 with all that information.

 In a sense, it's a bit like column view, except using logbook data
 rather than property values.

 This sounds pretty great. I'd like to see the functions you have anyway,
 seems like something the community might find useful. I know I could
 find a few use cases for it.

Hmm, the underlying code has changed since I started working on this.

Nicolas, can I ask your advice here? I need to rewrite an earlier
function which returned a heading's log list, or returned nil. I'd be
happy with a function that returned the starting point of the log
list, or nil.

Right now it looks like the central cond statement in
`org-add-log-setup' is as close as we've got to a canonical definition
of where a heading's log list is to be found. Should I just write my own
version of this, or would you be open to refactoring `org-add-log-setup'
so the finding part is a separate function that can be reused
elsewhere?

Thanks,
Eric




Re: [O] refiling as child with function-filing-location

2014-10-26 Thread Eric Abrahamsen
Per Unneberg punneb...@gmail.com writes:

 Hi,

 I'm writing a custom function for use with a capture template, as
 described in the section Template elements (sec 9.1.3.1) of the info
 manual. My function does what I expect in that it finds the correct
 heading (in my use case Log) and returns point. However, if the Log
 heading has no children, the capture template is filed as a sibling, and
 not a child. I have spent some time now on this seemingly simple
 problem, but being a newbie on elisp I must admit I'm stuck.

I'm messing about with some similar template-placement routines, so I
tried your recipe below, and it worked for me... Capture by default will
create a child of the heading point is on, so I really don't see why
this wouldn't work. You've stepped through the function and confirmed
that the (goto-char (point-at-bol)) line leaves you at the Log
heading?

Is the tree structure folded or open at the time? You might try an
(org-reveal) after the (org-clock-goto); I'm still not really clear on
the interaction between visibility and heading insertion.

I think you're note about if cursor is at beginning of headline, same
level used doesn't really apply here, as the capture process does a lot
more than just pasting a subtree.

Anyway, I can't reproduce the problem -- do try messing with
visibility...

Eric




Re: [O] [PATH] Speedups to org-table-recalculate

2014-10-26 Thread Michael Brand
Hi Nathaniel

On Sun, Oct 26, 2014 at 2:27 AM, Nathaniel Flath flat0...@gmail.com wrote:
 I'm fine with adding the (when all log-first-time).  I don't want to leave
 it unconditional

Ok, then I agree on (when all log-first-time).

Michael



[O] Mute tasks in agenda weekly view

2014-10-26 Thread Chris Drane
I think it would be helpful if on the weekly agenda view there were a way
to hide a task for one day only. For example, if there were a task that I
knew I wouldn't get to today, I could hit 'm', the status would stay as
TODO, but it wouldn't show up under this particular agenda view.

The only semi-relevant discussion I could find is this:
http://thread.gmane.org/gmane.emacs.orgmode/10229/focus=10233. However,
this discussion pertained more to tasks that were being scheduled at day
zero , and which wouldn't be completed until day twenty.

Any thoughts on how to do this?


Re: [O] how to avoid item expansion when changing status?

2014-10-26 Thread Chris Drane
You could hide the state changes if you put (setq org-log-into-drawer
LOGBOOK) in your init file. I don't know how to hide the CLOSED tag
though.

On Sun, Oct 26, 2014 at 11:32 AM, Maciej Kalisiak mkalis...@gmail.com
wrote:

 When I do C-c t d (TODO - DONE) or similar status change on a TODO item,
 it accumulates meta-data like:
   CLOSED: [2014-10-26 Sun 11:25]
   - State DONE   from TODO   [2014-10-26 Sun 11:25]
 So each such item blows up on screen from 1 line to 3 lines.

 I do want to collect this data, but I do not want to necessarily see it
 when I'm just marking things DONE... there is no value to me seeing this at
 that point.

 However, in some situations, I wish I knew which, when I change the
 status, the metadata is added BUT the item remains collapsed. I'd like to
 have this always happen. Can anyone suggest how to achieve this?




[O] org-capture/remember in Emacs 24.4.1?

2014-10-26 Thread Benjamin Slade
I had the following snippets in my .emacs which allowed me to call up a
mini-emacsclient frame to quickly add notes and TODOs etc.  It doesn't
seem to work anymore (it comes up, but as soon as I choose [t], [n]
etc. it disappears).  Is there an updated recommendation on how to do
this?

###
(defcustom remember-frame-alist nil
Additional frame parameters for dedicated remember frame.
:type 'alist
:group 'remember)

(defadvice remember (around remember-frame-parameters activate)
Set some frame parameters for the remember frame.
(let ((default-frame-alist (append remember-frame-alist default-frame-alist)))
ad-do-it))

;;;

(defun make-remember-frame ()
  turn the current frame into a small popup frame for remember mode;
 this is meant to be called with 
  emacsclient -c -e '(make-remember-frame)'
  (modify-frame-parameters nil
   '( (name . *Remember*) ;; must be same as in 
mode-hook below  
  (width .  80)
  (height . 20)
  (vertical-scroll-bars . nil)
  (menu-bar-lines . nil)
  (tool-bar-lines . nil)))
  (set-frame-parameter (selected-frame) 'alpha '(85 50))
  (org-capture)
  (when (fboundp 'x-focus-frame) (x-focus-frame nil)) ;; X only
  (delete-other-windows)
  ) 

;; when we're in such a remember-frame, close it when done. (doesn't work when 
cancelled...)
(add-hook 'org-capture-mode-hook
  (lambda()
(define-key org-capture-mode-map (kbd C-c C-c)
  '(lambda()(interactive)
 (let ((capture-frame-p 
(string= (frame-parameter nil 'name) *Remember*)))
   (when capture-frame-p (make-frame-invisible))  ;; hide 
quickly
   (org-capture-finalize)
   (when capture-frame-p (delete-frame)))


(setq org-capture-templates
  '((t Todo entry (file+headline ~/Documents/Org/ToDo.org Captured 
Tasks)
 * TODO %?\n  %i\n  %a)
(n Notes entry (file+headline ~/Documents/Org/Notes.org Captured 
Notes)
 * %?\nEntered on %U\n  %i\n  %a)
(m Meetings entry (file ~/Documents/Org/Meetings.org )
 * %?\n %i\n  %a)
(c Clipboard entry (file+headline ~/Documents/Org/Notes.org 
Captured Notes)
 * %x %?\nEntered on %U\n  %i\n  %a)))
##

~
Dr Benjamin Slade
pgp fingerprint: 21BA 2AE1 28F6 DF36 110A 0E9C A320 BBE8 2B52 EE19
~
{sent by mu4e on Emacs running under GNU/Linux}
(Choose Linux, Choose Freedom)