From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: Re: [RFC] Display most recent log item in Agenda Date: Wed, 17 Dec 2014 15:16:57 +0800 Message-ID: <874msuoidy.fsf@ericabrahamsen.net> References: <87388imto5.fsf@ericabrahamsen.net> <878uia6kdh.fsf@nicolasgoaziou.fr> <87ppbllmqj.fsf@ericabrahamsen.net> <87vbld5biw.fsf@nicolasgoaziou.fr> <87wq5sqqin.fsf@ericabrahamsen.net> <87k31s559y.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y18lh-00076h-7K for emacs-orgmode@gnu.org; Wed, 17 Dec 2014 02:11:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y18la-0004sR-Nc for emacs-orgmode@gnu.org; Wed, 17 Dec 2014 02:11:32 -0500 Received: from plane.gmane.org ([80.91.229.3]:43841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y18la-0004sF-Fx for emacs-orgmode@gnu.org; Wed, 17 Dec 2014 02:11:26 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Y18lR-0002GB-Kc for emacs-orgmode@gnu.org; Wed, 17 Dec 2014 08:11:17 +0100 Received: from 114.248.5.200 ([114.248.5.200]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Dec 2014 08:11:17 +0100 Received: from eric by 114.248.5.200 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Dec 2014 08:11:17 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Nicolas Goaziou writes: > Eric Abrahamsen writes: > >> I thought that's what `org-log-beginning' was for: finding where the >> log-note list would be (drawer or no), if it exists. > > Not exactly. It finds where the next note is to be inserted. This may > not be in front of the log-note list even if it exists (e.g., if > `org-log-states-order-reversed' is nil you may end up in front of the > following paragraph). > >> If users aren't using `org-log-into-drawer', `org-log-beginning' >> should still go to the spot where the list would be, right? > > Not necessarily. It actually doesn't look for such a list. It could end > up after the list (see above) or even in a different location (see > below). > > Also, it doesn't tell if there is a list at all, so if you rely on it, > you need to double-check if you really are close to a log-note. Well sure, I was already aware of all this (except I hadn't caught that `org-log-beginning' would go to the intended location of the *newest note*, not just the location of the list, thanks for that). There were also some checks in the code I sent to make sure there was actually a list in the spot where `org-log-beginning' deposited us. > Unfortunately, recognizing a log note is impossible, since it is > a regular plain list. Contents change, and templates are customizables > (see `org-log-note-headings'). See, for example, the hack in > `org-skip-over-state-notes'. I'm not terribly worried about finding the real last state note with 100% accuracy -- as you say, that's not really possible. This would be a convenience function displaying a useful bit of information, and if it fails to do so no planes will crash. Anyone who cares enough to use it probably already knows where their notes are. ("You've got to know where your towel is.") I'd be inclined just to go to the location of `org-log-beginning', look around for likely log notes, show the most recent one if we can find it, and bail if not. What do you think? >> Then, if there's a list there, I take the first or last note (depending >> on log-state-notes-reversed). >> >> I don't know why the notes would be scattered across the section... > > Because in this case, the list is not necessarily re-used. The first > note is inserted after planning info and properties drawer. If, later, > you insert some text before it, logging process will create a new list > above, and so on. E.g., > > Step 1: > > * Headline > - Note 1 > > Step 2: > > * Headline > Some text > - Note 1 > > Step 3: > > * Headline > - Note 2 > Some text > - Note 1 > > > Regards,