From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Loury Subject: Re: org-expiry not compatible with the new drawer syntax Date: Fri, 30 Jan 2015 11:35:17 +0100 Message-ID: <87twz8h7yy.fsf@konixwork.incubateur.ens-lyon.fr> References: <87lhkkg2bx.fsf@konixwork.incubateur.ens-lyon.fr> <877fw4r4yq.fsf@nicolasgoaziou.fr> <87wq44h8aq.fsf@konixwork.incubateur.ens-lyon.fr> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YH8v5-0007bS-Si for emacs-orgmode@gnu.org; Fri, 30 Jan 2015 05:35:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YH8v2-0005fM-Bz for emacs-orgmode@gnu.org; Fri, 30 Jan 2015 05:35:23 -0500 Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:55344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YH8v2-0005f1-2W for emacs-orgmode@gnu.org; Fri, 30 Jan 2015 05:35:20 -0500 Received: by mail-wi0-f178.google.com with SMTP id bs8so1791307wib.5 for ; Fri, 30 Jan 2015 02:35:19 -0800 (PST) In-Reply-To: <87wq44h8aq.fsf@konixwork.incubateur.ens-lyon.fr> 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: Nicolas Goaziou Cc: OrgMode ML --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Samuel Loury writes: > Nicolas Goaziou writes: > >> Samuel Loury writes: >> >>> I just realized that when creating a new entry in my org-diary >>> (`org-agenda-add-entry-to-org-agenda-diary-file'), the entry looks like: >>> >>> ** test >>> <2015-01-30 Fri> >>> :PROPERTIES: >>> :CREATED: [2015-01-30 Fri 08:00] >>> :END: >>> >>> The property is added by an call to `org-expiry-insert-created' in the >>> `org-insert-heading-hook'. see in contrib/lisp/org-expiry.el:179 >>> >>> With more details: >>> >>> In the process in inserting the diary entry, >>> `org-agenda-add-entry-to-org-agenda-diary-file' >>> calls (lisp/org-agenda.el:9460) >>> `org-agenda-insert-diary-as-top-level' (lisp/org-agenda.el:9479). >>> >>> The later then calls `org-insert-heading' (calling the org-expiry hook >>> that creates the property drawer), and inserts the text of the heading >>> followed by a new line, resulting in the insertion of: >> >> Actually, AFAICT, the sole function calling `org-insert-heading' in >> "org-agenda.el" is `org-agenda-insert-diary-make-new-entry'. I fixed it >> so it properly puts point on the right spot in the entry. > > The function `org-agenda-insert-diary-as-top-level' is a few line above > the one you patched. > > I copied the code you've written in > `org-agenda-insert-diary-make-new-entry' and I've put it in > `org-agenda-insert-diary-as-top-level'. This fixes my problem. Please > find attached the associated patch. I just realized that the call to `org-insert-heading' was into one of my local patches. Actually, I think this patch may be worth applying to prior to the one I just sent. Please, find it attached to this email. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Make-use-of-org-insert-heading-instead-of-inserting-.patch Content-Transfer-Encoding: quoted-printable From=20b975ff7630dcf289a795a9eb0ec6f449d0efd621 Mon Sep 17 00:00:00 2001 From: Konubinix Date: Thu, 6 Nov 2014 11:02:23 +0100 Subject: [PATCH] Make use of `org-insert-heading' instead of inserting the * character * lisp/org-agenda.el (org-agenda-insert-diary-as-top-level): Make use of `org-insert-heading' instead of inserting the * character Therefore, the hooks associated to the insertion of a heading will be triggered. =2D-- lisp/org-agenda.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index b83c331..e719c00 100644 =2D-- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -9488,7 +9488,8 @@ a timestamp can be added there." (widen) (goto-char (point-max)) (or (bolp) (insert "\n")) =2D (insert "* " text "\n") + (org-insert-heading) + (insert text "\n") (if org-adapt-indentation (org-indent-to-column 2))) =20 (defun org-agenda-insert-diary-make-new-entry (text) =2D-=20 2.1.4 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable It makes sure the `org-insert-heading' is called instead of hard-coding its behavior by inserting the "*" character. I initially made this patch to make sure the org-expiry hook is called whenever I create diary entries. =2D-=20 Konubinix GPG Key : 7439106A Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUy15lAAoJEHXSPO10ORBq1mwH/0THEZwcoENP1rzgvNJKH4r+ /s7kriSD+lY1cqNt1LhHtJ6AWkdsRLPRFJT3xqtrMw4cmWNDJuPxBAPM/yEfTVhN 8PWQ8s8UysHsepgnpL8bhcxpe8N/dIvmlTmKXoFiEXII2kx5XSbrmF5DqUM/mO8o EbZCZMBNY1emRtr5fo4i9NyCyC/BQ6yTjtmEwc8Wd6zSdXT9gmAOLauNg2RL84Vx L/MJFXC3+2TyNnjZ6N08DTCXPLvxb+6+uBzl1yC35on7JwRCKpLMD1u62Q0DX+4v qiaFCnWaC5C7lmV+WwAwq8fIQjN+Z/eBcoO5TxhFLooxYps8Eq9PxjYQUGt/2dk= =Eylr -----END PGP SIGNATURE----- --==-=-=--