emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* need file+function help
@ 2013-04-04 18:42 Subhan Tindall
  2013-04-05 23:09 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Subhan Tindall @ 2013-04-04 18:42 UTC (permalink / raw)
  To: Org-Mode

[-- Attachment #1: Type: text/plain, Size: 1471 bytes --]

There's really very little documentation about how this works, could use a
pointer to an example or two, or even a bit of help.

Here's my goal:
Using a capture temple of file+function to do the following: (basically
enhancing file+datetree)
user enters a bit of information (ticket ID, description, etc) using normal
capture template stuff (prompt for tags or prompt{enter ticket ID}
the ticket number is used as a parameter to file+function to:
a) find the current date in the tree
b) find or create a subtree based on the ticket ID
c) add an entry below this subtree with the ticket ID as a tag, and the
description as the headline, plus possible links to the file where capture
was initiated etc.
d) 'clock in' to the task (:clock-in property works great)

I have all of this working fine using file+datetree EXCEPT the subtree
create or add

questions:
1) are the values gathered by capture available to the function specified
for file+function, & if so what are their names?
2) what is the general template for a function for use with file+function,
cleanup, return values, etc that would be expected?
3) would it be better to extend datetree to datetree+headline for entries
of this type? it seems like it a pretty usefully functionality to have (I
can think of 2 or 3 instances i'd regularly use this just off the top of my
head
Thanks, all!
Subhan



-- 
Subhan Michael Tindall | Software Developer
| smt@rentrakmail.com
RENTRAK | www.rentrak.com | NASDAQ: RENT

[-- Attachment #2: Type: text/html, Size: 1993 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: need file+function help
  2013-04-04 18:42 need file+function help Subhan Tindall
@ 2013-04-05 23:09 ` Bastien
  2013-04-09 22:37   ` Subhan Tindall
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2013-04-05 23:09 UTC (permalink / raw)
  To: Subhan Tindall; +Cc: Org-Mode

Hi Subhan,

Subhan Tindall <subhan.tindall@rentrakmail.com> writes:

> questions:
> 1) are the values gathered by capture available to the function
> specified for file+function, & if so what are their names?

No.

> 2) what is the general template for a function for use with
> file+function, cleanup, return values, etc that would be expected?

The function is expected to find a location where to put the new
entry, not to return any specific value, and if it returns a value,
the value is ignored.  It can also act on the subtree at the location
it has found, but this is slightly abusing the feature I'd say.

> 3) would it be better to extend datetree to datetree+headline for
> entries of this type? it seems like it a pretty usefully
> functionality to have (I can think of 2 or 3 instances i'd regularly
> use this just off the top of my head

"datetree+headline" is improper, because a location in a datetree is
a headline... so maybe your best chance is to use (function ...) or
(file+function ...) and try to see if the function can interactively
prompt for the values you want and edit the location as you want.
But again, this goes beyond the purpose of function, which is to
find to location.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: need file+function help
  2013-04-05 23:09 ` Bastien
@ 2013-04-09 22:37   ` Subhan Tindall
  2013-04-09 22:57     ` John Hendy
  0 siblings, 1 reply; 4+ messages in thread
From: Subhan Tindall @ 2013-04-09 22:37 UTC (permalink / raw)
  To: Bastien; +Cc: Org-Mode

[-- Attachment #1: Type: text/plain, Size: 2870 bytes --]

The ability I am looking forward here IS to find a location - it's just
that I need a little more detailed control.
For example, file+headline(or file+subheadline, or whatever) would find a
specific headline in a file, & inserts the entry under it, creating it if
it doesn't exist (IE * Notes)
file+datetree acts the same, but creates bits of a datetree to get to the
specific date.
What I want is (somewhat) of a combination of the two:
1) find/create the datetree to get today's date
2) under this subtree, find/create headline
3) insert the entry under this headline.
Ideally I'd like to grab a value using capture to specify the headline, but
from what I gather that's not going to happen.  Nonetheless, I can live
with specifying 1 template for each category headline I need:
For a simple example:
datetree+headline capture template for headline * Notes
inserts entry into
* 2013
** April
*** 2013-04-09 Tuesday
**** PPT111 Dev Ticket for new functionality
***** Log <2013-04-09> Worked on spec for this ticket
       CLOCK: [2013-04-09 Tue 08:40]

This simple extension would then give the ability to log in/out of the
PPT111 ticket, with notes on what was worked on, and a simple CLOCKTAB line
at the right level will bundle up all the time for a ticket in single
entries.

This functionality would also be useful for me as a student, with
sub-headlines for classes where I could add notes, todos, etc.


On Fri, Apr 5, 2013 at 4:09 PM, Bastien <bzg@altern.org> wrote:

> Hi Subhan,
>
> Subhan Tindall <subhan.tindall@rentrakmail.com> writes:
>
> > questions:
> > 1) are the values gathered by capture available to the function
> > specified for file+function, & if so what are their names?
>
> No.
>
> > 2) what is the general template for a function for use with
> > file+function, cleanup, return values, etc that would be expected?
>
> The function is expected to find a location where to put the new
> entry, not to return any specific value, and if it returns a value,
> the value is ignored.  It can also act on the subtree at the location
> it has found, but this is slightly abusing the feature I'd say.
>
> > 3) would it be better to extend datetree to datetree+headline for
> > entries of this type? it seems like it a pretty usefully
> > functionality to have (I can think of 2 or 3 instances i'd regularly
> > use this just off the top of my head
>
> "datetree+headline" is improper, because a location in a datetree is
> a headline... so maybe your best chance is to use (function ...) or
> (file+function ...) and try to see if the function can interactively
> prompt for the values you want and edit the location as you want.
> But again, this goes beyond the purpose of function, which is to
> find to location.
>
> --
>  Bastien
>



-- 
Subhan Michael Tindall | Software Developer
| smt@rentrakmail.com
RENTRAK | www.rentrak.com | NASDAQ: RENT

[-- Attachment #2: Type: text/html, Size: 4457 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: need file+function help
  2013-04-09 22:37   ` Subhan Tindall
@ 2013-04-09 22:57     ` John Hendy
  0 siblings, 0 replies; 4+ messages in thread
From: John Hendy @ 2013-04-09 22:57 UTC (permalink / raw)
  To: Subhan Tindall; +Cc: Bastien, Org-Mode

On Tue, Apr 9, 2013 at 5:37 PM, Subhan Tindall
<subhan.tindall@rentrakmail.com> wrote:
> The ability I am looking forward here IS to find a location - it's just that
> I need a little more detailed control.
> For example, file+headline(or file+subheadline, or whatever) would find a
> specific headline in a file, & inserts the entry under it, creating it if it
> doesn't exist (IE * Notes)
> file+datetree acts the same, but creates bits of a datetree to get to the
> specific date.
> What I want is (somewhat) of a combination of the two:
> 1) find/create the datetree to get today's date
> 2) under this subtree, find/create headline
> 3) insert the entry under this headline.
> Ideally I'd like to grab a value using capture to specify the headline, but
> from what I gather that's not going to happen.  Nonetheless, I can live with
> specifying 1 template for each category headline I need:
> For a simple example:
> datetree+headline capture template for headline * Notes
> inserts entry into
> * 2013
> ** April
> *** 2013-04-09 Tuesday
> **** PPT111 Dev Ticket for new functionality
> ***** Log <2013-04-09> Worked on spec for this ticket
>        CLOCK: [2013-04-09 Tue 08:40]
>
> This simple extension would then give the ability to log in/out of the
> PPT111 ticket, with notes on what was worked on, and a simple CLOCKTAB line
> at the right level will bundle up all the time for a ticket in single
> entries.
>

I'm assuming from this that you'd like help creating such a capture
template? Would these help at all?
- http://lists.gnu.org/archive/html/emacs-orgmode/2012-08/msg01164.html
- http://osdir.com/ml/emacs-orgmode-gnu/2012-08/msg00396.html

Those were some of of the more elaborate capture templates I've ever
created, though a lot of the discussion had to do with date formatting
specifically. From my usage of capture, I think you might have some
troubles if the headline you want to file under doesn't exist yet.
Could be wrong!

One option is from the capture entry template, instead of C-c C-c , do
C-c C-w to refile instead. Then just make sure you have =(setq
org-refile-allow-creating-parent-notes t)= in your config or Org will
error when you try to refile to a non-existent headline the first
time.


Let me know if that helps any...
John

> This functionality would also be useful for me as a student, with
> sub-headlines for classes where I could add notes, todos, etc.
>
>
> On Fri, Apr 5, 2013 at 4:09 PM, Bastien <bzg@altern.org> wrote:
>>
>> Hi Subhan,
>>
>> Subhan Tindall <subhan.tindall@rentrakmail.com> writes:
>>
>> > questions:
>> > 1) are the values gathered by capture available to the function
>> > specified for file+function, & if so what are their names?
>>
>> No.
>>
>> > 2) what is the general template for a function for use with
>> > file+function, cleanup, return values, etc that would be expected?
>>
>> The function is expected to find a location where to put the new
>> entry, not to return any specific value, and if it returns a value,
>> the value is ignored.  It can also act on the subtree at the location
>> it has found, but this is slightly abusing the feature I'd say.
>>
>> > 3) would it be better to extend datetree to datetree+headline for
>> > entries of this type? it seems like it a pretty usefully
>> > functionality to have (I can think of 2 or 3 instances i'd regularly
>> > use this just off the top of my head
>>
>> "datetree+headline" is improper, because a location in a datetree is
>> a headline... so maybe your best chance is to use (function ...) or
>> (file+function ...) and try to see if the function can interactively
>> prompt for the values you want and edit the location as you want.
>> But again, this goes beyond the purpose of function, which is to
>> find to location.
>>
>> --
>>  Bastien
>
>
>
>
> --
> Subhan Michael Tindall | Software Developer
> | smt@rentrakmail.com
> RENTRAK | www.rentrak.com | NASDAQ: RENT

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-09 22:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-04 18:42 need file+function help Subhan Tindall
2013-04-05 23:09 ` Bastien
2013-04-09 22:37   ` Subhan Tindall
2013-04-09 22:57     ` John Hendy

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).