* lisp/org-element.el (org-element-begin):
(org-element-end):
(org-element-contents-begin):
(org-element-contents-end):
(org-element-post-affiliated):
(org-element-post-blank): New functions for fast access to frequently
used element properties. The functions are `setf'-able.
Update all the relevant code in Org to use the new functions instead
of genetic property queries.
* lisp/org-attach.el (org-attach-tag): Avoid error thrown when trying
to set tags before first heading. This is not a proper fix, but it
will at least allow attaching files to Org file. The tagging will be
skipped for now, until setting FILETAGS is supported by Org API.
* org-attach.el (org-attach): Move cursor to the top of the
UI-description buffer.
This matters when the buffer does not fit completely in the window for
display. Without the change the user would see the bottom part.
* lisp/org-attach.el (org-attach-dir-from-id): Ignore nil values
returned by entries from `org-attach-id-to-path-function-list'.
(org-attach-dir-get-create): Signal an error suggesting customization
of `org-attach-id-to-path-function-list' if all ID-to-path functions
return nil.
(org-attach-id-to-path-function-list): Add to the docstring examples
how to handle unusual IDs.
(org-attach-id-uuid-folder-format, org-attach-id-ts-folder-format):
Return nil if ID is too short.
(org-attach-id-fallback-folder-format): New function that may be added
as the last element of `org-attach-id-path-function-list' to handle
unexpectedly short IDs.
* etc/ORG-NEWS: Advertise the change.
Earlier an obscure error like 'org-attach-id-ts-folder-format: Args out
of range: "ftt", 0, 6' was signalled in the case of unexpectedly short
ID.
Reported-by: Janek F <xerusx@pm.me>
Link: https://list.orgmode.org/KC8PcypJapBpJQtJxM0kX5N7Z0THL2Lq6EQjBMzpw1-vgQf72egZ2JOIlTbPYiqAVD4MdSBhrhBZr2Ykf5DN1mocm1ANvvuKKZShlkgzKYM=@pm.me
* lisp/org-attach.el (org-attach-attach): Store link to the original
file location when `org-attach-store-link-p' is set to t, as promised
by the variable docstring.
* lisp/org-attach.el (org-attach-attach): Fix typo when
`org-attach-store-link-p' is set to t. Instead of `file', we need
`attach-file': the link to the attached file, not the original.
* lisp/ox.el (org-export-before-processing-functions):
(org-export-before-parsing-functions): Rename
`org-export-before-processing-hook' and
`org-export-before-parsing-hook' to use "-functions" suffix as these
hooks are abnormal hooks and we need not to use "-hook" suffix in
abnormal hooks.
* lisp/org-compat.el (org-export-before-processing-hook):
(org-export-before-parsing-hook): Declare obsolete.
* lisp/org-attach.el (org-export-before-parsing-functions): Use the
new hook name.
* lisp/org.el (org-resource-download-policy, org-safe-remote-resources):
Two new customisations to configure the policy for downloading remote
resources.
(org--should-fetch-remote-resource-p, org--safe-remote-resource-p,
org--confirm-resource-safe): Introduce the new function
`org--should-fetch-remote-resource-p' for internal use determining
whether a remote resource should be downloaded according to the download
policy. This function makes use of two helper functions,
`org--safe-remote-resource-p' and `org--confirm-resource-safe'.
(org-file-contents): Apply `org--safe-remote-resource-p' to file
downloading.
* lisp/org-persist.el (org-persist-write): Apply
`org--safe-remote-resource-p' to url downloading.
* lisp/org-attach.el (org-attach-attach, org-attach-url): Apply
`org--safe-remote-resource-p' to url downloading.
* ob-core.el (org-babel-merge-params): Specifying the symbol 'attach`
or string "'attach" as the value of the `:dir' header now functions as
":dir (org-attach-dir nil t) :mkdirp t".
(org-babel-result-to-file): Optional TYPE argument accepts symbol
'attachment to fixup up paths under `(org-attach-dir)' and use the
link type "attachment:" when that is detected.
(org-babel-insert-result): Pass symbol `attachment' as TYPE to
`org-babel-result-to-file'.
* org-attach.el (org-attach-dir): Added autoload header to simplify
dependencies necessary to support this feature (called in
`org-babel-merge-params').
* test-ob.el (test-ob-core/dir-attach): Added unit test for the new
attach feature.
* lisp/org-attach.el (org-attach): Get rid of the use of the second
arg of `commandp`, by making `org-attach-commands` accept any
commands (including keyboard macros).
Patch from Stefan Monnier.
https://list.orgmode.org/jwvwni7y70r.fsf-monnier+emacs@gnu.org/
* lisp/org-compat.el: Introduce org-directory-empty-p which is directory-empty-p from Emacs 28.
* lisp/org-attach.el (org-attach-sync): Use org-directory-empty-p instead of directory-empty-p.
* etc/ORG-NEWS: Note about org-directory-empty-p.
Thanks Kyle identifying the issue. Thanks Arthur for suggesting a
fix.
* lisp/org-attach.(org-attach-sync): Enable possible deletion of empty
attachment directories. `org-attach-sync-delete-empty-dir' controls
the action: Never delete, Always delete or Query the user (default).
Porting from Emacs's master to Org's maint branch has been on hold
leading up to the Emacs 27.2 release to avoid any required fixup syncs
carrying those commits into the emacs-27 branch. This merge brings
those changes into master. The km/from-emacs-master branch should be
merged to maint when Emacs 27.2 has been released (assuming Org 9.5
hasn't been released, in which case maint will be tracking 9.5.x and
already include these changes).
de6d90224 (org-attach: Consider inlinetasks when calculating attach
dir, 2020-12-17) introduced a call to org-inlinetask-goto-beginning
and org-inlinetask-in-task-p, each behind a featurep guard.
* lisp/org-attach.el (org-attach): When inside inlinetask, return
attachment dir of that task. When outside inlinetask, return
attachment dir of the main task ignoring any inlinetasks above point.
The call to `org-back-to-heading-or-point-min` does not move point to
the actual heading when there is inlinetask above the point. The
result is incorrect return value or even creation of property drawer
below *...** END line of the last inline task before point.
* lisp/org-attach.el (org-attach-delete-all): Use `force' arg
throughout function.
`org-attach-delete-all` advertised a `force` option but passing it
only forced its way past the initial "Really remove all…" query. This
was unexpected and not properly documented.
This extends the use of the `force` argument to the `delete-directory`
call and documents its meaning in the docstring.
TINYCHANGE
* lisp/ol.el (org-link-parameters): Remove reference to the function.
* lisp/ox.el (org-export-link-as-file): Remove function.
* testing/lisp/test-ox.el (test-org-export/link-as-file): Remove test.
The current implementation is not satisfactory, and not useful in the
code base. Using a pre-export hook turning custom link type into
"file" is enough for now. See "attachement" links for an example.
* lisp/org-attach.el (org-attach-unset-directory): Replace "different
than" by "different from".
Correct "different than" to "different from" where appropriate
530067463bffc982f02dcc4f2805d389704575b4
Alan Mackenzie
Sun Feb 9 14:33:14 2020 +0000
* lisp/ox.el (org-export--dispatch-ui): Update message in the
header line to promote the use of C-v and M-v while SPC and
DEL are still allowed for backward compatibility reasons.
* lisp/org-macs.el (org-scroll): New function.
* lisp/org-attach.el (org-attach): Use `org-scroll'.
* lisp/org-agenda.el (org-agenda-get-restriction-and-command):
Allow C-v, M-v, C-n and C-p to scroll.
This change adverize C-v, M-v, C-n and C-p as the default keys
for scrolling the window, while SPC and DEL are still available
in the export dispatch window.
In particular, don't use SPC as a way to scroll the window in
the agenda commands dispatch window, as this key might be used
for a custom agenda command.
* lisp/org-attach.el (org-attach-link-expand): New function for link
element expansion.
* lisp/org-element.el (org-element-link-parser): Remove info about
expanded attachment paths from link elements.
* lisp/ol.el (org-link-open)
* lisp/ox-texinfo.el (org-texinfo-link)
* lisp/ox-odt.el (org-odt-link)
* lisp/ox-md.el (org-md-link)
* lisp/ox-man.el (org-man-link)
* lisp/ox-latex.el (org-latex--inline-image, org-latex-link)
* lisp/ox-html.el (org-html-link)
* lisp/ox-ascii.el (org-ascii-link): Refactor to use new link
expansion function from org-attach.el instead of (now removed)
custom link property from org-element.el.