Kristoffer Balintona <krisbalint...@gmail.com> writes: > I apologize for the delay. I've been busy these last few days and also > encountered some technical difficulties with my device.
No problem. We are all volunteers here, contributing in our free time. > Thank you for the clarification. WDYT of the patches attached? See my comments below. > - For non-unique headings, the full outline path is safer > + For non-unique headings, the full outline path is > + safer. If no headings are given, or if > + function-returning-list-of-strings or > + symbol-containing-list-of-strings return nil, the entry > + will be inserted at the end of <file-spec> on top > + level. You missed optional :prepend property in capture templates. See `org-capture-place-entry'. The location will depend on :prepend being t/nil unless you explicitly set :exact-position when processing the capture template. > - (m (org-find-olp (cons expanded-file-path > - (apply #'org-capture-expand-olp > expanded-file-path outline-path))))) > + (expanded-olp (apply #'org-capture-expand-olp > expanded-file-path outline-path)) > + ;; If expanded-olp is nil, then create the datetree at > + ;; the end of the file specified by expanded-file-path > + (m (if expanded-olp > + (org-find-olp (cons expanded-file-path expanded-olp)) > + (set-buffer (org-capture-target-buffer > expanded-file-path)) > + (save-restriction (widen) (point-max-marker))))) I am not sure if I understand the purpose of the last line here. > + (let* ((expanded-file-path (org-capture-expand-file path)) > + (expanded-olp (apply #'org-capture-expand-olp > expanded-file-path outline-path)) > + ;; If expanded-olp is nil, then file-level-datetree-p > + ;; is non-nil and the datetree should be created at > + ;; the end of the file specified by expanded-file-path There is no guarantee that it will be created at the end. > + (pcase headline > + ((pred not) (goto-char (point-max))) Nitpick: `null' is a bit more comprehensive as predicate name. -- Ihor Radchenko // yantar92, Org mode maintainer, 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>