From: Philip Kaludercic <philipk@posteo.net>
To: Protesilaos Stavrou <info@protesilaos.com>
Cc: emacs-devel@gnu.org
Subject: Re: [ELPA] New consult-denote package
Date: Wed, 08 May 2024 17:19:51 +0000 [thread overview]
Message-ID: <87h6f8xlu0.fsf@posteo.net> (raw)
In-Reply-To: <871q6cwnb5.fsf@protesilaos.com> (Protesilaos Stavrou's message of "Wed, 08 May 2024 14:33:18 +0300")
[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]
Protesilaos Stavrou <info@protesilaos.com> writes:
> Hello folks!
>
> I plan to push the attached change to elpa.git. Any thoughts?
>
> The goal of this package is to enhance the minibuffer prompts of
> 'denote' with some of the features provided by 'consult'.
>
> Both Consult and Denote are on GNU ELPA.
>
> All the best,
> Protesilaos (or simply "Prot")
>
> --
> Protesilaos Stavrou
> https://protesilaos.com
>
> From c3097070c9a427764c05749daecc6c303b87ec72 Mon Sep 17 00:00:00 2001
> Message-Id: <c3097070c9a427764c05749daecc6c303b87ec72.1715167446.git.info@protesilaos.com>
> From: Protesilaos Stavrou <info@protesilaos.com>
> Date: Wed, 8 May 2024 14:23:15 +0300
> Subject: [PATCH] * elpa-packages (consult-denote): Add new package
>
> ---
> elpa-packages | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/elpa-packages b/elpa-packages
> index de66d29..02babee 100644
> --- a/elpa-packages
> +++ b/elpa-packages
> @@ -170,6 +170,8 @@
> :doc "README.org"
> :news "CHANGELOG.org"
> :ignored-files ("LICENSE"))
> + (consult-denote :url "https://github.com/protesilaos/consult-denote"
> + :readme "README.md")
> (consult-hoogle :url "https://codeberg.org/rahguzar/consult-hoogle"
> :ignored-files ("LICENSE"))
> (consult-recoll :url "https://codeberg.org/jao/consult-recoll"
Here are a few quick comments:
[-- Attachment #2: Type: text/plain, Size: 2481 bytes --]
diff --git a/consult-denote.el b/consult-denote.el
index 135838e..76895a8 100644
--- a/consult-denote.el
+++ b/consult-denote.el
@@ -90,7 +90,7 @@ aforementioned function."
(let* ((default-directory (denote-directory))
(common-parent-directory
(let ((common-prefix (try-completion "" all-files)))
- (if (> (length common-prefix) 0)
+ (if (length> common-prefix 0)
(file-name-directory common-prefix))))
(cpd-length (length common-parent-directory))
(prompt-prefix (or prompt-text "Select FILE"))
@@ -101,16 +101,16 @@ aforementioned function."
(setq all-files
(delete common-parent-directory all-files))
t))
- (substrings (mapcar (lambda (s) (substring s cpd-length)) all-files))
- (_ (when included-cpd
- (setq substrings (cons "./" substrings))))
+ (substrings (append
+ (if included-cpd '("./"))
+ (mapcar (lambda (s) (substring s cpd-length)) all-files)))
(new-collection (denote--completion-table 'file substrings))
;; We populate the history ourselves because we process the input.
(input
(consult--read new-collection
:state (consult--file-preview)
:prompt prompt))
- ;; FIXME 2024-05-08: Is there some elegant way to do this?
+ ;; FIXME 2024-05-08: Is there some elegant way to do this? what is "this"
(filename (with-temp-buffer
(insert input)
(completion-in-region (point-min) (point-max) new-collection)
@@ -164,14 +164,13 @@ aforementioned function."
(defun consult-denote--buffers ()
"Return file names of Denote buffers."
- (delq nil
- (mapcar
- (lambda (buffer)
- (when-let ((file (buffer-file-name buffer))
- ((buffer-live-p buffer))
- ((denote-filename-is-note-p file)))
- (buffer-name buffer)))
- (buffer-list))))
+ (mapcan ;or use `match-buffers'
+ (lambda (buffer)
+ (and-let* ((file (buffer-file-name buffer))
+ ((buffer-live-p buffer))
+ ((denote-filename-is-note-p file)))
+ (list (buffer-name buffer))))
+ (buffer-list)))
(defvar consult-denote--buffer-source
`( :name "Denote buffers"
[-- Attachment #3: Type: text/plain, Size: 38 bytes --]
--
Philip Kaludercic on peregrine
next prev parent reply other threads:[~2024-05-08 17:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-08 11:33 [ELPA] New consult-denote package Protesilaos Stavrou
2024-05-08 17:19 ` Philip Kaludercic [this message]
2024-05-09 4:00 ` Protesilaos Stavrou
2024-05-09 8:20 ` Philip Kaludercic
2024-05-09 9:38 ` Protesilaos Stavrou
2024-05-09 10:30 ` Visuwesh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h6f8xlu0.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=emacs-devel@gnu.org \
--cc=info@protesilaos.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).