* using dates as property?
@ 2015-08-31 11:02 John Kitchin
2015-08-31 21:43 ` Samuel Wales
0 siblings, 1 reply; 5+ messages in thread
From: John Kitchin @ 2015-08-31 11:02 UTC (permalink / raw)
To: Org Mode
Hi,
I am making a historical list of seminar speakers in an org-file. I am
trying to figure out the best way to store the dates so I can do
something later like find speakers from 2010, or to sort the speakers by
date etc...
Here is an example of my current thoughts. My questions are:
1. are org-timestamps the right approach?
2. are they better in the headline (where they are more easily read) or
as a property?
3. In either case, is there an easy way to search/sort them?
** Some Person
:PROPERTIES:
:FIRSTNAME: Some
:LASTNAME: Person
:EMAIL: some.person@someplace.edu
:URL: http://some.place.edu/some-person
:END:
*** [2010-02-02 Tue] Title....
:PROPERTIES:
:DATE: [2010-02-02 Tue]
:END:
*** [2015-09-01 Tue] Title...
:PROPERTIES:
:DATE: [2015-09-01 Tue]
:END:
Thanks!
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: using dates as property?
2015-08-31 11:02 using dates as property? John Kitchin
@ 2015-08-31 21:43 ` Samuel Wales
2015-08-31 21:49 ` Samuel Wales
2015-09-05 0:31 ` John Kitchin
0 siblings, 2 replies; 5+ messages in thread
From: Samuel Wales @ 2015-08-31 21:43 UTC (permalink / raw)
To: John Kitchin; +Cc: Org Mode
i always put inactive timestamps in headlines, and sort both the
outline and agenda using them. for example:
***** CONVERSATION [2015-08-31 Mon 14:41] john
***** CONVERSATION [2015-09-01 Tue 15:02] rms
or newest first. they are visible and binary-searchable.
works perfectly for me.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: using dates as property?
2015-08-31 21:43 ` Samuel Wales
@ 2015-08-31 21:49 ` Samuel Wales
2015-08-31 21:52 ` Samuel Wales
2015-09-05 0:31 ` John Kitchin
1 sibling, 1 reply; 5+ messages in thread
From: Samuel Wales @ 2015-08-31 21:49 UTC (permalink / raw)
To: John Kitchin; +Cc: Org Mode
hi john,
documented for myself only:
(defun alpha-org-timestamp-score (&optional sg)
"Return unix minutes as a floating point number.
;;;for 0..1
;;;Beware adding this to a much larger number (around 100); you will
;;;lose resolution. Multiply first by a number with a lot of
;;;zeroes. Then add to a number with a lot of zeroes.
Seems to be unix time as 1970 (or a few hours off, possibly
depending on time zone) epoch.
This is for sorting conversations, which have an inactive
timestamp near the beginning of a header, and for all tasks.
===
There is no way to get Org to return the first ts of any type.
/fixme/ request a timestamp-any property. this gets you the
first timestamp no matter whether it is active and no matter
where it is.
This checks closed first. So the bug is if there is a ts in the
headline, closed will take precedence if it exists.
Still, this approach works OK; think of the time as always being
the time of closing for a doneish, else first ts. That is OK.
So not making the request now.
/Does not yet consider active timestamps/."
;;
;;make sure these work on any other processor or os
;;
;;(/ (org-time-string-to-seconds "1900-12-31 00:00") 60.0) nan
;;(/ (org-time-string-to-seconds "1901-12-31 00:00") 60.0) -35766300.0
;;(/ (org-time-string-to-seconds "1934-12-31 00:00") 60.0) -18409980.0
;;(/ (org-time-string-to-seconds "1960-12-31 00:00") 60.0) -4734300.0
;;(/ (org-time-string-to-seconds "1969-12-31 00:00") 60.0) -1020.0
;;(/ (org-time-string-to-seconds "1970-01-01 00:00") 60.0) 420.0
;;(/ (org-time-string-to-seconds "1980-01-01 00:00") 60.0) 5259300.0
;;(/ (org-time-string-to-seconds "1990-01-01 00:00") 60.0) 10519620.0
;;(/ (org-time-string-to-seconds "2010-01-01 00:00") 60.0) 21038820.0
;;(/ (org-time-string-to-seconds "2038-01-01 00:00") 60.0) 35765700.0
;;(/ (org-time-string-to-seconds "2138-01-01 00:00") 60.0) nan
;;if you do seconds instead of minutes, it changes magnitude
;;seems ok to multiply by 1e7 or so
;;(+ 1.0 (* 10519620.0 1e8)) 1051962000000001.0 :)
;;(+ 1.0 (* 10519620.0 1e9)) 1.051962e+16 :(
;;(= (+ 1.0 (* 10519620.0 1e9)) (* 10519620.0 1e9)) t :(
;;(/ (org-time-string-to-seconds "1990-01-01 00:00") 60.0) 10,519,620.0
(let ((ts (or
;;this fixes either a doc bug or a real bug, not
;;sure which
;;
;;maybe a doc bug. all timestamps are separate?
;;then fixme if there is ever another inactive
;;timestamp type, you have to add it here.
;;
;;if so, likewise fixme you have to add all 3 active
;;timestamp types and any future ones.
(alpha-org-entry-get "CLOSED" sg)
(alpha-org-entry-get "TIMESTAMP_IA" sg))))
(aif ts
(/ (org-time-string-to-seconds it)
60.0)
0.0)))
On 8/31/15, Samuel Wales <samologist@gmail.com> wrote:
> i always put inactive timestamps in headlines, and sort both the
> outline and agenda using them. for example:
>
> ***** CONVERSATION [2015-08-31 Mon 14:41] john
> ***** CONVERSATION [2015-09-01 Tue 15:02] rms
>
> or newest first. they are visible and binary-searchable.
> works perfectly for me.
>
--
The Kafka Pandemic: http://thekafkapandemic.blogspot.com
Ramsay's disease DOES progress. MANY people have died from it. And
ANYBODY can get it.
Denmark: free Karina Hansen NOW.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: using dates as property?
2015-08-31 21:49 ` Samuel Wales
@ 2015-08-31 21:52 ` Samuel Wales
0 siblings, 0 replies; 5+ messages in thread
From: Samuel Wales @ 2015-08-31 21:52 UTC (permalink / raw)
To: John Kitchin; +Cc: Org Mode
and here is my get function, likewise documented only for me and
written a long time ago but works well for me:
(defun alpha-org-entry-get (property &optional sg inherit)
"Return the value of PROPERTY, whether you are in the outline
or the agenda, by calling `org-entry-get'.
SG \(string given\) is the agenda header string to use \(provided
by user-defined agenda sorting\) or nil. If it is nil and you
are in the outline, use the current headline directly. If it is
nil and you are in the agenda, use the current headline by going
to the outline.
INHERIT is the inherit argument for `org-entry-get'.
There are a few questions about Org properties:
1) What does it mean to get alltags without inheritance or tags
with inheritance? I guess org-entry-get was originally
meant for properties, not tags, so you don't use inherit?
2) How do you get the first timestamp in an entry? There seems
to be no way without specifying the type of timestamp.
According to the manual at the time of this writing, possible
properties include these.
TODO The TODO keyword of the entry.
TAGS The tags defined directly in the headline.
ALLTAGS All tags, including inherited ones.
CATEGORY The category of an entry.
PRIORITY The priority of the entry, a string with a single letter.
DEADLINE The deadline time string, without the angular brackets.
SCHEDULED The scheduling timestamp, without the angular brackets.
CLOSED When was this entry closed?
TIMESTAMP The first keyword-less timestamp in the entry.
- this works even in the headline
TIMESTAMP_IA The first inactive timestamp in the entry.
- this works even in the headline
- it does not seem to report CLOSED ts -- use CLOSED
CLOCKSUM The sum of CLOCK intervals in the subtree. org-clock-sum
must be run first to compute the values.
ITEM The content of the entry.
For anything else, you can use marker-buffer to get to the
outline and do manual parsing or use some other function. Or
possibly modify org-entry-get to understand it and send a patch
to the org mailing list, along with an update of this docstring.
The idea is to use this as a single way to get most metadata no
matter where you are.
"
;;=doubtful do we want the literal-nil argument so that we can
;;ret "nil" as string? check elsewhere here for nil vs. string
;;for todo kw or whatever. we only need it if it helps with
;;consistency. not important and prob useless for this
;;purpose. (other ways of getting todo kw will not obey it so
;;it might not help.)
;;
;; fixme org-cached-entry-get
(org-entry-get
(ecase major-mode
((org-agenda-mode)
;;;
;;; will this work faster? or is this for something other than
;;; agenda?
;;;
;;; my guess is it is just for doing things not getting things
;;;
;;; (org-with-point-at (org-get-at-bol 'org-hd-marker)
;;; ;; do here what you need to do at the location of the entry
;;; )
;; sg is provided by programmatic agenda use in sorting.
;;
;; should also be provided in sorting filter.
;;
;; is the buffer substring only needed for outline? could
;; we get property from the agenda for sorting to avoid the
;; buffer substring?
;;
;; fixme for speed maybe we can get from the agenda buffer
;; if sg is not provided. fixme check if sg is provided.
;; however, if we use
;; org-agenda-before-sorting-filter-function, it is
;; provided i guess.
(let* ((s (or sg (buffer-substring (point-at-bol)
(point-at-eol))))
;; get marker from sg or string
;;
;; what is the difference between these? supposedly
;; hd-marker is not always there.
(m (or (get-text-property 1 'org-marker s)
(get-text-property 1 'org-hd-marker s))))
;;do this to get to the org outline buffer from the
;;agenda buffer if you need other data that org-entry-get
;;cannot extract
;;
;;(b (and m (marker-buffer m))))
;;; (if b
;;; (with-current-buffer b
;;; (goto-char m)
m))
((org-mode) (point)))
property
inherit))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: using dates as property?
2015-08-31 21:43 ` Samuel Wales
2015-08-31 21:49 ` Samuel Wales
@ 2015-09-05 0:31 ` John Kitchin
1 sibling, 0 replies; 5+ messages in thread
From: John Kitchin @ 2015-09-05 0:31 UTC (permalink / raw)
To: Samuel Wales; +Cc: Org Mode
thanks. that also works for me.
Samuel Wales writes:
> i always put inactive timestamps in headlines, and sort both the
> outline and agenda using them. for example:
>
> ***** CONVERSATION [2015-08-31 Mon 14:41] john
> ***** CONVERSATION [2015-09-01 Tue 15:02] rms
>
> or newest first. they are visible and binary-searchable.
> works perfectly for me.
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-09-05 0:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-31 11:02 using dates as property? John Kitchin
2015-08-31 21:43 ` Samuel Wales
2015-08-31 21:49 ` Samuel Wales
2015-08-31 21:52 ` Samuel Wales
2015-09-05 0:31 ` John Kitchin
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.