emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] Fix clocktable scope parameter


From: Eduardo Bellani
Subject: Re: [O] [PATCH] Fix clocktable scope parameter
Date: Thu, 15 Dec 2016 17:16:01 -0200
User-agent: mu4e 0.9.17; emacs 24.4.1

org-clock.el: Fix clocktable scope parameter

* lisp/org-clock.el (org-dblock-write:clocktable): Make sure to eval
  the scope if it is a lisp expression, or to return the scope if it
  is just a list.

* doc/org.texi: Document the feature of using a function as the scope
  for the clocktable.

This adds back to the clocktable the capacity to have as scope both a
list of file paths or a function that returns such a list.
---
 doc/org.texi      | 1 +
 lisp/org-clock.el | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/org.texi b/doc/org.texi
index 6be76d8..51bd702 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -6638,6 +6638,7 @@ be selected:
              tree       @r{the surrounding level 1 tree}
              agenda     @r{all agenda files}
              ("file"..) @r{scan these files}
+             (function-name) @r{scan the list of files returned by calling 
this function.}
              file-with-archives    @r{current file and its archives}
              agenda-with-archives  @r{all agenda files, including archives}
 :block       @r{The time block to consider.  This block is specified either}
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 65c13fd..2f7db65 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2370,7 +2370,9 @@ the currently selected interval size."
                    (`file-with-archives
                     (and buffer-file-name
                          (org-add-archive-files (list buffer-file-name))))
-                   ((pred consp) scope)
+                    ((and (pred #'listp) (pred (lambda (scope) (symbolp (car 
scope)))))
+                    (funcall (car scope)))
+                    ((pred listp) scope)
                    (_ (or (buffer-file-name) (current-buffer)))))
           (block (plist-get params :block))
           (ts (plist-get params :tstart))
-- 
TINYCHANGE


Thomas S. Dye writes:

> Aloha Eduardo,
>
> orgmanual.org is an old experiment about keeping the org mode manual in
> org mode.
>
> The documentation is in org.texi, and this is the one you should work on
> for new documentation.
>
> All the best,
> Tom
>
> Eduardo Bellani writes:
>
>> Hello everyone,
>>
>> One extra question, about documentation.
>>
>> The place for documenting this feature seems to be 'orgmanual.org'. But
>> my searches revealed that there is also 'org.texi' there. Exporting the
>> first file to the texi format didn't match the second file.
>>
>> Is there a documentation about, well, adding documentation?
>>
>> Thanks.
>>
>> Nicolas Goaziou writes:
>>
>>> Hello,
>>>
>>> Eduardo Bellani <address@hidden> writes:
>>>
>>>> org-clock.el: Fix clocktable scope parameter
>>>>
>>>> * lisp/org-clock.el (org-dblock-write:clocktable): Make sure to eval
>>>>   the scope if it is a lisp expression, or to return the scope if it
>>>>   is just a list.
>>>>
>>>> This adds back to the clocktable the capacity to have as scope both a
>>>> list of file paths or a function that returns such a list.
>>>
>>> Thank you.
>>>
>>> However, I'd rather not introduce more `eval' in the code base.
>>>
>>> Instead, you can test if scope is a function and `funcall' it.  This is
>>> a new feature, which would require some documentation and an entry in
>>> ORG-NEWS.
>>>
>>> Regards,

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]