emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Display only latest sub notes in agenda
@ 2014-06-06 14:27 Steffen Heilmann
  2014-06-15 19:54 ` Sacha Chua
  0 siblings, 1 reply; 3+ messages in thread
From: Steffen Heilmann @ 2014-06-06 14:27 UTC (permalink / raw)
  To: emacs-orgmode

Dear all,

thank you very much for the very helpful org-mode! I have been using it extensively during my studies and it saved me a great deal of trouble and time.

Now I want to use org-mode to organize / manage my networking contacts. I will have a top-level (*) entry for every person, and underneath for each meeting a (**) sub level entry with a time stamp.

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.

I have asked Sacha Chua for advice, she mentioned that it might be possible to use org-map-entries to go through the level 2 subtrees and update a LASTMEETING property on the parent, and then use org columns).

As I am not really firm with Lisp programming, I was wondering if somebody had done something similar before that he could share. Or alternatively if somebody could give me some help with writing the code. I guess all of this can be done very quickly if you know how to do so.

Thank you very much,

Steffen

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

* Re: Display only latest sub notes in agenda
  2014-06-06 14:27 Display only latest sub notes in agenda Steffen Heilmann
@ 2014-06-15 19:54 ` Sacha Chua
  0 siblings, 0 replies; 3+ messages in thread
From: Sacha Chua @ 2014-06-15 19:54 UTC (permalink / raw)
  To: emacs-orgmode

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

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

* Re: Display only latest sub notes in agenda
@ 2014-06-22 20:28 Steffen Heilmann
  0 siblings, 0 replies; 3+ messages in thread
From: Steffen Heilmann @ 2014-06-22 20:28 UTC (permalink / raw)
  To: emacs-orgmode

Dear Sacha,

thanks for the very helpful code! Does exactly what I was looking for.

I have one additional question: At the moment the code also picks-up any dates that are in the body of the structure (this includes deadlines etc). How would I need to modify the code to only look at dates that actually are given in the headlines (*, ** or ***)? I tried to change the code myself but realized that the regexp was more complicated than I thought and did not get the modified code to work.


Thank you,

Steffen

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

end of thread, other threads:[~2014-06-22 20:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-06 14:27 Display only latest sub notes in agenda Steffen Heilmann
2014-06-15 19:54 ` Sacha Chua
  -- strict thread matches above, loose matches on Subject: below --
2014-06-22 20:28 Steffen Heilmann

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