unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
@ 2023-05-06 20:39 Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-07  9:03 ` Philip Kaludercic
  0 siblings, 1 reply; 18+ messages in thread
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-06 20:39 UTC (permalink / raw)
  To: 63336; +Cc: Philip Kaludercic

[-- Attachment #1: Type: text/plain, Size: 167 bytes --]

Hello!

Here's a patch to support :make and :shell-command args as discussed:

https://lists.gnu.org/archive/html/help-gnu-emacs/2023-04/msg00263.html

Best,

Joseph


[-- Attachment #2: 0001-package-vc-Process-make-and-shell-command-spec-args.patch --]
[-- Type: text/x-diff, Size: 2582 bytes --]

From c51161c51f11e6ffcba17758424596fe44f9d42a Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
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 | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 421947b528d..489610e2a1e 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -344,6 +344,35 @@ asynchronously."
         "\n")
        nil pkg-file nil 'silent))))
 
+(defcustom package-vc-process-make nil
+  "If non-nil, process :make and :shell-command spec arguments.
+Package specs are loaded from trusted package archives."
+  :type 'boolean)
+
+(defun package-vc--call (destination program &rest args)
+  "Like ‘call-process’ for PROGRAM, DESTINATION, ARGS.
+The INFILE and DISPLAY arguments are fixed as nil."
+  (apply #'call-process program nil destination nil (delq nil args)))
+
+(defun package-vc--make (pkg-spec dir)
+  "Process :make and :shell-command 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 (package-vc--call t shell-file-name
+                                           shell-command-switch
+                                           cmd)))
+          (message "Failed to run %s, see buffer %S"
+                   cmd (buffer-name)))
+        (when (and target
+                   (/= 0 (apply #'package-vc--call t "make"
+                                (if (consp target) target (list target)))))
+          (message "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 +515,9 @@ 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
+      (when package-vc-process-make (package-vc--make pkg-spec pkg-dir))
+
       ;; Detect a manual
       (when (executable-find "install-info")
         (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-05-17 14:07 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-06 20:39 bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-07  9:03 ` Philip Kaludercic
2023-05-07 18:47   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-08  8:42     ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-08 19:38       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-09  0:03       ` Richard Stallman
2023-05-10  6:35     ` Philip Kaludercic
2023-05-11  1:37       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-14  7:44         ` Philip Kaludercic
2023-05-14  8:08           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-14 19:30             ` Philip Kaludercic
2023-05-14 23:01               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-15  9:12                 ` Philip Kaludercic
2023-05-15 19:03                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-16 19:29                     ` Philip Kaludercic
2023-05-16 21:08                       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-17 14:07                         ` Philip Kaludercic
2023-05-13 17:18       ` Philip Kaludercic

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).