emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Finding LAST copy of a given headline in a file
@ 2013-07-25 22:29 Subhan Tindall
  2013-07-25 22:51 ` Suvayu Ali
  0 siblings, 1 reply; 4+ messages in thread
From: Subhan Tindall @ 2013-07-25 22:29 UTC (permalink / raw)
  To: Org-Mode

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

So I've been working on this issue, & still don't have it quite worked out
like I would want.  What I would like to do is either)
Have template that inserts itself under the LAST entry in the target file
for a given headline
OR
composes the right strings to use file+olp to find the specific headline
under the current date's date-tree heading.
For example, I have a date tree with **** Ticket X under each of several
days, including today's date.
I want to insert an entry ***** What I did today   with some additional
information under **** Ticket X for today.

*  2013
** 2013-07-25
*** 2013-07-24 Wednesday
**** Ticket X
***** LOG ticket X stuff for Wednesday
*** 2013-07-25 Thursday
**** Ticket X
***** LOG ticket X stuff
**** Ticket Y
****** Log ticket y stuff

Any pointers?

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

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

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

* Re: Finding LAST copy of a given headline in a file
  2013-07-25 22:29 Finding LAST copy of a given headline in a file Subhan Tindall
@ 2013-07-25 22:51 ` Suvayu Ali
  2013-07-25 23:39   ` Subhan Tindall
  0 siblings, 1 reply; 4+ messages in thread
From: Suvayu Ali @ 2013-07-25 22:51 UTC (permalink / raw)
  To: emacs-orgmode

Hello Subhan,

On Thu, Jul 25, 2013 at 03:29:10PM -0700, Subhan Tindall wrote:
> Have template that inserts itself under the LAST entry in the target file
> for a given headline

What problem do you have with the above?  Can you give us a minimal
example?

> composes the right strings to use file+olp to find the specific headline
> under the current date's date-tree heading.
> For example, I have a date tree with **** Ticket X under each of several
> days, including today's date.
> I want to insert an entry ***** What I did today   with some additional
> information under **** Ticket X for today.
> 
> *  2013
> ** 2013-07-25
> *** 2013-07-24 Wednesday
> **** Ticket X
> ***** LOG ticket X stuff for Wednesday
> *** 2013-07-25 Thursday
> **** Ticket X
> ***** LOG ticket X stuff
> **** Ticket Y
> ****** Log ticket y stuff

Date trees can be tricky.  As far as I understand, you want to add a
subheading to entries for a day.  I do not think file+datetree can do
that.  I would recommend you try file+function instead.  It should be
easy to implement.  You could use org-map-entries to find the headline
in your headline finding function.

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Finding LAST copy of a given headline in a file
  2013-07-25 22:51 ` Suvayu Ali
@ 2013-07-25 23:39   ` Subhan Tindall
  2013-07-26 11:35     ` Suvayu Ali
  0 siblings, 1 reply; 4+ messages in thread
From: Subhan Tindall @ 2013-07-25 23:39 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: Org-Mode

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

Yes, you are correct, file+datetree does not do this.  A while ago I
suggested a file+datetree+headline type function be added, but it was not
received well.
I attempted a function for use with file+function, but couldn't get it
quite working.
I'm not quite sure how to use org-map-entries to find headlines?
Thanks!
Subhan



On Thu, Jul 25, 2013 at 3:51 PM, Suvayu Ali <fatkasuvayu+linux@gmail.com>wrote:

> Hello Subhan,
>
> On Thu, Jul 25, 2013 at 03:29:10PM -0700, Subhan Tindall wrote:
> > Have template that inserts itself under the LAST entry in the target file
> > for a given headline
>
> What problem do you have with the above?  Can you give us a minimal
> example?
>
> > composes the right strings to use file+olp to find the specific headline
> > under the current date's date-tree heading.
> > For example, I have a date tree with **** Ticket X under each of several
> > days, including today's date.
> > I want to insert an entry ***** What I did today   with some additional
> > information under **** Ticket X for today.
> >
> > *  2013
> > ** 2013-07-25
> > *** 2013-07-24 Wednesday
> > **** Ticket X
> > ***** LOG ticket X stuff for Wednesday
> > *** 2013-07-25 Thursday
> > **** Ticket X
> > ***** LOG ticket X stuff
> > **** Ticket Y
> > ****** Log ticket y stuff
>
> Date trees can be tricky.  As far as I understand, you want to add a
> subheading to entries for a day.  I do not think file+datetree can do
> that.  I would recommend you try file+function instead.  It should be
> easy to implement.  You could use org-map-entries to find the headline
> in your headline finding function.
>
> Hope this helps,
>
> --
> Suvayu
>
> Open source is the future. It sets us free.
>
>


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

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

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

* Re: Finding LAST copy of a given headline in a file
  2013-07-25 23:39   ` Subhan Tindall
@ 2013-07-26 11:35     ` Suvayu Ali
  0 siblings, 0 replies; 4+ messages in thread
From: Suvayu Ali @ 2013-07-26 11:35 UTC (permalink / raw)
  To: Subhan Tindall; +Cc: Org-Mode

On Thu, Jul 25, 2013 at 04:39:08PM -0700, Subhan Tindall wrote:
> Yes, you are correct, file+datetree does not do this.  A while ago I
> suggested a file+datetree+headline type function be added, but it was not
> received well.

I tend to agree with that.  Your case is a corner case I believe.  We
can't keep on adding features which are not used widely.  Specially
since file+function or function provides all the flexibility anyone
would ever want.

> I attempted a function for use with file+function, but couldn't get it
> quite working.

Can you provide your attempt?  Maybe then others can point out what you
might be doing wrong.

> I'm not quite sure how to use org-map-entries to find headlines?

Given a scope, it iterates over all headlines to find a match.  All the
matches are accumulated in a list and returned.  You have to provide
your matching function to org-map-entries.  Without putting much thought
into it, I would propose the following algorithm:

1. Call org-map-entries in the full buffer scope looking for the date
   you want.
2. Once you have the entry corresponding to the date, limit scope to
   subtree and call org-map-entries again, this time looking for the
   specific "Ticket" you want to add to.

Following (2), the template should be added as a sibling.

Hope this helps,

PS: Could you please not top-post.  It is difficult to follow threads if
    you do.

-- 
Suvayu

Open source is the future. It sets us free.

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

end of thread, other threads:[~2013-07-26 11:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-25 22:29 Finding LAST copy of a given headline in a file Subhan Tindall
2013-07-25 22:51 ` Suvayu Ali
2013-07-25 23:39   ` Subhan Tindall
2013-07-26 11:35     ` Suvayu Ali

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).