* lisp/org-refile.el (org-refile-get-targets): Calculate the file part
of the outline path once per file, improving the performance when
org-refile-use-outline-path is set to 'title.
* lisp/org-refile.el (org-refile):
(org-refile-goto-last-stored): Save position to the Org mark ring if
we are about to jump to a different position.
* etc/ORG-NEWS (~org-refile~ now saves current position to Org mark
ring when jumping to heading): Document the new feature.
Link: https://orgmode.org/list/CAJcAo8vYLJ3YGH0+nZs1rgtdq2iRKzJ8tuGxJKRD-XyEwEm4FA@mail.gmail.com
* lisp/org-refile.el (org-refile-get-location): When current buffer
file is a symlink to refile location, do not append the file name to
the outline path, just as we do when current buffer is the same as
refile location file.
TINYCHANGE
* lisp/org-macs.el (org-with-file-buffer): New macro switching to a
file buffer temporarily and killing it if a buffer visiting file did
not exist previously.
(org-file-buffer-created): New variable set when buffer visiting file
has been created.
* lisp/ob-tangle.el (org-babel-tangle-file):
* lisp/org-archive.el (org-archive-subtree):
* lisp/org-refile.el (org-refile):
(org-refile-check-position):
(org-refile-new-child):
* lisp/ox-org.el (org-org-publish-to-org):
* lisp/ox-publish.el (org-publish-org-to):
(org-publish-find-property): Avoid calling `find-buffer-visiting' +
`find-file-noselect'. The latter calls the former. Instead, either
just call `find-file-noselect' or use `org-with-file-buffer'.
This commit addresses O(N_buffers) complexity in
`find-buffer-visiting', reducing the number of calls to it.
See Emacs bug#66117.
* lisp/org-refile.el (org-refile-get-targets): Throw better errors
when `org-refile-targets' value is malformed. Allow common mistake
with not using a cons cell in the target description.
* lisp/org-refile.el (org-refile-get-targets): Display error when
target buffer is not in Org mode. If we do not manually throw an
error, local variables like `org-complex-heading-regexp' will not be
defined, and the user would see a lot more cryptic error.
* lisp/org-capture.el (org-capture-store-last-position):
* lisp/org-refile.el (org-refile): Use `condition-case' instead of
`with-demoted-errors' when saving bookmarks. We intent to suppress
errors completely here (116c09053), even when `debug-on-error' is set.
`with-demoted-errors' does trigger error in such scenario, unlike
explicit `condition-case' clause.
Reported-by: No Wayman <iarchivedmywholelife@gmail.com>
Link: https://orgmode.org/list/875y7d7jlr.fsf@gmail.com
* lisp/org-refile.el (org-refile): Use dedicated marker (move after
insertion) to store position of the heading being refiled. Otherwise,
if refiled heading is inserted at the same point, `save-excursion'
would restore point before the inserted heading instead of keeping it
at the original heading.
* testing/lisp/test-org.el (test-org/refile): At test.
Reported-by: /u/madclassix
* lisp/org-refile.el (org-refile-get-targets): Use a document
title (#+TITLE) instead of file or buffer name in outline path, if a
corresponding customisation option is set to 'title. Fallback to a
filename if there is no title in the document.
* lisp/org-refile.el (org-refile-use-outline-path): Add a new option
'title, see above.
* lisp/org-compat.el (org-format-prompt): New compatibility
function.
* lisp/org-capture.el (org-capture-fill-template):
* lisp/org-refile.el (org-refile-get-location): Use org-format-prompt.
Prefer a wrapper to inlining compatibility kludges.
This is a follow-up to the port of Emacs's 664094222.
Make point-at-eol and point-at-bol obsolete
b7e867b841f47dcff3aeaef9b5608a237386ce70
Stefan Kangas
Tue Aug 23 04:54:57 2022 +0200
[ km: This was independently covered on the main branch with
e73c5b7d0. I'm applying it here too for bookkeeping/traceability
purposes. ]
* lisp/org-capture.el (org-capture-fill-template):
* lisp/org-refile.el (org-refile-get-location): Prefer format-prompt
when it is fboundp.
Use format-prompt for many more prompts
66409422214a0a90e1d2a12ef2c4ebf86f2c01a9
Stefan Kangas
Tue Oct 5 03:44:56 2021 +0200
* lisp/oc-basic.el (org-cite-basic--parse-bibliography): Do not use
obsolete `buffer-file-name' generalized variable. Prefer
`set-visited-file-name'.
* lisp/ol-bibtex.el (org-indent-region): Declare function.
(org-bibtex-import-from-file): Remove unused variable.
* lisp/ol.el (org-link--decode-compound): Use `ash' instead of
obsolete `lsh'.
* lisp/org-macs.el: Do no use obsolete generalized variable
`buffer-string'.
* lisp/org-plot.el (org-plot/redisplay-img-in-buffer):
* lisp/org.el (image-flush):
(org-display-inline-images): Use `image-flush' instead of obsolete
`image-refresh'.
* lisp/ox.el (org-export-to-file): Quote ' in the docstring.
All other changes are changing obsolete `point-at-bol' and
`point-at-eol' to `line-beginning-position' and `line-end-position'.
* lisp/org-refile.el (org-refile): Do not reveal the refiled headline.
This reverts the new behaviour accidentally introduced by org-fold
patchset.
See https://orgmode.org/list/87r15l5kce.fsf@gnu.org
* lisp/org-refile.el (org-refile):
* lisp/org-capture.el (org-capture-store-last-position):
Pass `format` arg to `with-demoted-errors`.
(with-demoted-errors): Warn on missing `format` arg
d52c929e31f60ff0462371bfe27ebd479e3e82bd
Stefan Monnier
Fri Feb 4 19:39:53 2022 -0500
[km] with-demoted-errors has had a format argument since Emacs 24.4.
Passing it avoids an error when compiling with Emacs's current
master (bug#54225). Once that bug is resolved, it will prevent a
warning.
* org-refile.el (org-refile-get-location): When we generate the `tbl'
variable, we add extra slash depending on the value of
`org-refile-use-outline-path'. This patch updates some locations which
add another extra slash assuming the target did not have it.
`org-refile--get-location' does lookup for entries with and without
slash, so it was not causing any issues before. It works as it is now
as well.
Thanks to Gustavo Barros for a very detailed bug report.
TINYCHANGE
* lisp/org-refile.el (org-refile-get-targets): Ensure that the
arguments of `file-name-nondirectory' and `file-truename' are not nil.
This prevents errors from being raised when calling `org-refile' in a
buffer that is not visiting a file.
TINYCHANGE
* lisp/org-refile.el (org-refile-get-targets): Ensure that the
arguments of `file-name-nondirectory' and `file-truename' are not nil.
This prevents errors from being raised when calling `org-refile' in a
buffer that is not visiting a file.
TINYCHANGE
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).