emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote 5faa20b7bf 1/3: Use active region in default tit


From: ELPA Syncer
Subject: [elpa] externals/denote 5faa20b7bf 1/3: Use active region in default title prompt
Date: Tue, 23 Aug 2022 13:57:29 -0400 (EDT)

branch: externals/denote
commit 5faa20b7bf2308f31176904fa2946cb254e988bf
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Use active region in default title prompt
    
    Facilitate a slightly smoother note taking by passing the contents of
    the region from the denote command to denote--title-prompt as the
    DEFAULT-TITLE argument, when the region is active.
    
    The idea behind this DWIM-flavored patch is to be able to take a note
    about a subject that appears in a buffer by simply marking it before
    invoking the denote command, which feels natural to me.
---
 denote.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index 4b3598b057..ddc72561cd 100644
--- a/denote.el
+++ b/denote.el
@@ -1084,7 +1084,11 @@ When called from Lisp, all arguments are optional.
    (let ((args (make-vector 6 nil)))
      (dolist (prompt denote-prompts)
        (pcase prompt
-         ('title (aset args 0 (denote--title-prompt)))
+         ('title (aset args 0 (denote--title-prompt
+                               (when (use-region-p)
+                                 (buffer-substring-no-properties
+                                  (region-beginning)
+                                  (region-end))))))
          ('keywords (aset args 1 (denote--keywords-prompt)))
          ('file-type (aset args 2 (denote--file-type-prompt)))
          ('subdirectory (aset args 3 (denote--subdirs-prompt)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]