From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args Date: Mon, 08 May 2023 12:38:06 -0700 Message-ID: <87pm7ahatx.fsf@breatheoutbreathe.in> References: <87pm7b7up0.fsf@breatheoutbreathe.in> <87B6D8F0-415D-4B16-BDC3-826525FAF04A@netyu.xyz> Reply-To: Joseph Turner Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15191"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63336@debbugs.gnu.org, Philip Kaludercic To: Ruijie Yu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 08 21:40:22 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pw6ic-0003ne-19 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 May 2023 21:40:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pw6iQ-00006g-M6; Mon, 08 May 2023 15:40:10 -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 1pw6iI-0008VX-U7 for bug-gnu-emacs@gnu.org; Mon, 08 May 2023 15:40:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pw6iI-0001yH-Kw for bug-gnu-emacs@gnu.org; Mon, 08 May 2023 15:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pw6iI-0004nW-Gc for bug-gnu-emacs@gnu.org; Mon, 08 May 2023 15:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Joseph Turner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 May 2023 19:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63336 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 63336-submit@debbugs.gnu.org id=B63336.168357477518348 (code B ref 63336); Mon, 08 May 2023 19:40:02 +0000 Original-Received: (at 63336) by debbugs.gnu.org; 8 May 2023 19:39:35 +0000 Original-Received: from localhost ([127.0.0.1]:41704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw6hq-0004lr-En for submit@debbugs.gnu.org; Mon, 08 May 2023 15:39:34 -0400 Original-Received: from out-28.mta0.migadu.com ([91.218.175.28]:42725) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw6hn-0004le-Kc for 63336@debbugs.gnu.org; Mon, 08 May 2023 15:39:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1683574769; 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=0m/NnVuDfvICDz9uk9RtGHFBKg+TZIXMkBTeOBMLKRY=; b=ZjvPlMS86IJiORygDZeL3aL1FEdaLSKxaxFG/smE25WKHPJobP79PKkxNDqsWyyxWVLcls rdqz1kfEXqUnuAn6PQWTS/BptD0WtvBCqHrLo3zR29CdOKOnakByr/42+5hmfz8S0o7tls ig/6Y0YvurIEchZXLlW/Ov2bRC/ttaU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: <87B6D8F0-415D-4B16-BDC3-826525FAF04A@netyu.xyz> X-Migadu-Flow: FLOW_OUT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261363 Archived-At: --=-=-= Content-Type: text/plain Ruijie Yu writes: > Hello Joseph, > > On mobile so please excuse my brevity and top-posting. > > Minor remark on the defcustom type: I think you should move the current tag from "symbol" to its outer "repeat", and optionally tag "symbol" as something like "package name". WDYT? Thanks, Ruijie! I think the defcustom type is now correct. Joseph --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-package-vc-Process-make-and-shell-command-spec-args.patch >From 8f9238b841f6deec65fd52d696aa26caf1bf123a Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Sat, 6 May 2023 13:44:32 -0700 Subject: [PATCH] package-vc: Process :make and :shell-command spec args --- lisp/emacs-lisp/package-vc.el | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index 421947b528d..95e12fc829a 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -344,6 +344,32 @@ asynchronously." "\n") nil pkg-file nil 'silent)))) +(defcustom package-vc-process-make nil + "Whether to process :make and :shell-command spec arguments. + +When set to a list of symbols (packages), run commands for only +packages in the list. When `nil', never run commands. Otherwise +when non-`nil', run commands for any package with :make or +:shell-command specified. + +Package specs are loaded from trusted package archives." + :type '(choice (const :tag "Run for all packages" t) + (repeat :tag "Run only for selected packages" (symbol :tag "Package name")) + (const :tag "Never run" nil)) + :version "30.1") + +(defun package-vc--make (pkg-spec) + "Process :make and :shell-command PKG-SPEC arguments." + (let ((target (plist-get pkg-spec :make)) + (cmd (plist-get pkg-spec :shell-command))) + (when (or cmd target) + (with-current-buffer (get-buffer-create " *package-vc make*") + (erase-buffer) + (when (and cmd (/= 0 (call-process shell-file-name nil t nil shell-command-switch cmd))) + (warn "Failed to run %s, see buffer %S" cmd (buffer-name))) + (when (and target (/= 0 (apply #'call-process "make" nil t nil (if (consp target) target (list target))))) + (warn "Failed to make %s, see buffer %S" target (buffer-name))))))) + (declare-function org-export-to-file "ox" (backend file)) (defun package-vc--build-documentation (pkg-desc file) @@ -486,6 +512,16 @@ documentation and marking the package as installed." ;; Generate package file (package-vc--generate-description-file pkg-desc pkg-file) + ;; Process :make and :shell-command arguments before building documentation + (pcase package-vc-process-make + ((pred consp) ; When non-`nil' list, check if package is on the list. + (when (memq (package-desc-name pkg-desc) package-vc-process-make) + (package-vc--make pkg-spec))) + ('nil ; When `nil', do nothing. + nil) + (_ ; When otherwise non-`nil', run commands. + (package-vc--make pkg-spec))) + ;; Detect a manual (when (executable-find "install-info") (dolist (doc-file (ensure-list (plist-get pkg-spec :doc))) -- 2.39.2 --=-=-=--