Received: (at 66567) by debbugs.gnu.org; 1 Nov 2023 14:37:49 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 01 10:37:49 2023 Received: from localhost ([127.0.0.1]:52161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qyCLs-0002Mt-HK for submit <at> debbugs.gnu.org; Wed, 01 Nov 2023 10:37:49 -0400 Received: from mout-p-102.mailbox.org ([2001:67c:2050:0:465::102]:49840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tonyzorman@HIDDEN>) id 1qyCLp-0002Mb-4d for 66567 <at> debbugs.gnu.org; Wed, 01 Nov 2023 10:37:46 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4SL8j82H3hz9t3g; Wed, 1 Nov 2023 15:37:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1698849420; 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=ttURzOEF2/TloRKsUrlTespENJDl7tmwCxNRy24hZR4=; b=v7MQwZwETXK2FR78Ud0RT1SN/MsU5ZT7utIrCpMtQzRgQ48oiWqyqJRQLGF1b4qdmlyhhX V0bNjxYyFuzHjUBlAMdC+OsfJx8tlIHOtNEmuOckWJ6SfMKDLIT7SJv1ROJk4H26SWcVU5 uOfXV2RC/42LPV5C7kJkdVvO7XVzbkp29u0ZWUiCD9kUrqQYf5omT9dy720xyHR68GaX52 kHNPefwlzCPbCkS4AAh+/zNmueITqHOmCh3xYx/0EspWvqWqFpfFJDO22gw6EO7vKOsC76 uNqEk+TMT+vl/XR1Y8Xm14heW8x9EhqlMO505dgU5MewOct8ESiWu83Q2s8Udg== From: Tony Zorman <tonyzorman@HIDDEN> To: Philip Kaludercic <philipk@HIDDEN> Subject: Re: bug#66567: [PATCH] use-package: Add ignored-files support to :vc keyword In-Reply-To: <87r0l91vww.fsf@HIDDEN> References: <877cnn4z2v.fsf@hyperspace> <87ttq5u9fj.fsf@HIDDEN> <87ttq5bx2y.fsf@hyperspace> <87r0l91vww.fsf@HIDDEN> Date: Wed, 01 Nov 2023 15:36:58 +0100 Message-ID: <87r0l9fsl1.fsf@hyperspace> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-MBO-RS-META: 758ntbztpbg5hsbu9yc8zx4az65gcbbs X-MBO-RS-ID: 0aed99f9099214ddc11 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 66567 Cc: stefankangas@HIDDEN, 66567 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Wed, Nov 01 2023 12:48, Philip Kaludercic wrote: > Tony Zorman <tonyzorman@HIDDEN> writes: > >> On Wed, Nov 01 2023 09:09, Philip Kaludercic wrote: >>>> diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/u= se-package-core.el >>>> index 34c45b7aec..5d0d554baf 100644 >>>> --- a/lisp/use-package/use-package-core.el >>>> +++ b/lisp/use-package/use-package-core.el >>>> @@ -1654,7 +1654,8 @@ use-package-normalize--vc-arg >>>> (t (ensure-string v)))) >>>> (:vc-backend (ensure-symbol v)) >>>> (_ (ensure-string v))))) >>>> - (pcase-let ((valid-kws '(:url :branch :lisp-dir :main-file :vc-ba= ckend :rev)) >>>> + (pcase-let ((valid-kws '( :url :branch :lisp-dir :main-file :vc-b= ackend :rev >>>> + :shell-command :make)) >>> >>> Why is use-package checking for valid keywords in the first place? >> >> Better error messages, mostly. Especially people switching from >> quelpa/straight/vc-use-package might be surprised that :vc is not a >> drop-in replacement for those packages. I feel like alerting them to >> this fact sooner rather than later makes for a better experience. > > IIUC this would raise an error when an unknown keyword is encountered, > right? Yes, a declaration like (use-package foo :vc (:url "url" :blargh "123")) would result in the following message =E2=9B=94 Error (use-package): Failed to parse package foo: use-package= : Keyword :vc received unknown argument: :blargh. Supported keywords are: (= :url :branch :lisp-dir :main-file :vc-backend :rev :shell-command :make :ig= nored-files) Things get a bit muddier if ':blargh' would be passed down to package-vc-install. Now that you mention it, I noticed a tiny mistake (resulting in a worse error message!) in the second of the original patches. I've attached a corrected version. >>>> I will cheekily bump this, and also Cc. Philip as the most likely >>>> reviewer. >>> >>> I don't use use-package nor am I familiar with the code base, so I >>> wouldn't value my input that much. >> >> Oh, fair enough. In either case, I couldn't think of anyone else=E2=80= =94sorry >> for the noise :) > > I think that Stefan Kangas would probably be the best to ask, since he > was the one responsible for merging use-package into the core. Thanks! I have Cc'd Stefan, hoping to not come across as too pushy :) Tony --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-use-package-Add-ignored-files-support-to-vc-keyword.patch From f8590d37b29a96a7984d8acae2d6c2b557e0dc59 Mon Sep 17 00:00:00 2001 From: Tony Zorman <soliditsallgood@HIDDEN> Date: Sun, 15 Oct 2023 16:51:00 +0200 Subject: [PATCH] use-package: Add :ignored-files support to :vc keyword * lisp/use-package/use-package-core.el (use-package-split-when): New utility function to split a list whenever a specified predicate returns t. (use-package-vc-valid-keywords): A new defconst to gather all allowed keywords. (use-package-normalize--vc-arg): Properly normalize the :ignored-files keyword, in that the following are all valid ways of entering files: :ignored-files "a" :ignored-files ("a") :ignored-files "a" "b" "c" :ignored-files ("a" "b" "c") (use-package-normalize/:vc): Adjust normalization, now that we do not necessarily receive a valid plist as an input. * test/lisp/use-package/use-package-tests.el (use-package-test-normalize/:vc): Add tests for :ignored-files keyword. --- lisp/use-package/use-package-core.el | 60 ++++++++++++++++------ test/lisp/use-package/use-package-tests.el | 10 +++- 2 files changed, 52 insertions(+), 18 deletions(-) diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el index 5d0d554baf..974059a850 100644 --- a/lisp/use-package/use-package-core.el +++ b/lisp/use-package/use-package-core.el @@ -521,6 +521,24 @@ use-package-split-list-at-keys (let ((xs (use-package-split-list (apply-partially #'eq key) lst))) (cons (car xs) (use-package-split-list-at-keys key (cddr xs)))))) +(defun use-package-split-when (pred xs) + "Repeatedly split a list according to PRED. +Split XS every time PRED returns t. Keep the delimiters, and +arrange the result in an alist. For example: + + (use-package-split-when #\\='keywordp \\='(:a 1 :b 2 3 4 :c 5)) + ;; => \\='((:a 1) (:b 2 3 4) (:c 5)) + + (use-package-split-when (lambda (x) (> x 2)) \\='(10 1 3 2 4 -1 8 9)) + ;; => \\='((10 1) (3 2) (4 -1) (8) (9))" + (unless (seq-empty-p xs) + (pcase-let* ((`(,first . ,rest) (if (funcall pred (car xs)) + (cons (car xs) (cdr xs)) + (use-package-split-list pred xs))) + (`(,val . ,recur) (use-package-split-list pred rest))) + (cons (cons first val) + (use-package-split-when pred recur))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Keywords @@ -1634,6 +1652,12 @@ use-package-handler/:vc (push `(use-package-vc-install ',arg ,local-path) body)) ; runtime body)) +(defconst use-package-vc-valid-keywords + '( :url :branch :lisp-dir :main-file :vc-backend :rev + :shell-command :make :ignored-files) + "Valid keywords for the `:vc' keyword, see the Info +node `(emacs)Fetching Package Sources'.") + (defun use-package-normalize--vc-arg (arg) "Normalize possible arguments to the `:vc' keyword. ARG is a cons-cell of approximately the form that @@ -1653,24 +1677,26 @@ use-package-normalize--vc-arg ((eq v :newest) nil) (t (ensure-string v)))) (:vc-backend (ensure-symbol v)) + (:ignored-files (if (listp v) v (list v))) (_ (ensure-string v))))) - (pcase-let ((valid-kws '( :url :branch :lisp-dir :main-file :vc-backend :rev - :shell-command :make)) - (`(,name . ,opts) arg)) + (pcase-let* ((`(,name . ,opts) arg)) (if (stringp opts) ; (NAME . VERSION-STRING) ? (list name opts) - ;; Error handling - (cl-loop for (k _) on opts by #'cddr - if (not (member k valid-kws)) - do (use-package-error - (format "Keyword :vc received unknown argument: %s. Supported keywords are: %s" - k valid-kws))) - ;; Actual normalization - (list name - (cl-loop for (k v) on opts by #'cddr - if (not (eq k :rev)) - nconc (list k (normalize k v))) - (normalize :rev (plist-get opts :rev))))))) + (let ((opts (use-package-split-when + (lambda (el) (and (keywordp el) (not (equal :newest el)))) + opts))) + ;; Error handling + (cl-loop for (k . _) in opts + if (not (member k use-package-vc-valid-keywords)) + do (use-package-error + (format "Keyword :vc received unknown argument: %s. Supported keywords are: %s" + k use-package-vc-valid-keywords))) + ;; Actual normalization + (list name + (cl-loop for (k . v) in opts + if (not (eq k :rev)) + nconc (list k (normalize k (if (length= v 1) (car v) v)))) + (normalize :rev (car (alist-get :rev opts))))))))) (defun use-package-normalize/:vc (name _keyword args) "Normalize possible arguments to the `:vc' keyword. @@ -1686,9 +1712,9 @@ use-package-normalize/:vc ((or 'nil 't) (list name)) ; guess name ((pred symbolp) (list arg)) ; use this name ((pred stringp) (list name arg)) ; version string + guess name - ((pred plistp) ; plist + guess name + (`(,(pred keywordp) . ,(pred listp)) ; list + guess name (use-package-normalize--vc-arg (cons name arg))) - (`(,(pred symbolp) . ,(or (pred plistp) ; plist/version string + name + (`(,(pred symbolp) . ,(or (pred listp) ; list/version string + name (pred stringp))) (use-package-normalize--vc-arg arg)) (_ (use-package-error "Unrecognised argument to :vc.\ diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el index 9181a8171a..5636ba8a4f 100644 --- a/test/lisp/use-package/use-package-tests.el +++ b/test/lisp/use-package/use-package-tests.el @@ -2014,7 +2014,15 @@ use-package-test-normalize/:vc (should (equal '(foo) (use-package-normalize/:vc 'foo :vc nil))) (should (equal '(bar) - (use-package-normalize/:vc 'foo :vc '(bar))))) + (use-package-normalize/:vc 'foo :vc '(bar)))) + (should (equal + '(foo (:ignored-files ("a" "b" "c")) :last-release) + (use-package-normalize/:vc 'foo :vc '((:ignored-files "a" "b" "c"))))) + (should (equal + (use-package-normalize/:vc 'foo :vc '((:ignored-files "a"))) + (use-package-normalize/:vc 'foo :vc '((:ignored-files ("a")))))) + (should (equal (use-package-normalize/:vc 'foo :vc '((:ignored-files "a" "b" "c"))) + (use-package-normalize/:vc 'foo :vc '((:ignored-files ("a" "b" "c"))))))) ;; Local Variables: ;; no-byte-compile: t -- 2.42.0 --=-=-= Content-Type: text/plain -- Tony Zorman | https://tony-zorman.com/ --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#66567
; Package emacs
.
Full text available.Received: (at 66567) by debbugs.gnu.org; 1 Nov 2023 12:49:41 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 01 08:49:41 2023 Received: from localhost ([127.0.0.1]:50137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qyAfA-0007Ce-Qx for submit <at> debbugs.gnu.org; Wed, 01 Nov 2023 08:49:40 -0400 Received: from mout01.posteo.de ([185.67.36.65]:59427) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <philipk@HIDDEN>) id 1qyAf4-0007C5-Ug for 66567 <at> debbugs.gnu.org; Wed, 01 Nov 2023 08:49:35 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 360CB240027 for <66567 <at> debbugs.gnu.org>; Wed, 1 Nov 2023 13:48:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1698842930; bh=BsL+fEVKVmI/V3P4F4qOxkCWnurCprPmWOcdl5wvogA=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=A7DvvWJT5uO2id+vHg2HD7JUL6F7hxdTKJLb4IdwFHMO1C76iBCV2aaSVfFm7gI7L Uw4vnb6XmgXTxOrJcftnFm6znDzCZvdBeaHQF6UO0dJ+CjwEjtaSlvx0ki8NIckf5H ZrRfseX7RbGviJV3vwccevC41dhWMnfFL3Ez1o8JDJW4q19ZUsMXZjwX0tbDe2o19n umgSHt0a6dOgd4azKlqt/4g1sQq9dLLBFsdSdHH2DwGycoiDkCM8QuifUFIw6p8XWy leMP0NU7QFGcAfDCPGq9LNfezQTn7WQAzURMQRBtXlaF/ByG7telXeplHe1yEDg8F4 dxFU4HbQDu/zA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SL6JJ75X8z9rxG; Wed, 1 Nov 2023 13:48:48 +0100 (CET) From: Philip Kaludercic <philipk@HIDDEN> To: Tony Zorman <tonyzorman@HIDDEN> Subject: Re: bug#66567: [PATCH] use-package: Add ignored-files support to :vc keyword In-Reply-To: <87ttq5bx2y.fsf@hyperspace> (Tony Zorman's message of "Wed, 01 Nov 2023 11:13:25 +0100") References: <877cnn4z2v.fsf@hyperspace> <87ttq5u9fj.fsf@HIDDEN> <87ttq5bx2y.fsf@hyperspace> Autocrypt: addr=philipk@HIDDEN; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM Date: Wed, 01 Nov 2023 12:48:47 +0000 Message-ID: <87r0l91vww.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 66567 Cc: 66567 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Tony Zorman <tonyzorman@HIDDEN> writes: > On Wed, Nov 01 2023 09:09, Philip Kaludercic wrote: >>> diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/us= e-package-core.el >>> index 34c45b7aec..5d0d554baf 100644 >>> --- a/lisp/use-package/use-package-core.el >>> +++ b/lisp/use-package/use-package-core.el >>> @@ -1654,7 +1654,8 @@ use-package-normalize--vc-arg >>> (t (ensure-string v)))) >>> (:vc-backend (ensure-symbol v)) >>> (_ (ensure-string v))))) >>> - (pcase-let ((valid-kws '(:url :branch :lisp-dir :main-file :vc-bac= kend :rev)) >>> + (pcase-let ((valid-kws '( :url :branch :lisp-dir :main-file :vc-ba= ckend :rev >>> + :shell-command :make)) >> >> Why is use-package checking for valid keywords in the first place? > > Better error messages, mostly. Especially people switching from > quelpa/straight/vc-use-package might be surprised that :vc is not a > drop-in replacement for those packages. I feel like alerting them to > this fact sooner rather than later makes for a better experience. IIUC this would raise an error when an unknown keyword is encountered, right? >>> * lisp/use-package/use-package-core.el (use-package-split-when): >>> New utility function to split a list whenever a specified predicate >>> returns t. >>> (use-package-vc-valid-keywords): A new defconst to gather all allowed >>> keywords. >>> (use-package-normalize--vc-arg): Properly normalize the :ignored-files >>> keyword, in that the following are all valid ways of entering files: >>> :ignored-files "a" >>> :ignored-files ("a") >>> :ignored-files "a" "b" "c" >>> :ignored-files ("a" "b" "c") >>> (use-package-normalize/:vc): Adjust normalization, now that we do not >>> necessarily receive a valid plist as an input. >> >> I would much prefer that package specifications have a canonical form >> and that use-package doesn't try to introduce variations that wouldn't >> be compatible with package-vc-install proper and elpa-admin. Or is this >> necessary for use-package? > > It's not *necessary*, but it's quite common for use-package keywords to > do their best in order to be as unobtrusive as possible. This includes > omitting parentheses that might not be strictly needed, or to cleverly > transform the input in some other way (e.g., :hook makes great use of > this). My experience is that this is more likely to cause confusion, e.g. when people write :config (progn ...). But as I said, since I don't use use-package, I don't want to give the final verdict, I am just expressing my preferences. >>> I will cheekily bump this, and also Cc. Philip as the most likely >>> reviewer. >> >> I don't use use-package nor am I familiar with the code base, so I >> wouldn't value my input that much. > > Oh, fair enough. In either case, I couldn't think of anyone else=E2=80=94= sorry > for the noise :) I think that Stefan Kangas would probably be the best to ask, since he was the one responsible for merging use-package into the core.
bug-gnu-emacs@HIDDEN
:bug#66567
; Package emacs
.
Full text available.Received: (at 66567) by debbugs.gnu.org; 1 Nov 2023 10:14:23 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 01 06:14:23 2023 Received: from localhost ([127.0.0.1]:49989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qy8Et-0000Nr-M6 for submit <at> debbugs.gnu.org; Wed, 01 Nov 2023 06:14:23 -0400 Received: from mout-p-201.mailbox.org ([2001:67c:2050:0:465::201]:51636) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tonyzorman@HIDDEN>) id 1qy8En-0000NV-SP for 66567 <at> debbugs.gnu.org; Wed, 01 Nov 2023 06:14:18 -0400 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4SL2s572hbz9svd; Wed, 1 Nov 2023 11:13:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1698833610; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DqWdTaiulzLSBWiTQKxCRF8vrjpWlVT8jBroCf6pdzE=; b=jPvovF2nINuH4i4evZVIrh1lxQ1UuYT5m+5bHyyykHkg2hSk+Y0mb/cm6+mvCMHgmBHdEQ 337m9y3dP8Tz9rj9f/C3r8pu0zYY4nHGCaFn451CyEkm+glLo8FCg2z918UYSCAriM5wad /aRrhWMxYGe/juRK6Y01fRJb4TXtiElmCCh7BkZtIkFEW4Y7UCN//OUmZhBlXA4JOzaOvY pdsl5Wp33HpEbVfKA/VWLbKjhCUMinjQkLAZLwiLdTevy8z0nmLEwuI0I5xGxhKR+IQcM/ Oe0qbWziz9f6lGszdyAmvX5D59x/LSFHoA+7AEKDyCupNZyLJD2V9uZHqtwJdw== From: Tony Zorman <tonyzorman@HIDDEN> To: Philip Kaludercic <philipk@HIDDEN> Subject: Re: bug#66567: [PATCH] use-package: Add ignored-files support to :vc keyword In-Reply-To: <87ttq5u9fj.fsf@HIDDEN> References: <877cnn4z2v.fsf@hyperspace> <87ttq5u9fj.fsf@HIDDEN> Date: Wed, 01 Nov 2023 11:13:25 +0100 Message-ID: <87ttq5bx2y.fsf@hyperspace> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-MBO-RS-META: ywfryf8rhiwmoupfddwmgzb45o94upo8 X-MBO-RS-ID: 15612d1c7d9094e0242 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 66567 Cc: 66567 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) On Wed, Nov 01 2023 09:09, Philip Kaludercic wrote: >> diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use= -package-core.el >> index 34c45b7aec..5d0d554baf 100644 >> --- a/lisp/use-package/use-package-core.el >> +++ b/lisp/use-package/use-package-core.el >> @@ -1654,7 +1654,8 @@ use-package-normalize--vc-arg >> (t (ensure-string v)))) >> (:vc-backend (ensure-symbol v)) >> (_ (ensure-string v))))) >> - (pcase-let ((valid-kws '(:url :branch :lisp-dir :main-file :vc-back= end :rev)) >> + (pcase-let ((valid-kws '( :url :branch :lisp-dir :main-file :vc-bac= kend :rev >> + :shell-command :make)) > > Why is use-package checking for valid keywords in the first place? Better error messages, mostly. Especially people switching from quelpa/straight/vc-use-package might be surprised that :vc is not a drop-in replacement for those packages. I feel like alerting them to this fact sooner rather than later makes for a better experience. >> * lisp/use-package/use-package-core.el (use-package-split-when): >> New utility function to split a list whenever a specified predicate >> returns t. >> (use-package-vc-valid-keywords): A new defconst to gather all allowed >> keywords. >> (use-package-normalize--vc-arg): Properly normalize the :ignored-files >> keyword, in that the following are all valid ways of entering files: >> :ignored-files "a" >> :ignored-files ("a") >> :ignored-files "a" "b" "c" >> :ignored-files ("a" "b" "c") >> (use-package-normalize/:vc): Adjust normalization, now that we do not >> necessarily receive a valid plist as an input. > > I would much prefer that package specifications have a canonical form > and that use-package doesn't try to introduce variations that wouldn't > be compatible with package-vc-install proper and elpa-admin. Or is this > necessary for use-package? It's not *necessary*, but it's quite common for use-package keywords to do their best in order to be as unobtrusive as possible. This includes omitting parentheses that might not be strictly needed, or to cleverly transform the input in some other way (e.g., :hook makes great use of this). >> I will cheekily bump this, and also Cc. Philip as the most likely >> reviewer. > > I don't use use-package nor am I familiar with the code base, so I > wouldn't value my input that much. Oh, fair enough. In either case, I couldn't think of anyone else=E2=80=94so= rry for the noise :) --=20 Tony Zorman | https://tony-zorman.com/
bug-gnu-emacs@HIDDEN
:bug#66567
; Package emacs
.
Full text available.Received: (at 66567) by debbugs.gnu.org; 1 Nov 2023 09:10:04 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 01 05:10:04 2023 Received: from localhost ([127.0.0.1]:49832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qy7Ei-0004HK-32 for submit <at> debbugs.gnu.org; Wed, 01 Nov 2023 05:10:04 -0400 Received: from mout01.posteo.de ([185.67.36.65]:33241) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <philipk@HIDDEN>) id 1qy7Ef-0004G8-Nu for 66567 <at> debbugs.gnu.org; Wed, 01 Nov 2023 05:10:03 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 952E5240027 for <66567 <at> debbugs.gnu.org>; Wed, 1 Nov 2023 10:09:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1698829761; bh=oXInDes1km8KDORwdF/pHZMpKJ9jTyxJIgx4IYEkdVA=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=QibWcdidlWWx1EqBTIuBTJj3pC4dkrFW4QieEdXr14QbFzy79fC3fTanZbbvHY4EG fSp6G47V7UDpYDI4Nt1qD449bRkgHDhsoLzLjVYdxtokvog0a9GfEmbALsX/h756L6 6Q0UPM/t+Q1uHIz4phpRHqtcPYbb7wD6qNOp6ZB47vewv+qlFX1xaqawzMgBZTEuZf CLgrxE9Wp6Lp36bh258IcrAyUowAl8P3ITbhglf1lsv/fsbeDS3p5OnP/7dbip+lnM v+I3TYvQq35Dn9OBynKyZ4TFASuChij3YvrPhy0tJmdhH0GC5C2sZ2hK+1v0cnvH6Z ADHegBJcVcQ+w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SL1R50V0mz6txS; Wed, 1 Nov 2023 10:09:20 +0100 (CET) From: Philip Kaludercic <philipk@HIDDEN> To: Tony Zorman <tonyzorman@HIDDEN> Subject: Re: bug#66567: [PATCH] use-package: Add ignored-files support to :vc keyword In-Reply-To: <877cnn4z2v.fsf@hyperspace> (Tony Zorman's message of "Sun, 15 Oct 2023 18:42:16 +0200") References: <877cnn4z2v.fsf@hyperspace> X-Hashcash: 1:20:231101:tonyzorman@HIDDEN::d86bwRazfmHbodBU:2cEY X-Hashcash: 1:20:231101:66567 <at> debbugs.gnu.org::rQFjGcI6SBnkjxdn:8lnd Autocrypt: addr=philipk@HIDDEN; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM Date: Wed, 01 Nov 2023 09:09:20 +0000 Message-ID: <87ttq5u9fj.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 66567 Cc: 66567 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Tony Zorman <tonyzorman@HIDDEN> writes: > Hi, > > this patch augments use-package's :vc keyword with the ability to ignore > files. This is according to the functionality added to package-vc.el in > 68318dfd16. There is also another small commit lurking in there that > enables support for :make and :shell-command, both of which were added > in 5ac08768aa. > > Tony > >>From 2b3c81c1854dc4767105021a6a777c6cb1b04bca Mon Sep 17 00:00:00 2001 > From: Tony Zorman <soliditsallgood@HIDDEN> > Date: Sun, 15 Oct 2023 16:50:00 +0200 > Subject: [PATCH] ; use-package: Update list of valid :vc keywords > > lisp/use-package/use-package-core.el: Add :shell-command, :make to > valid keywords. > --- > lisp/use-package/use-package-core.el | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el > index 34c45b7aec..5d0d554baf 100644 > --- a/lisp/use-package/use-package-core.el > +++ b/lisp/use-package/use-package-core.el > @@ -1654,7 +1654,8 @@ use-package-normalize--vc-arg > (t (ensure-string v)))) > (:vc-backend (ensure-symbol v)) > (_ (ensure-string v))))) > - (pcase-let ((valid-kws '(:url :branch :lisp-dir :main-file :vc-backend :rev)) > + (pcase-let ((valid-kws '( :url :branch :lisp-dir :main-file :vc-backend :rev > + :shell-command :make)) Why is use-package checking for valid keywords in the first place? > (`(,name . ,opts) arg)) > (if (stringp opts) ; (NAME . VERSION-STRING) ? > (list name opts) > -- > 2.42.0 > >>From baf9490a3f3b18a336fe8c860f820beda01ba131 Mon Sep 17 00:00:00 2001 > From: Tony Zorman <soliditsallgood@HIDDEN> > Date: Sun, 15 Oct 2023 16:51:00 +0200 > Subject: [PATCH] use-package: Add :ignored-files support to :vc keyword > > * lisp/use-package/use-package-core.el (use-package-split-when): > New utility function to split a list whenever a specified predicate > returns t. > (use-package-vc-valid-keywords): A new defconst to gather all allowed > keywords. > (use-package-normalize--vc-arg): Properly normalize the :ignored-files > keyword, in that the following are all valid ways of entering files: > :ignored-files "a" > :ignored-files ("a") > :ignored-files "a" "b" "c" > :ignored-files ("a" "b" "c") > (use-package-normalize/:vc): Adjust normalization, now that we do not > necessarily receive a valid plist as an input. I would much prefer that package specifications have a canonical form and that use-package doesn't try to introduce variations that wouldn't be compatible with package-vc-install proper and elpa-admin. Or is this necessary for use-package? > > * test/lisp/use-package/use-package-tests.el (use-package-test-normalize/:vc): > Add tests for :ignored-files keyword. > --- > lisp/use-package/use-package-core.el | 61 ++++++++++++++++------ > test/lisp/use-package/use-package-tests.el | 10 +++- > 2 files changed, 53 insertions(+), 18 deletions(-) > > diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el > index 5d0d554baf..1c2e4676d7 100644 > --- a/lisp/use-package/use-package-core.el > +++ b/lisp/use-package/use-package-core.el > @@ -521,6 +521,24 @@ use-package-split-list-at-keys > (let ((xs (use-package-split-list (apply-partially #'eq key) lst))) > (cons (car xs) (use-package-split-list-at-keys key (cddr xs)))))) > > +(defun use-package-split-when (pred xs) > + "Repeatedly split a list according to PRED. > +Split XS every time PRED returns t. Keep the delimiters, and > +arrange the result in an alist. For example: > + > + (use-package-split-when #\\='keywordp \\='(:a 1 :b 2 3 4 :c 5)) > + ;; => \\='((:a 1) (:b 2 3 4) (:c 5)) > + > + (use-package-split-when (lambda (x) (> x 2)) \\='(10 1 3 2 4 -1 8 9)) > + ;; => \\='((10 1) (3 2) (4 -1) (8) (9))" > + (unless (seq-empty-p xs) > + (pcase-let* ((`(,first . ,rest) (if (funcall pred (car xs)) > + (cons (car xs) (cdr xs)) > + (use-package-split-list pred xs))) > + (`(,val . ,recur) (use-package-split-list pred rest))) > + (cons (cons first val) > + (use-package-split-when pred recur))))) > + > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;; > ;;; Keywords > @@ -1634,6 +1652,12 @@ use-package-handler/:vc > (push `(use-package-vc-install ',arg ,local-path) body)) ; runtime > body)) > > +(defconst use-package-vc-valid-keywords > + '( :url :branch :lisp-dir :main-file :vc-backend :rev > + :shell-command :make :ignored-files) > + "Valid keywords for the `:vc' keyword, see the Info > +node `(emacs)Fetching Package Sources'.") > + > (defun use-package-normalize--vc-arg (arg) > "Normalize possible arguments to the `:vc' keyword. > ARG is a cons-cell of approximately the form that > @@ -1653,24 +1677,27 @@ use-package-normalize--vc-arg > ((eq v :newest) nil) > (t (ensure-string v)))) > (:vc-backend (ensure-symbol v)) > + (:ignored-files (if (listp v) v (list v))) > (_ (ensure-string v))))) > - (pcase-let ((valid-kws '( :url :branch :lisp-dir :main-file :vc-backend :rev > - :shell-command :make)) > - (`(,name . ,opts) arg)) > + (pcase-let* ((`(,name . ,opts) arg)) > (if (stringp opts) ; (NAME . VERSION-STRING) ? > (list name opts) > - ;; Error handling > - (cl-loop for (k _) on opts by #'cddr > - if (not (member k valid-kws)) > - do (use-package-error > - (format "Keyword :vc received unknown argument: %s. Supported keywords are: %s" > - k valid-kws))) > - ;; Actual normalization > - (list name > - (cl-loop for (k v) on opts by #'cddr > - if (not (eq k :rev)) > - nconc (list k (normalize k v))) > - (normalize :rev (plist-get opts :rev))))))) > + (let ((opts (use-package-split-when > + (lambda (el) > + (seq-contains-p use-package-vc-valid-keywords el)) > + opts))) > + ;; Error handling > + (cl-loop for (k . _) in opts > + if (not (member k use-package-vc-valid-keywords)) > + do (use-package-error > + (format "Keyword :vc received unknown argument: %s. Supported keywords are: %s" > + k use-package-vc-valid-keywords))) > + ;; Actual normalization > + (list name > + (cl-loop for (k . v) in opts > + if (not (eq k :rev)) > + nconc (list k (normalize k (if (length= v 1) (car v) v)))) > + (normalize :rev (car (alist-get :rev opts))))))))) > > (defun use-package-normalize/:vc (name _keyword args) > "Normalize possible arguments to the `:vc' keyword. > @@ -1686,9 +1713,9 @@ use-package-normalize/:vc > ((or 'nil 't) (list name)) ; guess name > ((pred symbolp) (list arg)) ; use this name > ((pred stringp) (list name arg)) ; version string + guess name > - ((pred plistp) ; plist + guess name > + (`(,(pred keywordp) . ,(pred listp)) ; list + guess name > (use-package-normalize--vc-arg (cons name arg))) > - (`(,(pred symbolp) . ,(or (pred plistp) ; plist/version string + name > + (`(,(pred symbolp) . ,(or (pred listp) ; list/version string + name > (pred stringp))) > (use-package-normalize--vc-arg arg)) > (_ (use-package-error "Unrecognised argument to :vc.\ > diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el > index 9181a8171a..5636ba8a4f 100644 > --- a/test/lisp/use-package/use-package-tests.el > +++ b/test/lisp/use-package/use-package-tests.el > @@ -2014,7 +2014,15 @@ use-package-test-normalize/:vc > (should (equal '(foo) > (use-package-normalize/:vc 'foo :vc nil))) > (should (equal '(bar) > - (use-package-normalize/:vc 'foo :vc '(bar))))) > + (use-package-normalize/:vc 'foo :vc '(bar)))) > + (should (equal > + '(foo (:ignored-files ("a" "b" "c")) :last-release) > + (use-package-normalize/:vc 'foo :vc '((:ignored-files "a" "b" "c"))))) > + (should (equal > + (use-package-normalize/:vc 'foo :vc '((:ignored-files "a"))) > + (use-package-normalize/:vc 'foo :vc '((:ignored-files ("a")))))) > + (should (equal (use-package-normalize/:vc 'foo :vc '((:ignored-files "a" "b" "c"))) > + (use-package-normalize/:vc 'foo :vc '((:ignored-files ("a" "b" "c"))))))) > > ;; Local Variables: > ;; no-byte-compile: t > -- > 2.42.0 Tony Zorman <tonyzorman@HIDDEN> writes: > I will cheekily bump this, and also Cc. Philip as the most likely > reviewer. I don't use use-package nor am I familiar with the code base, so I wouldn't value my input that much. > Tony -- Philip Kaludercic
bug-gnu-emacs@HIDDEN
:bug#66567
; Package emacs
.
Full text available.Received: (at 66567) by debbugs.gnu.org; 1 Nov 2023 07:44:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 01 03:44:19 2023 Received: from localhost ([127.0.0.1]:49775 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qy5tf-0007fT-Pk for submit <at> debbugs.gnu.org; Wed, 01 Nov 2023 03:44:19 -0400 Received: from mout-p-102.mailbox.org ([80.241.56.152]:34078) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tonyzorman@HIDDEN>) id 1qy5ta-0007fC-PD for 66567 <at> debbugs.gnu.org; Wed, 01 Nov 2023 03:44:15 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4SKzX041qlz9sZh; Wed, 1 Nov 2023 08:43:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1698824608; 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=TtfDPoiFlEThrYR1JGUSWCQ6RaGXNMhuQKeQRZrc1fI=; b=H6uZOlLEyUZpkwB5jsZccpCOgU/1VLddLla4dLQpzL7zcHxhzMk67ik4u9T0LgTjXxnF5t Enf2LTuvoPDtmSjRDHB2wX5l89GqPmu6YydKCsbonjld3Q/Sx4c2foZVt0M0J3tkB5B3R5 iKgWRkQVuq87++Vej3oSJopN7NKAnPR3hcnVG1/zcouH2fAqkwJEDqOQb+fKzm/BtDm2rJ JW7N7ALkbt5miptRknGUA1dfQrgp2tVn/8kIudk26xRIHXsnhOmP6+exP6yb3UJBCsThJG d/VO15U/QZ+WRNe+LLt+qilSFRUfNghY06tFlhJJEKlrosHHM5wV0vYpv1U3lA== From: Tony Zorman <tonyzorman@HIDDEN> To: 66567 <at> debbugs.gnu.org Subject: Re: [PATCH] use-package: Add ignored-files support to :vc keyword In-Reply-To: <handler.66567.B.169739278328671.ack <at> debbugs.gnu.org> References: <877cnn4z2v.fsf@hyperspace> <handler.66567.B.169739278328671.ack <at> debbugs.gnu.org> Date: Wed, 01 Nov 2023 08:43:23 +0100 Message-ID: <87wmv1c410.fsf@hyperspace> MIME-Version: 1.0 Content-Type: text/plain X-MBO-RS-META: 6pr3mcrois5j9i14xuy19oqgcm3fyimm X-MBO-RS-ID: 74743fcb90e2189ea55 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 66567 Cc: Philip Kaludercic <philipk@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) I will cheekily bump this, and also Cc. Philip as the most likely reviewer. Tony -- Tony Zorman | https://tony-zorman.com/
bug-gnu-emacs@HIDDEN
:bug#66567
; Package emacs
.
Full text available.Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at submit) by debbugs.gnu.org; 15 Oct 2023 17:59:43 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 15 13:59:43 2023 Received: from localhost ([127.0.0.1]:54082 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qs5Ot-0007SH-T6 for submit <at> debbugs.gnu.org; Sun, 15 Oct 2023 13:59:43 -0400 Received: from lists.gnu.org ([2001:470:142::17]:33124) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tonyzorman@HIDDEN>) id 1qs4Cd-0004k8-R0 for submit <at> debbugs.gnu.org; Sun, 15 Oct 2023 12:42:57 -0400 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 <tonyzorman@HIDDEN>) id 1qs4CA-00052X-4P for bug-gnu-emacs@HIDDEN; Sun, 15 Oct 2023 12:42:26 -0400 Received: from mout-p-101.mailbox.org ([80.241.56.151]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from <tonyzorman@HIDDEN>) id 1qs4C7-0007pZ-Et for bug-gnu-emacs@HIDDEN; Sun, 15 Oct 2023 12:42:25 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4S7mHY3TSGz9sTn for <bug-gnu-emacs@HIDDEN>; Sun, 15 Oct 2023 18:42:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1697388137; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=kAvjylnCrAZd62H0c3Gjfv1vCjGeafru8kgAVKvanVU=; b=pGnlQciuplyT75PgU9sZL5MuJycXKYSlO37Qj/tgUtuslyjHl6GLw0izopkbuVWead0kPG 3Elgt8hl7a0kbxuOJdL4GSRK+QHDvc2WXkR+tJbbvJYlNfzAT9yOofUQeLq70kvGVjNiiB ivborSpvkWg1tSiiRCO3G52Pjn8mNTfj4KEtUFD7HXS5lm0kFaLvq7fEQB6KBXmFsJekA/ n2BmNChfFelPZyFt06wDbM+sRfuzirtoSgapuHIvG9NB0obHknsvcZVZuOPojSF5ttGAp9 vL86QgTHlmEtztmnke72k1w6be6eS/gLjyF5HQ182n3V68V7bu3k4PK37N4rCg== From: Tony Zorman <tonyzorman@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: [PATCH] use-package: Add ignored-files support to :vc keyword Date: Sun, 15 Oct 2023 18:42:16 +0200 Message-ID: <877cnn4z2v.fsf@hyperspace> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-MBO-RS-META: zbftdxrf1yhdduwmjz9gz1x47yn1qjyu X-MBO-RS-ID: 7633468e5deedfe1914 Received-SPF: pass client-ip=80.241.56.151; envelope-from=tonyzorman@HIDDEN; helo=mout-p-101.mailbox.org 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_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 15 Oct 2023 13:59:38 -0400 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain Hi, this patch augments use-package's :vc keyword with the ability to ignore files. This is according to the functionality added to package-vc.el in 68318dfd16. There is also another small commit lurking in there that enables support for :make and :shell-command, both of which were added in 5ac08768aa. Tony --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-use-package-Update-list-of-valid-vc-keywords.patch From 2b3c81c1854dc4767105021a6a777c6cb1b04bca Mon Sep 17 00:00:00 2001 From: Tony Zorman <soliditsallgood@HIDDEN> Date: Sun, 15 Oct 2023 16:50:00 +0200 Subject: [PATCH] ; use-package: Update list of valid :vc keywords lisp/use-package/use-package-core.el: Add :shell-command, :make to valid keywords. --- lisp/use-package/use-package-core.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el index 34c45b7aec..5d0d554baf 100644 --- a/lisp/use-package/use-package-core.el +++ b/lisp/use-package/use-package-core.el @@ -1654,7 +1654,8 @@ use-package-normalize--vc-arg (t (ensure-string v)))) (:vc-backend (ensure-symbol v)) (_ (ensure-string v))))) - (pcase-let ((valid-kws '(:url :branch :lisp-dir :main-file :vc-backend :rev)) + (pcase-let ((valid-kws '( :url :branch :lisp-dir :main-file :vc-backend :rev + :shell-command :make)) (`(,name . ,opts) arg)) (if (stringp opts) ; (NAME . VERSION-STRING) ? (list name opts) -- 2.42.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-use-package-Add-ignored-files-support-to-vc-keyword.patch From baf9490a3f3b18a336fe8c860f820beda01ba131 Mon Sep 17 00:00:00 2001 From: Tony Zorman <soliditsallgood@HIDDEN> Date: Sun, 15 Oct 2023 16:51:00 +0200 Subject: [PATCH] use-package: Add :ignored-files support to :vc keyword * lisp/use-package/use-package-core.el (use-package-split-when): New utility function to split a list whenever a specified predicate returns t. (use-package-vc-valid-keywords): A new defconst to gather all allowed keywords. (use-package-normalize--vc-arg): Properly normalize the :ignored-files keyword, in that the following are all valid ways of entering files: :ignored-files "a" :ignored-files ("a") :ignored-files "a" "b" "c" :ignored-files ("a" "b" "c") (use-package-normalize/:vc): Adjust normalization, now that we do not necessarily receive a valid plist as an input. * test/lisp/use-package/use-package-tests.el (use-package-test-normalize/:vc): Add tests for :ignored-files keyword. --- lisp/use-package/use-package-core.el | 61 ++++++++++++++++------ test/lisp/use-package/use-package-tests.el | 10 +++- 2 files changed, 53 insertions(+), 18 deletions(-) diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el index 5d0d554baf..1c2e4676d7 100644 --- a/lisp/use-package/use-package-core.el +++ b/lisp/use-package/use-package-core.el @@ -521,6 +521,24 @@ use-package-split-list-at-keys (let ((xs (use-package-split-list (apply-partially #'eq key) lst))) (cons (car xs) (use-package-split-list-at-keys key (cddr xs)))))) +(defun use-package-split-when (pred xs) + "Repeatedly split a list according to PRED. +Split XS every time PRED returns t. Keep the delimiters, and +arrange the result in an alist. For example: + + (use-package-split-when #\\='keywordp \\='(:a 1 :b 2 3 4 :c 5)) + ;; => \\='((:a 1) (:b 2 3 4) (:c 5)) + + (use-package-split-when (lambda (x) (> x 2)) \\='(10 1 3 2 4 -1 8 9)) + ;; => \\='((10 1) (3 2) (4 -1) (8) (9))" + (unless (seq-empty-p xs) + (pcase-let* ((`(,first . ,rest) (if (funcall pred (car xs)) + (cons (car xs) (cdr xs)) + (use-package-split-list pred xs))) + (`(,val . ,recur) (use-package-split-list pred rest))) + (cons (cons first val) + (use-package-split-when pred recur))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Keywords @@ -1634,6 +1652,12 @@ use-package-handler/:vc (push `(use-package-vc-install ',arg ,local-path) body)) ; runtime body)) +(defconst use-package-vc-valid-keywords + '( :url :branch :lisp-dir :main-file :vc-backend :rev + :shell-command :make :ignored-files) + "Valid keywords for the `:vc' keyword, see the Info +node `(emacs)Fetching Package Sources'.") + (defun use-package-normalize--vc-arg (arg) "Normalize possible arguments to the `:vc' keyword. ARG is a cons-cell of approximately the form that @@ -1653,24 +1677,27 @@ use-package-normalize--vc-arg ((eq v :newest) nil) (t (ensure-string v)))) (:vc-backend (ensure-symbol v)) + (:ignored-files (if (listp v) v (list v))) (_ (ensure-string v))))) - (pcase-let ((valid-kws '( :url :branch :lisp-dir :main-file :vc-backend :rev - :shell-command :make)) - (`(,name . ,opts) arg)) + (pcase-let* ((`(,name . ,opts) arg)) (if (stringp opts) ; (NAME . VERSION-STRING) ? (list name opts) - ;; Error handling - (cl-loop for (k _) on opts by #'cddr - if (not (member k valid-kws)) - do (use-package-error - (format "Keyword :vc received unknown argument: %s. Supported keywords are: %s" - k valid-kws))) - ;; Actual normalization - (list name - (cl-loop for (k v) on opts by #'cddr - if (not (eq k :rev)) - nconc (list k (normalize k v))) - (normalize :rev (plist-get opts :rev))))))) + (let ((opts (use-package-split-when + (lambda (el) + (seq-contains-p use-package-vc-valid-keywords el)) + opts))) + ;; Error handling + (cl-loop for (k . _) in opts + if (not (member k use-package-vc-valid-keywords)) + do (use-package-error + (format "Keyword :vc received unknown argument: %s. Supported keywords are: %s" + k use-package-vc-valid-keywords))) + ;; Actual normalization + (list name + (cl-loop for (k . v) in opts + if (not (eq k :rev)) + nconc (list k (normalize k (if (length= v 1) (car v) v)))) + (normalize :rev (car (alist-get :rev opts))))))))) (defun use-package-normalize/:vc (name _keyword args) "Normalize possible arguments to the `:vc' keyword. @@ -1686,9 +1713,9 @@ use-package-normalize/:vc ((or 'nil 't) (list name)) ; guess name ((pred symbolp) (list arg)) ; use this name ((pred stringp) (list name arg)) ; version string + guess name - ((pred plistp) ; plist + guess name + (`(,(pred keywordp) . ,(pred listp)) ; list + guess name (use-package-normalize--vc-arg (cons name arg))) - (`(,(pred symbolp) . ,(or (pred plistp) ; plist/version string + name + (`(,(pred symbolp) . ,(or (pred listp) ; list/version string + name (pred stringp))) (use-package-normalize--vc-arg arg)) (_ (use-package-error "Unrecognised argument to :vc.\ diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el index 9181a8171a..5636ba8a4f 100644 --- a/test/lisp/use-package/use-package-tests.el +++ b/test/lisp/use-package/use-package-tests.el @@ -2014,7 +2014,15 @@ use-package-test-normalize/:vc (should (equal '(foo) (use-package-normalize/:vc 'foo :vc nil))) (should (equal '(bar) - (use-package-normalize/:vc 'foo :vc '(bar))))) + (use-package-normalize/:vc 'foo :vc '(bar)))) + (should (equal + '(foo (:ignored-files ("a" "b" "c")) :last-release) + (use-package-normalize/:vc 'foo :vc '((:ignored-files "a" "b" "c"))))) + (should (equal + (use-package-normalize/:vc 'foo :vc '((:ignored-files "a"))) + (use-package-normalize/:vc 'foo :vc '((:ignored-files ("a")))))) + (should (equal (use-package-normalize/:vc 'foo :vc '((:ignored-files "a" "b" "c"))) + (use-package-normalize/:vc 'foo :vc '((:ignored-files ("a" "b" "c"))))))) ;; Local Variables: ;; no-byte-compile: t -- 2.42.0 --=-=-= Content-Type: text/plain -- Tony Zorman | https://tony-zorman.com/ --=-=-=--
Tony Zorman <tonyzorman@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#66567
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.