[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 42fcbd39a9 2/2: Add command 'denote-link-after-c
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 42fcbd39a9 2/2: Add command 'denote-link-after-creating-with-command' (also see cd47e8b) |
Date: |
Wed, 20 Sep 2023 12:57:59 -0400 (EDT) |
branch: externals/denote
commit 42fcbd39a91d891b3f217fbd8ce93a982cfa54df
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add command 'denote-link-after-creating-with-command' (also see cd47e8b)
---
README.org | 12 ++++++++++++
denote.el | 21 +++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/README.org b/README.org
index 0088a0dad9..c65573f0bd 100644
--- a/README.org
+++ b/README.org
@@ -1799,6 +1799,14 @@ this end, Denote provides two convenience commands:
the buffer in order to (i) establish valid links, and (ii) retrieve
whatever front matter from the target file.
+#+findex: denote-link-after-creating-with-command
++ ~denote-link-after-creating-with-command~ :: This command is like
+ ~denote-link-after-creating~ except it prompts for a note-creating
+ command ([[*Points of entry][Points of entry]]). Use this to, for example,
call
+ ~denote-signature~ so that the newly created note has a signature as
+ part of its file name. Optional =ID-ONLY= has the same meaning as
+ in the command ~denote-link-after-creating~.
+
#+findex: denote-link-or-create
+ ~denote-link-or-create~ :: Use ~denote-link~ on =TARGET= file,
creating it if necessary.
@@ -2860,6 +2868,10 @@ For templates, refer to `denote-templates'."
:CUSTOM_ID: h:b6056e6b-93df-4e6b-a778-eebd105bac46
:END:
+[ As part of {{{development-version}}} we provide the command
+ ~denote-link-after-creating-with-command~. It supersedes what we
+ document in this section. ]
+
#+findex: denote-link-or-create
The command ~denote-link-or-create~ uses ~denote-link~ on a =TARGET=
file, creating it if necessary. The =TARGET= matches the user input at
diff --git a/denote.el b/denote.el
index acc92251d4..36b8ea83a7 100644
--- a/denote.el
+++ b/denote.el
@@ -3097,6 +3097,8 @@ With optional ID-ONLY as a prefix argument create a link
that
consists of just the identifier. Else try to also include the
file's title. This has the same meaning as in `denote-link'.
+For a variant of this, see `denote-link-after-creating-with-command'.
+
IMPORTANT NOTE: Normally, `denote' does not save the buffer it
produces for the new note. This is a safety precaution to not
write to disk unless the user wants it (e.g. the user may choose
@@ -3114,6 +3116,25 @@ file."
(setq path (buffer-file-name)))
(denote-link path id-only)))
+;;;###autoload
+(defun denote-link-after-creating-with-command (command &optional id-only)
+ "Like `denote-link-after-creating' but prompt for note-making COMMAND.
+Use this to, for example, call `denote-signature' so that the
+newly created note has a signature as part of its file name.
+
+Optional ID-ONLY has the same meaning as in the command
+`denote-link-after-creating'."
+ (interactive
+ (list
+ (denote-command-prompt)
+ current-prefix-arg))
+ (let (path)
+ (save-window-excursion
+ (call-interactively command)
+ (save-buffer)
+ (setq path (buffer-file-name)))
+ (denote-link path id-only)))
+
;;;###autoload
(defun denote-link-or-create (target &optional id-only)
"Use `denote-link' on TARGET file, creating it if necessary.