From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: org-icalendar: Change dates to today in VEVENT export Date: Tue, 12 Feb 2019 09:34:52 +0100 Message-ID: <87pnrx4d77.fsf@nicolasgoaziou.fr> References: <87d0o37mkh.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([209.51.188.92]:38527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtTWs-00059v-RC for emacs-orgmode@gnu.org; Tue, 12 Feb 2019 03:35:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtTWr-0006qZ-AS for emacs-orgmode@gnu.org; Tue, 12 Feb 2019 03:34:58 -0500 Received: from relay12.mail.gandi.net ([217.70.178.232]:42507) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtTWq-0006ia-Qr for emacs-orgmode@gnu.org; Tue, 12 Feb 2019 03:34:57 -0500 In-Reply-To: (=?utf-8?Q?=22Micha=C3=ABl?= Cadilhac"'s message of "Thu, 7 Feb 2019 15:04:55 +0000") 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: =?utf-8?Q?Micha=C3=ABl?= Cadilhac Cc: emacs-orgmode@gnu.org Hello, Micha=C3=ABl Cadilhac writes: > Well, certainly. I may not have had the best discipline in writing > these, so turning them into patches is a bit painful. Let me know if > I can make things better. (I believe my FSF paperwork is still > alright, if need be.) Thank you! Comments follow. > +(defcustom org-icalendar-bump-todos nil > + "Non-nil means that pending TODO VEVENTs are bumped to today. > +In addition, if non-nil, the number of late days is indicated in the sum= mary." > + :group 'org-export-icalendar > + :type 'boolean) This variable is missing :package-version '(Org . "9.3") and :safe keywords. This is also true for other defcustom introduced throughout your patches. > +(defun org-icalendar-today-timestamp () > + "Return a TIMESTAMP object for today, at 00:00." > + (let ((dt (decode-time))) > + (list 'timestamp > + (nconc (list :year-start (nth 5 dt) > + :year-end (nth 5 dt) > + :month-start (nth 4 dt) > + :month-end (nth 4 dt) > + :day-start (nth 3 dt) > + :day-end (nth 3 dt)))))) This function already exists: `org-timestamp-from-time'. > +(defun org-icalendar-days-until-timestamp (timestamp) > + "Return the number of days until TIMESTAMP. > + > +If TIMESTAMP occurs today, return 0. > +If TIMESTAMP occurs yesterday, return -1." > + (floor > + (/ (float-time > + (time-subtract (org-timestamp--to-internal-time timestamp) > + (apply 'encode-time > + (append '(0 0 0) (nthcdr 3 (decode-time)))))) (time-substract (org-timestamp-to-time timestamp) (current-time)) > + (* 60 60 24)))) >=20=20 > - (concat "DL: " summary) loc desc cat tz class))) > + (concat "DL: " summary) loc desc cat tz class)) > + Spurious blank line. > + ;; Case 2: pending TODO overdue and should bump. > + ((and org-icalendar-bump-todos > + (< days-until-deadline 0)) > + (org-icalendar--vevent > + entry (org-icalendar-today-timestamp) (concat "DL-" uid) > + (concat "DL (" (number-to-string (- days-until-deadline)) > + "x): " summary) Nitpick:=20 (format "DL (%d)x): %s" (- days-until-deadline) summary is more readable. > + loc desc cat tz class)) > + ;; Case 3: in the future and should warn. > + (t > + (concat > + ;; If in the warning zone. > + (when (<=3D days-until-deadline org-deadline-warning-days) > + (org-icalendar--vevent > + entry (org-icalendar-today-timestamp) (concat "DL-" uid) > + (concat "DL (in " (number-to-string days-until-deadline) > + "d.): " summary) See above. > + ;; Overdue and should bump. > + (t > + (org-icalendar--vevent > + entry (org-icalendar-today-timestamp) (concat "SC-" uid) > + (concat "S (" (number-to-string (- days-until-scheduled)) "x): " > + summary) Ditto. > Subject: [PATCH 2/6] Include tags in SUMMARY if so desired. I'm ignoring this patch since it is superseded by the fifth. Could you merge them? > #+vindex: org-icalendar-categories > #+vindex: org-icalendar-alarm-time > +#+vindex: org-icalendar-summary-uses-tags > For tags on the headline, the iCalendar export back-end makes them > into iCalendar categories. To tweak the inheritance of tags and TODO > states, configure the variable ~org-icalendar-categories~. To assign > clock alarms based on time, configure the ~org-icalendar-alarm-time~ > -variable. > +variable. Additionally, the variable > +~org-icalendar-summary-uses-tags~ can be configured to have tags > +appear in the title of the event, when SUMMARY is not provided. I think this should go near the paragraph about `org-calendar-include-body'. > (defcustom org-icalendar-summary-uses-tags nil > - "Non-nil means that TITLE+TAGS is used when SUMMARY is not provided. > -If nil, then TITLE is used alone." > + "Whether tags should be added to the title to create the summary. Nitpick. "Non-nil means" > "Whether" because it is more unambiguously informative When non-nil, tags are added to ... or Non-nil means tags are added to ... > (let ((tags (apply 'concat > - (mapcar (lambda (x) (concat ":" x)) > - (org-export-get-tags entry info nil t))))) > + (mapcar > + (lambda (x) (concat ":" x)) > + (org-export-get-tags > + entry info nil > + (eq org-icalendar-summary-uses-tags 'all-tags)))))) (apply 'concat (lambda ...) ...) =3D> (mapconcat (lambda ...) ...) Could you send an updated patch series? Thank you again. Regards, --=20 Nicolas Goaziou