emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samuel Loury <konubinix@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: OrgMode ML <emacs-orgmode@gnu.org>
Subject: Re: org-expiry not compatible with the new drawer syntax
Date: Fri, 30 Jan 2015 11:35:17 +0100	[thread overview]
Message-ID: <87twz8h7yy.fsf@konixwork.incubateur.ens-lyon.fr> (raw)
In-Reply-To: <87wq44h8aq.fsf@konixwork.incubateur.ens-lyon.fr>


[-- Attachment #1.1: Type: text/plain, Size: 1738 bytes --]

Samuel Loury <konubinix@gmail.com> writes:

> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
>> Samuel Loury <konubinix@gmail.com> 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.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Make-use-of-org-insert-heading-instead-of-inserting-.patch --]
[-- Type: text/x-diff, Size: 1014 bytes --]

From b975ff7630dcf289a795a9eb0ec6f449d0efd621 Mon Sep 17 00:00:00 2001
From: Konubinix <konubinix@gmail.com>
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.
---
 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
--- 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"))
-  (insert "* " text "\n")
+  (org-insert-heading)
+  (insert text "\n")
   (if org-adapt-indentation (org-indent-to-column 2)))
 
 (defun org-agenda-insert-diary-make-new-entry (text)
-- 
2.1.4


[-- Attachment #1.3: Type: text/plain, Size: 333 bytes --]


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.

-- 
Konubinix
GPG Key    : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE  5C36 75D2 3CED 7439 106A

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

  reply	other threads:[~2015-01-30 10:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30  7:22 org-expiry not compatible with the new drawer syntax Samuel Loury
2015-01-30  9:30 ` Nicolas Goaziou
2015-01-30 10:28   ` Samuel Loury
2015-01-30 10:35     ` Samuel Loury [this message]
2015-01-30 18:46     ` Nicolas Goaziou
2015-02-02  7:31       ` Samuel Loury
2015-02-02 12:26         ` Nicolas Goaziou
2015-02-02 12:45           ` Samuel Loury

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=87twz8h7yy.fsf@konixwork.incubateur.ens-lyon.fr \
    --to=konubinix@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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).