[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/system-packages 449dcdf 08/10: Replace '%p' in commands
From: |
Stefan Monnier |
Subject: |
[elpa] externals/system-packages 449dcdf 08/10: Replace '%p' in commands with the package name |
Date: |
Tue, 16 Mar 2021 09:44:28 -0400 (EDT) |
branch: externals/system-packages
commit 449dcdf4fe22874c9d91ee8d929ebb8a41b1bac6
Author: Štěpán Němec <stepnem@gmail.com>
Commit: Štěpán Němec <stepnem@gmail.com>
Replace '%p' in commands with the package name
Example 'system-packages-supported-package-managers' entry:
(change-log . "pacman -Qc %p; pacolog %p")
The '%p' syntax is in accordance with other package management tools,
e.g. aptitude or pcurses.
---
README.org | 6 +++++-
system-packages.el | 10 ++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/README.org b/README.org
index b65b410..7a1060c 100644
--- a/README.org
+++ b/README.org
@@ -86,7 +86,11 @@ the commands to =system-packages-supported-package-managers=
like so:
(noconfirm . "--noconfirm"))))
#+END_SRC
-You may then need to adjust =system-packages-package-manager= and
+Any occurrences of ~%p~ in a command will be replaced with the package
+name during execution, otherwise the package name is simply appended
+to the command.
+
+You may also need to adjust =system-packages-package-manager= and
=system-packages-use-sudo= accordingly:
#+BEGIN_SRC emacs-lisp
diff --git a/system-packages.el b/system-packages.el
index fee47fa..59d4b7e 100644
--- a/system-packages.el
+++ b/system-packages.el
@@ -298,7 +298,10 @@
(list-dependencies-of . "xbps-query -x")
(noconfirm . nil))))
"An alist of package manager commands.
-The key is the package manager and value (usually) the shell command to run.")
+The key is the package manager and value (usually) the shell command to run.
+Any occurrences of ~%p~ in the command will be replaced with the package
+name during execution, otherwise the package name is simply appended
+to the command.")
(put 'system-packages-supported-package-managers 'risky-local-variable t)
(define-obsolete-variable-alias 'system-packages-packagemanager
@@ -360,7 +363,10 @@ of passing additional arguments to the package manager."
system-packages-supported-package-managers)))))))
(unless command
(error (format "%S not supported in %S" action
system-packages-package-manager)))
- (setq command (mapconcat #'identity (list command pack) " "))
+ (setq command
+ (if (string-match-p "%p" command)
+ (replace-regexp-in-string "%p" pack command t t)
+ (concat command " " pack)))
(when noconfirm
(setq args (concat args (and pack " ") noconfirm)))
(concat command args)))
- [elpa] externals/system-packages updated (3ad6d52 -> 05add2f), Stefan Monnier, 2021/03/16
- [elpa] externals/system-packages c6fa665 04/10: pacman -Ql: add the -q flag to get rid of the package name prefix, Stefan Monnier, 2021/03/16
- [elpa] externals/system-packages 4c491ca 01/10: README: capitalize Emacs (checkdoc warning), Stefan Monnier, 2021/03/16
- [elpa] externals/system-packages eeff5e3 02/10: system-packages-package-manager: Fix doc string, Stefan Monnier, 2021/03/16
- [elpa] externals/system-packages 45782f7 03/10: Make command prompts more consistent, Stefan Monnier, 2021/03/16
- [elpa] externals/system-packages 2862c5b 05/10: change-log, owning-file, owning-file-remote: New commands, Stefan Monnier, 2021/03/16
- [elpa] externals/system-packages cf64fdb 07/10: Merge branch 'dont-hardcode-and' [33], Stefan Monnier, 2021/03/16
- [elpa] externals/system-packages 92c58d9 09/10: Update copyright, Stefan Monnier, 2021/03/16
- [elpa] externals/system-packages f12f051 06/10: get-command: Don't hardcode && logic, Stefan Monnier, 2021/03/16
- [elpa] externals/system-packages 449dcdf 08/10: Replace '%p' in commands with the package name,
Stefan Monnier <=
- [elpa] externals/system-packages 05add2f 10/10: Update copyright, Stefan Monnier, 2021/03/16