From: Michael Brand <michael.ch.brand@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Cc: Bernt Hansen <bernt@norang.ca>
Subject: [PATCH] Agenda: Simplify old fix of face for deadline warning 0 day
Date: Mon, 1 Aug 2011 10:57:13 +0200 [thread overview]
Message-ID: <CALn3zog9z_PLHu-iF-dR1cGmQBE2YU+Wc=DvikLzpc-+YE5mJg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]
Agenda: Simplify old fix of face for deadline warning 0 day
* lisp/org-agenda.el (org-agenda-get-deadlines): Fix dfrac for the
case of wdays being 0. Don't pass wdays to org-agenda-deadline-face,
like before the old fix.
(org-agenda-deadline-face): Revert to old state that was without
wdays.
This allows a deadline warning period of "-0d" to work also with a
custom configuration like:
(setq org-agenda-deadline-faces
'((1.0001 . org-warning) ; due yesterday or before
(0.0 . org-upcoming-deadline))) ; due today or later
For org-agenda-deadline-faces left at default and all other settings
not exceeding 1.0, the face for a deadline warning of any length
remains untouched by this patch.
references to history:
* commit of the old fix
- http://orgmode.org/w/?p=org-mode.git;a=commitdiff;h=d0d6325
- git show d0d6325
* mailing list old thread
- http://thread.gmane.org/gmane.emacs.orgmode/5753
- http://lists.gnu.org/archive/html/emacs-orgmode/2008-02/msg00395.html
[-- Attachment #2: 0001-Agenda-Simplify-old-fix-of-face-for-deadline-warning.patch --]
[-- Type: application/octet-stream, Size: 2676 bytes --]
From 7b2de46fb48069dbc11bb9d4619776a9fc30b6b9 Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.brand@gmail.com>
Date: Mon, 1 Aug 2011 10:53:33 +0200
Subject: [PATCH] Agenda: Simplify old fix of face for deadline warning 0 day
* lisp/org-agenda.el (org-agenda-get-deadlines): Fix dfrac for the
case of wdays being 0. Don't pass wdays to org-agenda-deadline-face,
like before the old fix.
(org-agenda-deadline-face): Revert to old state that was without
wdays.
This allows a deadline warning period of "-0d" to work also with a
custom configuration like:
(setq org-agenda-deadline-faces
'((1.0001 . org-warning) ; due yesterday or before
(0.0 . org-upcoming-deadline))) ; due today or later
For org-agenda-deadline-faces left at default and all other settings
not exceeding 1.0, the face for a deadline warning of any length
remains untouched by this patch.
references to history:
* commit of the old fix
- http://orgmode.org/w/?p=org-mode.git;a=commitdiff;h=d0d6325
- git show d0d6325
* mailing list old thread
- http://thread.gmane.org/gmane.emacs.orgmode/5753
- http://lists.gnu.org/archive/html/emacs-orgmode/2008-02/msg00395.html
---
lisp/org-agenda.el | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index d47013b..3c7a419 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -5156,7 +5156,7 @@ (defun org-agenda-get-deadlines ()
(let ((org-deadline-warning-days suppress-prewarning))
(org-get-wdays s))
(org-get-wdays s))
- dfrac (/ (* 1.0 (- wdays diff)) (max wdays 1))
+ dfrac (- 1 (/ (* 1.0 diff) (max wdays 1)))
upcomingp (and todayp (> diff 0)))
;; When to show a deadline in the calendar:
;; If the expiration is within wdays warning time.
@@ -5198,7 +5198,7 @@ (defun org-agenda-get-deadlines ()
head category tags
(if (not (= diff 0)) nil timestr)))))
(when txt
- (setq face (org-agenda-deadline-face dfrac wdays))
+ (setq face (org-agenda-deadline-face dfrac))
(org-add-props txt props
'org-marker (org-agenda-new-marker pos)
'org-hd-marker (org-agenda-new-marker pos1)
@@ -5213,10 +5213,9 @@ (defun org-agenda-get-deadlines ()
(push txt ee))))))
(nreverse ee)))
-(defun org-agenda-deadline-face (fraction &optional wdays)
+(defun org-agenda-deadline-face (fraction)
"Return the face to displaying a deadline item.
FRACTION is what fraction of the head-warning time has passed."
- (if (equal wdays 0) (setq fraction 1.))
(let ((faces org-agenda-deadline-faces) f)
(catch 'exit
(while (setq f (pop faces))
--
1.7.4.2
next reply other threads:[~2011-08-01 8:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-01 8:57 Michael Brand [this message]
2011-08-05 0:18 ` [PATCH] Agenda: Simplify old fix of face for deadline warning 0 day Bernt Hansen
2011-08-14 16:42 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALn3zog9z_PLHu-iF-dR1cGmQBE2YU+Wc=DvikLzpc-+YE5mJg@mail.gmail.com' \
--to=michael.ch.brand@gmail.com \
--cc=bernt@norang.ca \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).