emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Capturing to a list in a dynamic 2nd level heading
@ 2012-08-13 16:26 Simon Brown
  2012-08-13 17:50 ` Christopher J. White
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Brown @ 2012-08-13 16:26 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

Is it possible with org-capture to create a template that would create
the following:

* Log
** 2012 - Week 33
 - One liner of interest
 - Another one liner of interest

So that is a capture template that generates the 2nd level heading when
required and the text entered is converted to a list entry which is
added to the end of the list.

(format-time-string "%G - Week %W") is the correct date string, but
file+headline creates a top level heading and file+olp expects it to
already exist. 

It seems that the text entered must also become a sub heading. Is that
correct?

I'm trying to achieve something very similar to this
http://metajack.im/2009/01/01/journaling-with-emacs-orgmode/

Any suggestions greatly appreciated. I haven't managed to strike gold in
the list archive.

Simon
-- 
Simon Brown

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

* Re: Capturing to a list in a dynamic 2nd level heading
  2012-08-13 16:26 Capturing to a list in a dynamic 2nd level heading Simon Brown
@ 2012-08-13 17:50 ` Christopher J. White
  2012-08-14 18:12   ` Simon Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher J. White @ 2012-08-13 17:50 UTC (permalink / raw)
  To: emacs-orgmode, lists


Hi Simon,

I have a capture template that does almost exactly that, I just use a 
user entered subheading -- should be easy enough to tweak for your task.

When chosen as a capture option, it asks for a discussion context and 
looks up a 2nd level heading below "Discussion Items" matching that 
context.  If it exists, it just adds to it.  If not, it creates a new 
context at the end of the Discussion Items element.  Note that you must 
create "Discussion Items" first, and it must be top-level.

...cj

Capture template:

   ("d" "Discussion Item" item
          (file+function
           "~/org/Todo.org"
           (lambda ()
             (let* ((ctxt (read-string "Discussion context: "))
                    (ctxt-pt
                      (condition-case msg
                          (org-find-olp (list "Discussion Items" ctxt) t)
                        (error nil))))
               (if ctxt-pt
                   (progn
                     (goto-char ctxt-pt)
                     (org-end-of-subtree)
                     (insert-string "\n"))
                 (goto-char (org-find-olp (list "Discussion Items") t))
                 (org-end-of-subtree)
                 (insert-string (format "\n** %s\n" ctxt)))))))


On 8/13/12 12:26 PM, Simon Brown wrote:
> Hi all,
>
> Is it possible with org-capture to create a template that would create
> the following:
>
> * Log
> ** 2012 - Week 33
>   - One liner of interest
>   - Another one liner of interest
>
> So that is a capture template that generates the 2nd level heading when
> required and the text entered is converted to a list entry which is
> added to the end of the list.
>
> (format-time-string "%G - Week %W") is the correct date string, but
> file+headline creates a top level heading and file+olp expects it to
> already exist.
>
> It seems that the text entered must also become a sub heading. Is that
> correct?
>
> I'm trying to achieve something very similar to this
> http://metajack.im/2009/01/01/journaling-with-emacs-orgmode/
>
> Any suggestions greatly appreciated. I haven't managed to strike gold in
> the list archive.
>
> Simon
>

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

* Re: Capturing to a list in a dynamic 2nd level heading
  2012-08-13 17:50 ` Christopher J. White
@ 2012-08-14 18:12   ` Simon Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Brown @ 2012-08-14 18:12 UTC (permalink / raw)
  To: orgmode; +Cc: emacs-orgmode

Hi cj

At Mon, 13 Aug 2012 13:50:09 -0400,
Christopher J. White wrote:
> I have a capture template that does almost exactly that, I just use a 
> user entered subheading -- should be easy enough to tweak for your task.

Yes indeed, thank you very much!

Simon

> Capture template:
> 
>    ("d" "Discussion Item" item
>           (file+function
>            "~/org/Todo.org"
>            (lambda ()
>              (let* ((ctxt (read-string "Discussion context: "))
>                     (ctxt-pt
>                       (condition-case msg
>                           (org-find-olp (list "Discussion Items" ctxt) t)
>                         (error nil))))
>                (if ctxt-pt
>                    (progn
>                      (goto-char ctxt-pt)
>                      (org-end-of-subtree)
>                      (insert-string "\n"))
>                  (goto-char (org-find-olp (list "Discussion Items") t))
>                  (org-end-of-subtree)
>                  (insert-string (format "\n** %s\n" ctxt)))))))

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

end of thread, other threads:[~2012-08-14 18:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-13 16:26 Capturing to a list in a dynamic 2nd level heading Simon Brown
2012-08-13 17:50 ` Christopher J. White
2012-08-14 18:12   ` Simon Brown

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