branch: externals/org-real
commit 678ec4e201dcae44d0bc8b511fe66674712350ca
Author: Tyler Grinn <[email protected]>
Commit: Tyler Grinn <[email protected]>
Removed reimplementation of org-link-make-string
---
demo/garage.org | 32 ++++++++++++++++----------------
org-real.el | 30 ++++++------------------------
2 files changed, 22 insertions(+), 40 deletions(-)
diff --git a/demo/garage.org b/demo/garage.org
index ca2c554..abded66 100644
--- a/demo/garage.org
+++ b/demo/garage.org
@@ -1,17 +1,17 @@
* Items in the garage
- - [[real://garage/workbench][workbench]]
- - [[real://garage/workbench/paintbrush?rel=in front of][paintbrush]]
- - [[real://garage/workbench/paintbrush?rel=in front of/wrench?rel=to the
left of][wrench]]
- - [[real://garage/workbench/nails?rel=on top of/screwdriver?rel=on top
of][screwdriver]]
- - [[real://garage/workbench/ratchet?rel=on top of][ratchet]]
- - [[real://garage/east wall/rake?rel=on/hoe?rel=to the left
of/snowblower?rel=above/shovel?rel=above][shovel]]
- - [[real://garage/east wall/rake?rel=on][rake]]
- - [[real://garage/workbench/hammer?rel=on][hammer]]
- - [[real://garage/east wall/rake?rel=on/hoe?rel=to the left of][hoe]]
- - [[real://garage/car/air freshener][air freshener]]
- - [[real://garage/workbench/nails?rel=on top of][nails]]
- - [[real://garage/east wall][East wall]]
- - [[real://garage/east wall/rake?rel=on/hoe?rel=to the left
of/snowblower?rel=above][snowblower]]
- - [[real://garage/workbench/nails?rel=on top of/screws?rel=above][screws]]
- - [[real://garage/saw?rel=on][saw]]
- - [[real://garage/workbench/paintbrush?rel=in front of/wrench?rel=to the
left of/pliers?rel=below][pliers]]
+ - [[real://house/garage/workbench][workbench]]
+ - [[real://house/garage/workbench/paintbrush?rel=in front of][paintbrush]]
+ - [[real://house/garage/workbench/paintbrush?rel=in front of/wrench?rel=to
the left of][wrench]]
+ - [[real://house/garage/workbench/nails?rel=on top of/screwdriver?rel=on top
of][screwdriver]]
+ - [[real://house/garage/workbench/ratchet?rel=on top of][ratchet]]
+ - [[real://house/garage/east wall/rake?rel=on/hoe?rel=to the left
of/snowblower?rel=above/shovel?rel=above][shovel]]
+ - [[real://house/garage/east wall/rake?rel=on][rake]]
+ - [[real://house/garage/workbench/hammer?rel=on][hammer]]
+ - [[real://house/garage/east wall/rake?rel=on/hoe?rel=to the left of][hoe]]
+ - [[real://house/garage/car/air freshener][air freshener]]
+ - [[real://house/garage/workbench/nails?rel=on top of][nails]]
+ - [[real://house/garage/east wall][East wall]]
+ - [[real://house/garage/east wall/rake?rel=on/hoe?rel=to the left
of/snowblower?rel=above][snowblower]]
+ - [[real://house/garage/workbench/nails?rel=on top
of/screws?rel=above][screws]]
+ - [[real://house/garage/saw?rel=on][saw]]
+ - [[real://house/garage/workbench/paintbrush?rel=in front of/wrench?rel=to
the left of/pliers?rel=below][pliers]]
diff --git a/org-real.el b/org-real.el
index d97071a..04e165c 100644
--- a/org-real.el
+++ b/org-real.el
@@ -50,7 +50,7 @@
;;;; Requirements
;;;###autoload
-(require 'org)
+(require 'ol)
(require 'boxy)
(require 'eieio)
@@ -304,7 +304,7 @@ diagram."
(org-in-regexp
org-link-bracket-re 1)
(match-end 2)
(match-string-no-properties 2))))
- (new-link (org-real--link-make-string
replace-link old-desc)))
+ (new-link (org-link-make-string replace-link
old-desc)))
(push
`(lambda ()
(save-excursion
@@ -521,7 +521,10 @@ level."
;;;; Utility expressions
(defun org-real--find-last-index (pred sequence)
- "Return the index of the last element for which (PRED element) is non-nil in
SEQUENCE."
+ "Return the index of the last matching element.
+
+Calls (PRED element) for each element in SEQUENCE until a match
+is found."
(let ((i (- (length sequence) 1)))
(catch 'match
(mapc
@@ -531,27 +534,6 @@ level."
(reverse sequence))
nil)))
-(defun org-real--link-make-string (link &optional description)
- "Make a bracket link, consisting of LINK and DESCRIPTION.
-LINK is escaped with backslashes for inclusion in buffer."
- (let* ((zero-width-space (string ?\x200B))
- (description
- (and (org-string-nw-p description)
- ;; Description cannot contain two consecutive square
- ;; brackets, or end with a square bracket. To prevent
- ;; this, insert a zero width space character between
- ;; the brackets, or at the end of the description.
- (replace-regexp-in-string
- "\\(]\\)\\(]\\)"
- (concat "\\1" zero-width-space "\\2")
- (replace-regexp-in-string "]\\'"
- (concat "\\&" zero-width-space)
- (org-trim description))))))
- (if (not (org-string-nw-p link)) description
- (format "[[%s]%s]"
- (org-link-escape link)
- (if description (format "[%s]" description) "")))))
-
(defun org-real--parse-url (str &optional marker)
"Parse STR into a list of plists.