Age | Commit message (Collapse) | Author |
|
This is a port of cc7c4a673 (Rationalize `org-link-(un)escape',
2019-02-27) from the Org mode repository, which I should have taken in
at the same time I ported other changes in 819a6a3.
Discussion of the link encoding change is at
<https://yhetil.org/orgmode/87tvguyohn.fsf@nicolasgoaziou.fr/>.
|
|
While this of course doesn't really matter, the docstring changes were
already made as part of a tree-wide substitution in Org's
b289a65be (Use https for links to orgmode.org, 2018-01-16).
|
|
|
|
|
|
|
|
|
|
I shouldn't rely on the license notice at the top of the files.
|
|
|
|
|
|
Org v9.3 is now the minimum requirement.
|
|
Many link-related names changed in a486d9cbd (Move link-related core
functions out of "org.el", 2018-11-27).
|
|
2b00d6281 (Change bracket link escape syntax, 2019-03-09) updated a
match group in org-link-edit--link-data for a change in
org-bracket-link-regexp. Apply the change here.
That commit is included in the recently released v9.3. Set that as
the minimum requirement because the new value will not work with
earlier releases.
|
|
The existing description may not be of interest to the caller,
especially if it was automatically generated by org-store-link.
|
|
|
|
|
|
These are cruft left from copying the (should-error ...) sexps from a
(should (string= ...) one.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A to-be-transported link is allowed to have a description if a new
description isn't specified by the word at point or the selected text.
In this case, don't drop the original description during transport.
|
|
Make it more obvious that this variable corresponds to the original
link's description, not the new description specified by the word at
point or the selected text.
|
|
When point is on whitespace, there are no description bounds because
there is no text to use for the description. Avoid a type error in
this case by navigating to the initial location of point rather than
the left description bound.
|
|
|
|
|
|
The function should-error allows "(list 'error)" to be shortened to
"'error".
|
|
|
|
|
|
|
|
|
|
|
|
The slurping and barfing commands are interested in point being on a
link, so it is sufficient for them to use org-link-edit--get-link-data
and get a user-error when point is not on a link. But an upcoming
command will want to know that point is _not_ in a link.
|
|
|
|
|
|
When a point is on a blank space beyond the link but before the next
element, org-element-context considers point to be a part of the link.
This leads to incorrect behavior (shown in the added tests) when
either barfing backward or forward. Avoid these issues by moving
point to the beginning of the link before deleting the old link and
inserting a new one. As a bonus, this makes some of the later
goto-char calculations unnecessary.
|
|
Most of the tests fail when running them with 8.2 checked out from the
Org repo. So far, it hasn't been too much extra work supporting
8.2.10 [*], but I'd rather not deal with the headache of trying to
support anything older.
[*] This is the version that shipped with Emacs 25.1. The current Org
version is 9.0.5.
|
|
Before Org 8.3 (specifically before aea374680), org-link-unescape
called string-match, which changes the match data and interferes with
extracting the description. (I noticed this because the slurp/barf
round-trip test failed with Org 8.2.10, but not on newer versions.)
Save the match data before calling org-link-unescape.
|
|
|
|
|
|
|
|
org-make-link-string will escape the link again when it's reinserted.
|
|
|
|
|
|
|
|
|
|
... instead of replacing each new line with a space.
|