emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sacha Chua <sacha@sachachua.com>
To: emacs-orgmode@gnu.org
Subject: Re: Display only latest sub notes in agenda
Date: Sun, 15 Jun 2014 15:54:58 -0400	[thread overview]
Message-ID: <87ha3mgd7x.fsf@sachachua.com> (raw)
In-Reply-To: F813B08B-9121-4697-BDE1-246262361C58@gmail.com

Steffen Heilmann <heilmann.steffen@gmail.com> writes:

Hello, Steffen, all!

> I am looking for an easy way to see when I had the last interaction
> with everybody (preferably sorted by date). I want to use this to
> quickly see whom I have not contacted for some time and then can
> reach-out to them.

Something like this, maybe?

    (defun sacha/org-update-with-last-meeting ()
      (interactive)
      (goto-char (point-max))
      (let (last-meeting)
        (while (re-search-backward
                (concat "\\(" org-outline-regexp "\\)\\|\\("
                        org-maybe-keyword-time-regexp "\\)") nil t)
          (cond
           ((and (match-string 1)
                 (= (nth 1 (save-match-data (org-heading-components))) 1)
                 last-meeting)
            ;; heading
            (save-excursion (org-set-property "LASTMEETING" last-meeting))
            (setq last-meeting nil))
           ((and (match-string 2))
            (if (or (null last-meeting) (string< last-meeting (match-string 2)))
                (setq last-meeting (match-string 2))))))))

It turns:

    * John Smith
    ** DONE Conversation
    [2014-01-20]
    ** DONE E-mail
    [2014-01-15]
    * Jane Smith
    ** DONE Conversation
    [2014-01-07]

into:

    * John Smith
      :PROPERTIES:
      :LASTMEETING: [2014-01-20]
      :END:
    ** DONE E-mail
    [2014-01-15]
    ** DONE Conversation
    [2014-01-20]
    * Someone without a meeting
    * Jane Smith
      :PROPERTIES:
      :LASTMEETING: [2014-01-07]
      :END:
    ** DONE Conversation
    [2014-01-07]

You can then use something like:

#+COLUMNS: %25ITEM %LASTMEETING %TAGS %PRIORITY %TODO

#+BEGIN: columnview :maxlevel 1
| ITEM                        | LASTMEETING  | TAGS | PRIORITY | TODO |
|-----------------------------+--------------+------+----------+------|
| * John Smith                | [2014-01-20] |      |          |      |
| * Someone without a meeting |              |      |          |      |
| * Jane Smith                | <2014-01-07> |      |          |      |
#+END:

or even sort the entries by the LASTMEETING property (R will
reverse-sort by property).

Sacha

  reply	other threads:[~2014-06-15 19:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06 14:27 Display only latest sub notes in agenda Steffen Heilmann
2014-06-15 19:54 ` Sacha Chua [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-06-22 20:28 Steffen Heilmann

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=87ha3mgd7x.fsf@sachachua.com \
    --to=sacha@sachachua.com \
    --cc=emacs-orgmode@gnu.org \
    /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).