[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote ca1c534ac9 09/12: Make denote-region obey denote
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote ca1c534ac9 09/12: Make denote-region obey denote-prompts |
Date: |
Thu, 4 Jan 2024 06:57:54 -0500 (EST) |
branch: externals/denote
commit ca1c534ac99e85d060673c39eff3bd5326cab17d
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Make denote-region obey denote-prompts
---
README.org | 11 ++++-------
denote.el | 20 ++++++++++++++------
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/README.org b/README.org
index 02aa3d7863..f32d34e32d 100644
--- a/README.org
+++ b/README.org
@@ -2758,13 +2758,10 @@ Sources for ~tmr~:
#+findex: denote-region
The command ~denote-region~ takes the contents of the active region
-and then prompts for a title and keywords. Once a new note is
-created, it inserts the contents of the region therein. This is
-useful to quickly elaborate on some snippet of text or capture it for
-future reference.
-
-If there is no active region, ~denote-region~ simply calls the
-~denote~ command which will behave the way it does ordinarily.
+and then calls the ~denote~ command. Once a new note is created, it
+inserts the contents of the region therein. This is useful to
+quickly elaborate on some snippet of text or capture it for future
+reference.
#+vindex: denote-region-after-new-note-functions
When the ~denote-region~ command is called with an active region, it
diff --git a/denote.el b/denote.el
index 04b0750afc..e245423591 100644
--- a/denote.el
+++ b/denote.el
@@ -1794,6 +1794,15 @@ increment it 1 second at a time until an available id is
found."
;;;;; The `denote' command and its prompts
+(defvar denote--use-region-in-denote-command t
+ "If non-nil, the region can be used by the `denote' command.
+
+The `denote' command uses the region as the default title when
+prompted for a title. When this variable is nil, the `denote'
+command ignores the region. This variable is meant to be used in
+commands such as `denote-region' which have their own way of
+handling the region.")
+
;;;###autoload
(defun denote (&optional title keywords file-type subdirectory date template
signature)
"Create a new note with the appropriate metadata and file name.
@@ -1832,7 +1841,8 @@ When called from Lisp, all arguments are optional.
(dolist (prompt denote-prompts)
(pcase prompt
('title (aset args 0 (denote-title-prompt
- (when (use-region-p)
+ (when (and denote--use-region-in-denote-command
+ (use-region-p))
(buffer-substring-no-properties
(region-beginning)
(region-end))))))
@@ -2104,10 +2114,7 @@ is set to \\='(signature title keywords)."
;;;###autoload
(defun denote-region ()
- "Call `denote' and insert therein the text of the active region.
-Prompt for title and keywords. With no active region, call
-`denote' ordinarily (refer to its documentation for the
-technicalities)."
+ "Call `denote' and insert therein the text of the active region."
(declare (interactive-only t))
(interactive)
(if-let (((region-active-p))
@@ -2115,7 +2122,8 @@ technicalities)."
;; the moment `insert' is called.
(text (buffer-substring-no-properties (region-beginning)
(region-end))))
(progn
- (denote (denote-title-prompt) (denote-keywords-prompt))
+ (let ((denote--use-region-in-denote-command nil))
+ (call-interactively 'denote))
(push-mark (point))
(insert text)
(run-hook-with-args 'denote-region-after-new-note-functions (mark)
(point)))
- [elpa] externals/denote updated (5e9b6b3bf0 -> 4731e0ab0f), ELPA Syncer, 2024/01/04
- [elpa] externals/denote 4ec5bfbd7b 01/12: Make denote-rename-file prompts more consistent, ELPA Syncer, 2024/01/04
- [elpa] externals/denote c41d3427f8 05/12: Sort keywords outside denote-keywords-sort, ELPA Syncer, 2024/01/04
- [elpa] externals/denote 63d25e0cfd 08/12: Update README section on the file naming scheme, ELPA Syncer, 2024/01/04
- [elpa] externals/denote 7011c3894a 04/12: Fix denote-directory-files, ELPA Syncer, 2024/01/04
- [elpa] externals/denote c76eba3708 07/12: Refactor slug functions and denote-letter-case, ELPA Syncer, 2024/01/04
- [elpa] externals/denote 083862d829 06/12: Use new denote--slug-no-punct-for-signature in denote-sluggify-signature, ELPA Syncer, 2024/01/04
- [elpa] externals/denote 4731e0ab0f 12/12: Merge pull request #217 from jeanphilippegg/denote-region, ELPA Syncer, 2024/01/04
- [elpa] externals/denote b5ef3f5481 02/12: Simplify denote-convert-file-name-keywords-to-crm, ELPA Syncer, 2024/01/04
- [elpa] externals/denote ca1c534ac9 09/12: Make denote-region obey denote-prompts,
ELPA Syncer <=
- [elpa] externals/denote 15736c648e 10/12: Merge pull request #208 from jeanphilippegg/denote-rename-file, ELPA Syncer, 2024/01/04
- [elpa] externals/denote 6da2d7b2e4 11/12: Merge pull request #210 from jeanphilippegg/slug-functions, ELPA Syncer, 2024/01/04
- [elpa] externals/denote 0fde4498e5 03/12: Simplify denote-keywords-prompt, ELPA Syncer, 2024/01/04