emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH 2/2] Allow inserting diary entries last in date tree


From: Nikolai Weibull
Subject: Re: [O] [PATCH 2/2] Allow inserting diary entries last in date tree
Date: Sun, 23 Aug 2015 19:11:05 +0200

On Sun, Aug 23, 2015 at 9:40 AM, Nicolas Goaziou <address@hidden> wrote:

>> +  (let ((last (eq org-agenda-insert-diary-strategy 'date-tree-last))
>> +     (has-children (save-excursion (org-goto-first-child))))
>> +    (if (not (and last has-children))
>> +     (outline-next-heading)
>> +      (org-goto-first-child)
>> +      (while (org-get-next-sibling)))
>> +    (org-back-over-empty-lines)
>> +    (unless (looking-at "[ \t]*$") (save-excursion (insert "\n")))
>> +    (org-insert-heading nil t)
>> +    (unless has-children
>> +      (org-do-demote)))
>
> This part is incorrect, when tree is ill-formed, and slightly
> inefficient when there are many children.
>
> Assuming point is on the parent headline, I think a faster way to do
> this would be
>
>   (org-end-of-subtree t t)
>   (org-insert-heading nil t)
>   (org-do-demote)

That’s what I used first, but that doesn’t work if the subtree has
children that has children.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]