emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [PATCH] function and symbol for headline and olp for org-capture-tem


From: Ihor Radchenko
Subject: Re: [PATCH] function and symbol for headline and olp for org-capture-templates
Date: Fri, 17 May 2024 12:48:00 +0000

Nafiz Islam <nafiz.islam1001@gmail.com> writes:

> This patch adds the option to provide function and symbol for headline and
> olp for org-capture-templates.

Thanks for the patch.
A few comments.

Firstly, your total contribution to Org mode with this patch will exceed
the maximum allowed number of LOC changes we can accept without FSF
copyright assignment. May I know if you have FSF copyright assignment?
If not, would you consider doing the paperwork? See
https://orgmode.org/worg/org-contribute.html#copyright

> -                               (string :tag "  Headline"))
> +                               (choice :tag "Headline"
> +                                       (string   :tag "Headline")
> +                                       (function :tag "Function")
> +                                       (variable :tag "Variable")
> +                                       (sexp :tag "Form")))

Please update the docstring of `org-capture-templates' as well.

> +(defun org-capture-expand-olp (&rest olp)
> +  "Expand functions, symbols and outline paths for OLP.
> +When OLP is a function, call it. When it is a variable,
> +return its value. When it is a list of string, return it.
> +In any other case, return `nil'."
> +  (let* ((final-olp (cond ((stringp (car olp)) olp)
> +                          (t (org-capture-expand-function-or-symbol (car 
> olp))))))
> +    final-olp))

I think that we should filter out incorrect target specifications when
the function name is followed by more list elements - (cdr olp) is non-nil.

> ...
> However, I just realized that the suggestion provided in
> https://lists.gnu.org/archive/html/emacs-orgmode/2024-05/msg00216.html
> might not work how I was hoping for. Basically, I wanted it to be possible
> to search for headlines and even outline paths in the
> buffer while in the function. But, by expanding outline-path before setting
> the buffer (by calling outside of `org-find-olp') that
> becomes infeasible.

I think that we may pass the file name as an argument to outline path
function.

-- 
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]