Kristoffer Balintona <[email protected]> writes: >> - (`(file+olp ,path . ,(and outline-path (guard outline-path))) >> + ((or `(file+olp ,path) >> + `(file+olp ,path . ,outline-path))
Isn't simply `(file+olp ,path . ,outline-path)' good enough? >> (let* ((expanded-file-path (org-capture-expand-file path)) >> - (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)) >> + ;; Vary behavior depending on whether expanded-olp is >> + ;; nil or non-nil. If expanded-olp is non-nil, then >> + ;; create the entry at that outline path. If >> + ;; expanded-olp is nil (no olp is provided), then >> + ;; create the entry in the expanded-file-path file >> + (m (if expanded-olp >> + (org-find-olp (cons expanded-file-path expanded-olp)) >> + (set-buffer (org-capture-target-buffer >> expanded-file-path)) >> + ;; If expanded-olp is nil or omitted, then the >> + ;; user is essentially using the form (file >> + ;; <file-spec>), so behave as such by setting >> + ;; `target-entry-p' to nil >> + (setq target-entry-p nil) >> + ;; Return a marker pointing to the end of the >> + ;; file to cause the new entry to be created >> + ;; there. We widen first to consider the >> + ;; possibility of the buffer already being open >> + ;; and narrowed by the user >> + (save-restriction (widen) (point-max-marker))))) That will not obey :prepend if we force adding to the end of buffer. I think that what needs to be done here is simply deferring to (file "path"), which see. Same for file+olp+datetree and file+headline. Also, since we are adding new features, can you add an ORG-NEWS entry? (I think manual is ok, but you can double-check). -- 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>
