emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Martin Pohlack <mp26@os.inf.tu-dresden.de>
To: John Hendy <jw.hendy@gmail.com>
Cc: Bastien <bzg@gnu.org>,
	emacs-orgmode@gnu.org, Jack Erwin <jack@jugband.net>
Subject: Re: Using org-mode as day planner
Date: Mon, 13 Aug 2012 20:20:11 +0200	[thread overview]
Message-ID: <5029455B.6000208@os.inf.tu-dresden.de> (raw)
In-Reply-To: <CA+M2ft9+i9jjS9nkVFvrkcvUTTMz2fo2Mn-Kbe6p2U01ByTvwA@mail.gmail.com>

On 12.08.2012 17:48, John Hendy wrote:
> On Sat, Aug 11, 2012 at 4:34 AM, Bastien <bzg@gnu.org> wrote:
>> Hi John,
>>
>> John Hendy <jw.hendy@gmail.com> writes:
>>
>>> Date trees are the obvious way to be able to do this, but they don't
>>> have any of the neat search functionality that I know of.
>>
>> Can you describe the search functionality you would like for date-trees?
>> I'm not sure I groked it.
> 
> Date trees allow for a very nice way for filing notes in chronological
> order, but =C-c / dateRange= does not work for date trees. Previously,
> active time stamps worked, but I didn't want all my notes showing up
> in my agenda, so I just dealt with not having a great solution. Then
> you provided one with the sparse-tree search timestamp-type selection
> ability, which rocks.
> 
> Date trees are still the best way to use capture for foolproof
> chronological storage of notes quickly... but I wouldn't be able to
> extract notes in a particular date-range with current functionality.

Hi John,

I have a very similar use case.  I capture all my stuff into a date tree
and for my weekly report I parse that and extract a subset.  It looks a
bit crude (hardcoded stuff for my setup) but works for now.  I must say
that date-trees in their current form feel a bit un-org-mody as they use
a completely different data format:

----------------------------------------------------------------------

(defun mp26/org-find-headline-prefix-in-buffer (heading &optional buffer
pos-only)
  "Find node with heading-prefix HEADING in BUFFER.
Return a marker to the heading if it was found, or nil if not.
If POS-ONLY is set, return just the position instead of a marker.

The heading prefix must match as prefix of the full headline.  It
may have a TODO keyword, a priority cookie and tags in the
standard locations."
  (with-current-buffer (or buffer (current-buffer))
    (save-excursion
      (save-restriction
	(widen)
	(goto-char (point-min))
	(let (case-fold-search)
	  (if (re-search-forward
	       (format org-complex-heading-regexp-format
		       (concat (regexp-quote heading) ".*")) nil t)
	      (if pos-only
		  (match-beginning 0)
		(move-marker (make-marker) (match-beginning 0)))))))))

; fixme: optional parameter for starting date
(defun mp26/org-week-from-journal ()
  "Insert a copy of the current week from the journal."
  (interactive)
  (insert
   (mapconcat
    'identity
    (with-current-buffer "Journal.org<Daten>"
      (loop for days in '(-6 -5 -4 -3 -2 -1 0)
            collect
            (let* ((date (calendar-current-date days))
                   (date-string
                    (format "%d-%02d-%02d"
                            (nth 2 date) (nth 0 date) (nth 1 date))))
              (setq pos (mp26/org-find-headline-prefix-in-buffer
                         date-string nil t))
              (when pos
                (goto-char pos)
                (org-copy-subtree)
                (car kill-ring)))))
   "")))

----------------------------------------------------------------------

  reply	other threads:[~2012-08-13 18:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-09 17:41 Using org-mode as day planner Jack Erwin
2012-08-10  8:09 ` Bastien
2012-08-10 12:46   ` John Hendy
2012-08-10 13:47     ` Jonathan Leech-Pepin
2012-08-11  9:34     ` Bastien
2012-08-12 15:48       ` John Hendy
2012-08-13 18:20         ` Martin Pohlack [this message]
2012-08-13 18:43           ` Jambunathan K
2012-08-13 18:51             ` Bastien
2012-08-14  8:11         ` Bastien
2012-08-10 11:46 ` Charles Philip Chan
2012-08-10 12:28   ` Charles Philip Chan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5029455B.6000208@os.inf.tu-dresden.de \
    --to=mp26@os.inf.tu-dresden.de \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=jack@jugband.net \
    --cc=jw.hendy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).