Re: [O] [PATCH] summarize timestamps in column view

2013-07-01 Thread Pedro Silva
Hi Bastien,

Bastien b...@gnu.org writes:

 It hardly counts as a tiny change, though, as I count 25 lines...
 I'm afraid the patch is larger than what we can accept without
 paperwork.  Would you mind signing the FSF copyright assignment
 (or telling me if you did so already for Emacs)?

I don't mind assigning copyright to FSF at all. I've not done so until now.

   http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt

 That'll leave some time so that someone else can test the patch
 and report about it :)

Sounds good. I'll email ass...@gnu.org after I write this. Should I
revive this thread when the assignment is acknowledged?

Thanks for looking at the patch,
-- 
Pedro



[O] [PATCH] summarize timestamps in column view

2013-06-09 Thread Pedro Silva
* org-colview.el (org-columns-compile-map):
(org-columns-number-to-string):
(org-columns-string-to-number): Handle timestamp summaries.

* org.texi (Column attributes): Document timestamp summaries.

TINYCHANGE
---
 contrib/lisp/org-colview-xemacs.el | 11 ++-
 doc/org.texi   |  3 +++
 lisp/org-colview.el| 11 ++-
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/contrib/lisp/org-colview-xemacs.el 
b/contrib/lisp/org-colview-xemacs.el
index 63c0238..c2cff84 100644
--- a/contrib/lisp/org-colview-xemacs.el
+++ b/contrib/lisp/org-colview-xemacs.el
@@ -901,7 +901,12 @@ around it.
 (@mean mean_age
  (lambda (rest x) (/ (apply '+ x) (float (length x
  (lambda (x) (- org-columns-time x)))
-(est+ estimate org-estimate-combine))
+(est+ estimate org-estimate-combine)
+(min timestamp min org-time-string-to-seconds)
+(max timestamp min org-time-string-to-seconds)
+(mean timestamp
+ (lambda (rest x) (/ (apply '+ x) (float (length x
+ org-time-string-to-seconds))
   Operator - format,function,calc  map.
 Used to compile/uncompile columns format and completing read in
 interactive function `org-columns-new'.
@@ -1190,6 +1195,9 @@ Don't set this, this is meant for dynamic scoping.)
 (defun org-columns-number-to-string (n fmt optional printf)
   Convert a computed column number to a string value, according to FMT.
   (cond
+   ((memq fmt '(timestamp))
+(format-time-string
+ (or printf (car org-time-stamp-formats)) (seconds-to-time n)))
((memq fmt '(estimate)) (org-estimate-print n printf))
((not (numberp n)) )
((memq fmt '(add_times max_times min_times mean_times))
@@ -1218,6 +1226,7 @@ Don't set this, this is meant for dynamic scoping.)
   Convert a column value to a number that can be used for column computing.
   (if s
   (cond
+   ((memq fmt '(timestamp)) s)
((memq fmt '(min_age max_age mean_age))
(cond ((string= s ) org-columns-time)
  ((string-match
diff --git a/doc/org.texi b/doc/org.texi
index 6d5eca0..8b1c49d 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -5497,6 +5497,9 @@ optional.  The individual parts have the following 
meaning:
 @{@@min@}@r{Minimum age (in days/hours/mins/seconds).}
 @{@@max@}@r{Maximum age (in days/hours/mins/seconds).}
 @{@@mean@}   @r{Arithmetic mean of ages (in 
days/hours/mins/seconds).}
+@{min@}@r{Minimum timestamp.}
+@{max@}@r{Maximum timestamp.}
+@{mean@}   @r{Arithmetic mean of timestamps.}
 @{est+@}@r{Add low-high estimates.}
 @end example
 
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index a98deec..f52cb25 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -761,7 +761,12 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column 
format.
 (@mean mean_age
  (lambda (rest x) (/ (apply '+ x) (float (length x
  (lambda (x) (- org-columns-time x)))
-(est+ estimate org-estimate-combine))
+(est+ estimate org-estimate-combine)
+(min timestamp min org-time-string-to-seconds)
+(max timestamp min org-time-string-to-seconds)
+(mean timestamp
+ (lambda (rest x) (/ (apply '+ x) (float (length x
+ org-time-string-to-seconds))
   Operator - format,function,calc  map.
 Used to compile/uncompile columns format and completing read in
 interactive function `org-columns-new'.
@@ -1055,6 +1060,9 @@ Don't set this, this is meant for dynamic scoping.)
 (defun org-columns-number-to-string (n fmt optional printf)
   Convert a computed column number to a string value, according to FMT.
   (cond
+   ((memq fmt '(timestamp))
+(format-time-string
+ (or printf (car org-time-stamp-formats)) (seconds-to-time n)))
((memq fmt '(estimate)) (org-estimate-print n printf))
((not (numberp n)) )
((memq fmt '(add_times max_times min_times mean_times))
@@ -1083,6 +1091,7 @@ Don't set this, this is meant for dynamic scoping.)
   Convert a column value to a number that can be used for column computing.
   (if s
   (cond
+   ((memq fmt '(timestamp)) s)
((memq fmt '(min_age max_age mean_age))
 (cond ((string= s ) org-columns-time)
   ((string-match
-- 
1.8.3




Re: [O] Latex export postamble

2012-04-14 Thread Pedro Silva
Pedro Silva psilva+...@pedrosilva.pt writes:

 Is it possible to insert text just before \end{document} on export,
 similarly to org-export-html-postamble?

 I'd like to do this on a capture target file that contains the following
 at the end:

   \bibliography{references}

 New capture entries keep getting inserted below it, which makes the
 references section appear in the middle of the document if I forget to
 move it to the end again.

 Or maybe there is another way to make this work?

Looking at the relevant code in contrib/org-exp-bibtex.el, I managed to
produce the following, which *almost* works:

(defun org-export-bibliography-preprocess ()
Insert \bibliography and \bibliographystyle commands at end
of buffer if keyword `#+BIBLIOGRAPHY file style' is present in
buffer when exporting via latex backend.
(interactive)
(save-excursion
(goto-char (point-min))
(while (re-search-forward ^#\\+BIBLIOGRAPHY:[ \t]+\\(\\S-+\\)[ 
\t]+\\(\\S-+\\)\\([^\r\n]*\\) nil t)
(let ((file  (match-string 1))
  (style (match-string 2)))  
(when (eq org-export-current-backend 'latex)
(goto-char (point-max))
(insert
 (concat \n#+LATEX: \\bibliographystyle{ style }
 \n#+LATEX: \\bibliography{ file }\n)))

(add-hook 'org-export-preprocess-hook 'org-export-bibliography-preprocess)

Unfortunately, it inserts the latex directives twice, one near the top
of the buffer, and the other one at its end, as expected.  Any ideas why
that is?

Pedro
-- 
Any government will work if authority and responsibility are equal and
coordinate. This does not insure good government; it simply insures
that it will work. But such governments are rare--most people want to
run things but want no part of the blame. This used to be called the
backseat-driver syndrome.
-- Lazarus Long



[O] Latex export postamble

2012-04-13 Thread Pedro Silva
Is it possible to insert text just before \end{document} on export,
similarly to org-export-html-postamble?

I'd like to do this on a capture target file that contains the following
at the end:

\bibliography{references}

New capture entries keep getting inserted below it, which makes the
references section appear in the middle of the document if I forget to
move it to the end again.

Or maybe there is another way to make this work?

Pedro
-- 
Don't try to have the last word. You might get it.
-- Lazarus Long



[O] sectioning depth limit on export

2012-04-12 Thread Pedro Silva
I'm having problems over a document with headings down to a depth of 5
export the levels 4 and 5 as \paragraph and \subparagraph, respectively.

My org-export-latex-classes includes the following:
(article \\documentclass[11pt]{article}
 (\\section{%s} . \\section*{%s})
 (\\subsection{%s} . \\subsection*{%s})
 (\\subsubsection{%s} . \\subsubsection*{%s})
 (\\paragraph{%s} . \\paragraph*{%s})
 (\\subparagraph{%s} . \\subparagraph*{%s}))

My source document includes the following:
#+LaTeX_CLASS: article, my org-export-latex-class is article, and my
org-export-latex-sectioning-depth is locally set to 6 (default is 3).

According to the More Highly-Structured Documents subsection of Latex
Export worg tutorial
http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-3

This setup should produce the following document structure, when
exported to LaTeX:

* section
** subsection
*** subsubsection
 paragraph
* subparagraph

However, this is what is produced:

* section
** subsection
*** subsubsection
 itemize
* sub-itemize, etc

This happens with all export types I've tried, namely LaTeX, HTML, and
plain text.  Any ideas about how to force export of 4 and 5-level deep
headings as paragraph and subparagraph headings in LaTeX?
-- 
Pedro



Re: [O] sectioning depth limit on export

2012-04-12 Thread Pedro Silva
Nick Dokos nicholas.do...@hp.com writes:

 Try setting org-export-headline-levels to 6 or use the equivalent in-buffer 
 setting

 #+OPTIONS: H:6


Ah, that did it.  Thanks for your help!
-- 
Pedro