From mboxrd@z Thu Jan 1 00:00:00 1970 From: Toby Cubitt Subject: [PATCH] Add option to skip timestamp entries if already displayed as deadline entries in agenda Date: Mon, 23 Apr 2012 00:32:34 +0200 Message-ID: <20120422223234.GA20288@c3po.home> Reply-To: Toby Cubitt Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="d6Gm4EdcadzBjdND" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:56511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SM5L7-00051C-7E for emacs-orgmode@gnu.org; Sun, 22 Apr 2012 18:33:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SM5L5-00008S-7p for emacs-orgmode@gnu.org; Sun, 22 Apr 2012 18:33:04 -0400 Received: from starfish.geekisp.com ([216.168.135.166]:37220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SM5L5-00008D-2K for emacs-orgmode@gnu.org; Sun, 22 Apr 2012 18:33:03 -0400 Content-Disposition: inline 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 --d6Gm4EdcadzBjdND Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This one's pretty self-explanatory. It adds an `org-agenda-skip-timestamp-if-deadline-is-shown' customization option, precisely analogous to the existing `org-agenda-skip-scheduled-if-deadline-is-shown' option. Toby -- Dr T. S. Cubitt Mathematics and Quantum Information group Department of Mathematics Complutense University Madrid, Spain email: tsc25@cantab.net web: www.dr-qubit.org --d6Gm4EdcadzBjdND Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="0001-Agenda-Add-org-agenda-skip-timestamp-if-deadline-is-.patch" >From 5cae4b80d34ed7ba54532bf0a029384fcd1353a8 Mon Sep 17 00:00:00 2001 From: "Toby S. Cubitt" Date: Sun, 29 Jan 2012 13:02:27 +0100 Subject: [PATCH] Agenda: Add org-agenda-skip-timestamp-if-deadline-is-shown * lisp/org-agenda.el (org-agenda-skip-timestamp-if-deadline-is-shown): Skip timestamp items in agenda view if item is already shown as a deadline item. (org-agenda-skip-dealine-if-done): Pass deadline results to org-agenda-get-timestamps. (org-agenda-get-timestamps): Optionally take list of deadline results, so that timestamp results can be skipped if already included in deadline results. --- lisp/org-agenda.el | 27 +++++++++++++++++++++++++-- 1 files changed, 25 insertions(+), 2 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 796f158..aa433fa 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -776,6 +776,20 @@ but not scheduled today." (const :tag "Always" t) (const :tag "Not when scheduled today" not-today))) +(defcustom org-agenda-skip-timestamp-if-deadline-is-shown nil + "Non-nil means skip timestamp line if same entry shows because of deadline. +In the agenda of today, an entry can show up multiple times +because it has both a plain timestamp and has a nearby deadline. +When this variable is t, then only the deadline is shown and the +fact that the entry has a timestamp for or including today is not +shown. When this variable is nil, the entry will be shown +several times." + :group 'org-agenda-skip + :group 'org-agenda-daily/weekly + :type '(choice + (const :tag "Never" nil) + (const :tag "Always" t))) + (defcustom org-agenda-skip-deadline-if-done nil "Non-nil means don't show deadlines when the corresponding item is done. When nil, the deadline is still shown and should give you a happy feeling. @@ -4785,7 +4799,7 @@ the documentation of `org-diary'." ((eq arg :timestamp) (setq rtn (org-agenda-get-blocks)) (setq results (append results rtn)) - (setq rtn (org-agenda-get-timestamps)) + (setq rtn (org-agenda-get-timestamps deadline-results)) (setq results (append results rtn))) ((eq arg :sexp) (setq rtn (org-agenda-get-sexps)) @@ -4937,7 +4951,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines', (defconst org-agenda-no-heading-message "No heading for this item in buffer or region.") -(defun org-agenda-get-timestamps () +(defun org-agenda-get-timestamps (&optional deadline-results) "Return the date stamp information for agenda display." (let* ((props (list 'face 'org-agenda-calendar-event 'org-not-done-regexp org-not-done-regexp @@ -4948,6 +4962,12 @@ This function is invoked if `org-agenda-todo-ignore-deadlines', (format "mouse-2 or RET jump to org file %s" (abbreviate-file-name buffer-file-name)))) (d1 (calendar-absolute-from-gregorian date)) + mm + (deadline-position-alist + (mapcar (lambda (a) (and (setq mm (get-text-property + 0 'org-hd-marker a)) + (cons (marker-position mm) a))) + deadline-results)) (remove-re (concat (regexp-quote @@ -5015,6 +5035,9 @@ This function is invoked if `org-agenda-todo-ignore-deadlines', (if (not (re-search-backward org-outline-regexp-bol nil t)) (setq txt org-agenda-no-heading-message) (goto-char (match-beginning 0)) + (if (and (eq t org-agenda-skip-timestamp-if-deadline-is-shown) + (assoc (point) deadline-position-alist)) + (throw :skip nil)) (setq hdmarker (org-agenda-new-marker) tags (org-get-tags-at)) (looking-at "\\*+[ \t]+\\([^\r\n]+\\)") -- 1.7.8.5 --d6Gm4EdcadzBjdND--