[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/embark 7758a1ac64: Recognize Org links in any buffer (f
From: |
ELPA Syncer |
Subject: |
[elpa] externals/embark 7758a1ac64: Recognize Org links in any buffer (fixes #666) |
Date: |
Sun, 24 Sep 2023 03:58:03 -0400 (EDT) |
branch: externals/embark
commit 7758a1ac64d784fa71f14b202b7a26c27f29d03e
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>
Recognize Org links in any buffer (fixes #666)
---
CHANGELOG.org | 4 ++++
embark-org.el | 18 ++++++++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.org b/CHANGELOG.org
index 0eda3da05f..99afe75792 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -1,5 +1,9 @@
#+title: Embark changelog
+* Development version
+- =embark-bindings= and similar commands now show definition of keyboard
+ macros.
+- =embark-org= now recognizes Org links in non-org buffers.
* Version 0.23 (2023-09-19)
- Added a mode line indicator showing the number of selected targets in
the current buffer (contributed by @minad, thanks!)
diff --git a/embark-org.el b/embark-org.el
index fa541c0b0d..6b963a3e2a 100644
--- a/embark-org.el
+++ b/embark-org.el
@@ -220,7 +220,7 @@
;; also without the "file:" prefix nor the "::line-number or search"
;; suffix. That way, file actions will correctly apply to it.
-;; - The type will not be 'file, but 'org-file-link that way we can
+;; - The type will not be 'file, but 'org-file-link; that way we can
;; register a keymap for 'org-file-link that inherits from both
;; embark-org-link-map (with RET bound to org-open-at-point and a
;; few other generic link actions) and embark-file-map.
@@ -242,6 +242,20 @@
;; slightly more complex design allows both whole-link and inner
;; target actions to work without cycling.
+(defun embark-org-target-link ()
+ "Target Org link at point."
+ (pcase (org-in-regexp org-link-any-re)
+ (`(,start . ,end)
+ ;; We won't recognize unadorned http(s) or mailto links, as those
+ ;; already have target finders (but if these links have either a
+ ;; description, double brackets or angle brackets, then we do
+ ;; recognize them as org links)
+ (unless (save-excursion (goto-char start) (looking-at "http\\|mailto"))
+ `(org-link ,(buffer-substring start end) ,start . ,end)))))
+
+(let ((tail (memq 'embark-target-active-region embark-target-finders)))
+ (cl-pushnew 'embark-org-target-link (cdr tail)))
+
(autoload 'org-attach-dir "org-attach")
(defun embark-org--refine-link-type (_type target)
@@ -331,7 +345,7 @@ bound to i."
(defvar-keymap embark-org-link-map
:doc "Keymap for actions on Org links."
:parent embark-general-map
- "RET" #'org-open-at-point
+ "RET" #'org-open-at-point-global
"'" #'org-insert-link
"w" #'embark-org-link-copy-map)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/embark 7758a1ac64: Recognize Org links in any buffer (fixes #666),
ELPA Syncer <=