emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Planning links to tasks


From: Ihor Radchenko
Subject: Re: Planning links to tasks
Date: Mon, 03 Oct 2022 13:37:56 +0800

Eduardo Suarez <esuarez@itccanarias.org> writes:

> Hi, I have just implemented an approach to creating a hierarchy of links to
> tasks, so the hierarchy can be thought of a dependency tree (something like a
> Gantt but with no dates). This approach may be suitable if your org hierarchy
> is not already based on todo dependencies, and there are too many tasks to
> review them often.
>
> The idea is to be able to:
>
> - easily add an item to a plain list in a section named (e.g.)
>   "Planning/Unplanned tasks", consisting of a link to a task in the same
>   buffer (=org-plk-insert=),
>
> - move by text editing this list item into a hierarchy of items in a section
>   named (e.g.) "Planning/Planned tasks", so hierarchy means dependency
>   (somehow).

Have you been using your code for some time now or is it just an
experiment implementing your idea?

> Some improvements would be great:
>   - update link description at point,
>   - nice looking planning links (fontify?, have no idea),
>   - use another flag for planning link instead of suffix,
>   - check for planning links duplicates.

It would be helpful if you provide a more detailed demonstration of your
approach. I imagine something similar (in terms of presentation) to
https://blog.jethro.dev/posts/capturing_inbox/

It is hard to comment anything on your ideas without seeing how your
code actually works.

Also, if you want to hear suggestions about particular parts of the
code, please provide those parts instead of throwing the whole code - it
will make things easier for people who are only interested to answer a
specific question of yours.

> (defun edu/org-plk-description-from-id (target-id)
>   "Planning link description from Link ID"
>   (catch 'found
>     (org-map-entries
>      ;; break on first element found
>      #'(throw 'found (edu/org-plk-format-description))

This is not a valid Elisp syntax.
Check out 13.7 Anonymous Functions section of Elisp manual.

>     (let ((shift 0))
>       ;; map over all links in the buffer
>       (org-element-map (org-element-parse-buffer) 'link
>         (lambda (link)
>           (when (edu/org-plk-p link shift)  ;; filter-in plk's
>             (let* ((new-desc-text
>                     (edu/org-plk-description-from-id (org-element-property 
> :path link)))
>                    ;; shifted because of previous description updates in this 
> run
>                    (old-desc-start (+ shift (org-element-property 
> :contents-begin link)))
>                    (old-desc-end (+ shift (org-element-property :contents-end 
> link))))

You can also use a simple re-search-forward and not bother with `shift'.
Or use org-element-cache-map from the latest main.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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