From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Protesilaos Stavrou Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New consult-denote package Date: Thu, 09 May 2024 12:38:55 +0300 Message-ID: <87ttj78guo.fsf@protesilaos.com> References: <871q6cwnb5.fsf@protesilaos.com> <87h6f8xlu0.fsf@posteo.net> <87ttj7skhf.fsf@protesilaos.com> <87cypvz999.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10016"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu May 09 11:39:51 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s50Fi-0002Q7-QG for ged-emacs-devel@m.gmane-mx.org; Thu, 09 May 2024 11:39:51 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s50FE-0000mU-Fz; Thu, 09 May 2024 05:39:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s50Ew-0000ix-BQ for emacs-devel@gnu.org; Thu, 09 May 2024 05:39:05 -0400 Original-Received: from relay3-d.mail.gandi.net ([2001:4b98:dc4:8::223]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s50Et-0005PO-Nz for emacs-devel@gnu.org; Thu, 09 May 2024 05:39:02 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id D5B9260003; Thu, 9 May 2024 09:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protesilaos.com; s=gm1; t=1715247537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TPTGyOBEXJx6sne0uMOrmvMeVuKdLC0Oxo4UQK7VEb4=; b=CqEX9qjaKpwgdeOMsBQAo3WXRN6pmlbwWgJW33tSbSTBSKheIPgnTF+6MlH9S5u3BNixK/ gJ8y0qZ9ooFki/CVFR2SK+B0BLOsVc//43UVWgYnHAWCFZ8hCeFUPmQe68R3Irz3TlHdH0 AnPs2zRoiinV/gr7BVnUV9vY27nFodsttIary3DpoIpvBq77Tvq3l/1Wai54tp+KJ5bNpS hcSmjBOQVdDCnE1ZMY8DWfeSRcQ50SgompEobYt2JPQtEuOlAWZiVBN3X22kwr38puWW1J KUxSY7YakpgGHmeS+FwW0ImbbSx74TcQJl60c90oFNOmP0Toxl0b/KeU6sj3cw== In-Reply-To: <87cypvz999.fsf@posteo.net> X-GND-Sasl: info@protesilaos.com Received-SPF: none client-ip=2001:4b98:dc4:8::223; envelope-from=info@protesilaos.com; helo=relay3-d.mail.gandi.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:319058 Archived-At: > From: Philip Kaludercic > Date: Thu, 9 May 2024 08:20:50 +0000 > [... 18 lines elided] >> The FIXME there is about the following use of the temp buffer to do a >> completion-in-region in. Basically, I was looking for a function that >> would complete a string against the list of candidates. What I have >> there works, of course, but feels I am missing something. > > Isn't that the same as > > (try-completion input new-collection) > > or am I missing something? The 'try-completion' does not seem to read the 'completion-styles'. It works if the input matches the prefix of the candidate, but otherwise it returns nil. Trying it with this: (defun denote--completion-table (category candidates) "Pass appropriate metadata CATEGORY to completion CANDIDATES." (lambda (string pred action) (if (eq action 'metadata) `(metadata (category . ,category)) (complete-with-action action candidates string pred)))) (setq completion-styles '(basic substring)) ; I also have `orderless' in my setup ;; This returns nil (try-completion "magritte" (denote--completion-table 'file '("20220220T122457--magritte-pipe__attachment_painting_philosophy.jpg" "20231129T125442--note-with-a-title__denote_test.txt"))) ;; This returns the candidate (try-completion "2022" (denote--completion-table 'file '("20220220T122457--magritte-pipe__attachment_painting_philosophy.jpg" "20231129T125442--note-with-a-title__denote_test.txt"))) -- Protesilaos Stavrou https://protesilaos.com