emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Justus-dev@Piater.name
Cc: emacs-orgmode@gnu.org
Subject: Re: Patch: org-agenda-skip-deadline-prewarning-if-scheduled prior to scheduled date
Date: Wed, 17 Oct 2012 15:07:23 +0200	[thread overview]
Message-ID: <87zk3lmelw.fsf@gmail.com> (raw)
In-Reply-To: <87wqypedlk.fsf@pc130-c703.uibk.ac.at> (Justus-dev@piater.name's message of "Wed, 17 Oct 2012 09:56:23 +0200")

Hello,

Justus-dev@Piater.name writes:

> I would like not to be bothered with TODOs that have a scheduled date in
> the future.  However, as of that scheduled date I would like their
> deadline prewarnings to appear in the agenda, just like non-scheduled
> TODOs.  I do not see how to achieve this behavior using the existing
> org-mode facilities (I run the org shipped with Emacs 24.2.1).

I'm not sure if that's already possible either. Could someone confirm it
isn't?

> Here's a suggested commit message:
>
> org-agenda: New option: skip deadline prewarning if scheduled in the future
>
> * lisp/org-agenda.el (org-agenda-skip-deadline-prewarning-if-scheduled):
>   Add an option to skip the deadline prewarning if the scheduled date is
>   in the future.
>
> Comments?

Since you provide both the patch and the commit message, what about
providing it completely as an attachement (with i.e. git format-patch)?

A few minor comments about the code.

> -	 d2 diff dfrac wdays pos pos1 category category-pos level
> +	 ds d2 diff dfrac wdays pos pos1 category category-pos level

I wouldn't define the "ds" variable here, since it's local to
suppress-prewarning computation. It's clearer to let-bind it around the
(if (and org-agenda-skip-deadline-prewarning-if-scheduled ....)).

> +			 (setq ds (save-match-data
> +				    (if (string-match
> +					 org-scheduled-time-regexp item)
> +					(match-string 1 item))))))

Since it is setq'ed only once, it can be let-bound. Also, about style:

  (if (string-match
      org-scheduled-time-regexp item)
    (match-string 1 item))

=>

  (and (string-match org-scheduled-time-regexp item)
       (match-string 1 item))

> +		  ;; If prewarnings of scheduled items are to be skipped
> +		  ;;    and the current item has a scheduled date (in ds),
> +		  ;; calculate prewarning lead time:

Small mistake in comments indentation.

> +		  (if (integerp
> +		       org-agenda-skip-deadline-prewarning-if-scheduled)
> +		      ;; use prewarning-restart lead time:

Please capitalize comments and end them with a period.

> +		      org-agenda-skip-deadline-prewarning-if-scheduled
> +		    (if (eq org-agenda-skip-deadline-prewarning-if-scheduled
> +			    'pre-scheduled)
> +			;; show first prewarning no earlier than scheduled date:

Ditto.

> +			(min (- d2 (org-time-string-to-absolute
> +				    ds d1 'past show-all (current-buffer) pos))
> +			     org-deadline-warning-days)
> +		      ;; set prewarning to deadline:

Ditto.

Also, since your contribution is more than 20 lines long, did you sign
the FSF papers?

Thanks for your work.


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2012-10-17 13:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-17  7:56 Patch: org-agenda-skip-deadline-prewarning-if-scheduled prior to scheduled date Justus-dev
2012-10-17 13:07 ` Nicolas Goaziou [this message]
2012-10-17 14:29   ` Justus-dev
2012-10-25 13:36     ` Nicolas Goaziou
2012-10-26 11:16   ` Justus-bulk
2012-10-28 10:20     ` Nicolas Goaziou
2012-10-28 12:27       ` Justus-bulk

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=87zk3lmelw.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=Justus-dev@Piater.name \
    --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).