From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: Displaying deadline datestamp in todo agenda list? Date: Wed, 25 May 2016 12:56:05 -0500 Message-ID: <87zirexbre.fsf@fastmail.fm> References: <87oa7wu1si.fsf@red-bean.com> <87bn3wo306.fsf@red-bean.com> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5d2c-00079U-Ir for emacs-orgmode@gnu.org; Wed, 25 May 2016 13:56:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5d2X-0000iU-MC for emacs-orgmode@gnu.org; Wed, 25 May 2016 13:56:21 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:46191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5d2V-0000h4-7U for emacs-orgmode@gnu.org; Wed, 25 May 2016 13:56:17 -0400 In-Reply-To: <87bn3wo306.fsf@red-bean.com> (Karl Fogel's message of "Mon, 23 May 2016 16:53:13 -0500") 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" To: Karl Fogel Cc: Org Mode Karl Fogel writes: > > I'm using the DEADLINE keyword with TODO entries, and I'd like > the DEADLINE date to be displayed as a datestamp next to each > TODO item, when I list deadlined todo items. In other words, I > don't want to have to duplicate the DEADLINE timestamp as a > timestamp on the TODO line itself in my Org Mode file -- since > the timestamp is already present as the value of the DEADLINE > keyword, can't Org Mode just use it? > > Assume I have these Org Mode entries: > > * STARTED Org Mode scheduling test KIWI. > DEADLINE: <2016-05-23> > > * TODO Org Mode scheduling test MELON. > DEADLINE: <2016-05-25> > > * STARTED Org Mode scheduling test LIME. > DEADLINE: <2016-05-24> > > * STARTED Org Mode scheduling test TARDIGRADE. > SCHEDULED: <2016-05-23> DEADLINE: <2016-06-16> > > And I have this custom code to bind "d" to show just the TODO > items that have deadlines, in my `org-agenda' keymap: > > (defun ots-org-entry-skip-non-deadline () > "Return non-nil iff this org entry does not have the > DEADLINE keyword." (if (not (org-entry-get (point) > "DEADLINE")) > (progn (outline-next-heading) (1- (point))))) > (defvar ots-org-agenda-custom-commands-updated-p nil > "If non-nil, we've already updated > `org-agenda-custom-commands', > so don't do it again.") ;; TBD: Oh, could use > `org-add-agenda-custom-command' to do this. (unless > ots-org-agenda-custom-commands-updated-p > (unless (boundp 'org-agenda-custom-commands) > (setq org-agenda-custom-commands ())) > (setq org-agenda-custom-commands > (cons '("d" "Deadlines and scheduled work" alltodo "" > ((org-agenda-skip-function > 'ots-org-entry-skip-non-deadline) > ;; Add code here to control deadline date > display? (org-agenda-prefix-format '((agenda > . " %i %-12:c%?-12t% s") > (timeline . " % > s") (todo . " %i > %-12:c %s") (tags > . " %i %-12:c") > (search . " %i > %-12:c"))) > (org-agenda-sorting-strategy > '(deadline-up)))) > org-agenda-custom-commands)) > (setq ots-org-agenda-custom-commands-updated-p t)) > Hi Karl, Here's a working implementation, using org-agenda-add-custom-command and the built-in mechanism for skipping non-deadline entries (you can get rid of ots-org-entry-skip-non-deadline). I also added some justification (the -22) to accommodate my rather long timestamp strings. Adjust as needed: (org-add-agenda-custom-command '("d" "Deadlines and scheduled work" alltodo "" ((org-agenda-skip-function '(org-agenda-skip-entry-if 'notdeadline)) (org-agenda-prefix-format '((todo . " %i %-22(org-entry-get nil \"DEADLINE\") %-12:c %s"))) (org-agenda-sorting-strategy '(deadline-up))))) Matt