[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 4a10683036 5/8: Make stylistic tweaks to denote-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 4a10683036 5/8: Make stylistic tweaks to denote-link |
Date: |
Sat, 8 Oct 2022 20:57:32 -0400 (EDT) |
branch: externals/denote
commit 4a1068303608e67cf2d0bad486e18134854ed51f
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Make stylistic tweaks to denote-link
This builds on the commits b350035, fe66333 by Charanjit Singh:
<https://github.com/protesilaos/denote/pull/109>.
---
denote.el | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/denote.el b/denote.el
index e807b97f98..9182690375 100644
--- a/denote.el
+++ b/denote.el
@@ -2241,8 +2241,8 @@ title."
(defun denote-link--format-link (file pattern &optional description)
"Prepare link to FILE using PATTERN.
-If DESCRIPTION is non-nil, it is used as link description instead
-of FILE's title."
+If DESCRIPTION is non-nil, use it as link description instead of
+FILE's title."
(let* ((file-id (denote-retrieve-filename-identifier file))
(file-type (denote-filetype-heuristics file))
(file-title (unless (string= pattern denote-link--format-id-only)
@@ -2255,20 +2255,23 @@ of FILE's title."
With optional ID-ONLY, such as a universal prefix
argument (\\[universal-argument]), insert links with just the
identifier and no further description. In this case, the link
-format is always [[denote:IDENTIFIER]]. If region is active,
-region is replaced with the link while using the region as link
-title."
+format is always [[denote:IDENTIFIER]].
+
+If region is active, use its text as the link's description
+instead of TARGET's title."
(interactive (list (denote-file-prompt) current-prefix-arg))
(let* ((beg (point))
- (description (when-let (((region-active-p))
- (selected-text
(buffer-substring-no-properties (region-beginning) (region-end))))
- (delete-region (region-beginning) (region-end))
- selected-text))
- (link (denote-link--format-link
- target
- (denote-link--file-type-format (buffer-file-name) id-only)
- description)))
- (insert link)
+ (description (when-let* (((region-active-p))
+ (beg (region-beginning))
+ (end (region-end))
+ (selected-text
(buffer-substring-no-properties beg end)))
+ (delete-region beg end)
+ selected-text)))
+ (insert
+ (denote-link--format-link
+ target
+ (denote-link--file-type-format (buffer-file-name) id-only)
+ description))
(unless (derived-mode-p 'org-mode)
(make-button beg (point) 'type 'denote-link-button))))
- [elpa] externals/denote updated (31e6bcb2eb -> 369f3cc7af), ELPA Syncer, 2022/10/08
- [elpa] externals/denote 4a10683036 5/8: Make stylistic tweaks to denote-link,
ELPA Syncer <=
- [elpa] externals/denote d0aab79ed2 4/8: Acknowledge Charanjit Singh, ELPA Syncer, 2022/10/08
- [elpa] externals/denote 369f3cc7af 8/8: Add TODO for denote-link region, ELPA Syncer, 2022/10/08
- [elpa] externals/denote 44c2a6add8 6/8: Clarify denote-link doc string on description text, ELPA Syncer, 2022/10/08
- [elpa] externals/denote fe66333d84 1/8: feat: use region as link title on denote-link, ELPA Syncer, 2022/10/08
- [elpa] externals/denote e4450998f3 7/8: Document the ability to link to region text, ELPA Syncer, 2022/10/08
- [elpa] externals/denote b350035103 2/8: refactor: handle region-activation entirely in denote-link, ELPA Syncer, 2022/10/08
- [elpa] externals/denote 2bb344e344 3/8: Merge pull request #109 from bitspook/links-with-region-as-title, ELPA Syncer, 2022/10/08