[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/package+vc e092e60f15 4/9: Add a package-vc command for submitti
From: |
Philip Kaludercic |
Subject: |
feature/package+vc e092e60f15 4/9: Add a package-vc command for submitting ptches |
Date: |
Sat, 8 Oct 2022 05:58:48 -0400 (EDT) |
branch: feature/package+vc
commit e092e60f1539898a42ed157b87bdd32f512109e0
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Add a package-vc command for submitting ptches
* lisp/emacs-lisp/package-vc.el (package-vc-read-pkg): Add auxiliary
command for querying source packages.
(package-vc-prepare-patch): Add it.
* lisp/emacs-lisp/package.el (package-maintainers): Add an optional
NO-ERROR argument.
---
lisp/emacs-lisp/package-vc.el | 21 +++++++++++++++++++++
lisp/emacs-lisp/package.el | 17 ++++++++++-------
2 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 2a45bacf6e..d3850a5e2c 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -286,5 +286,26 @@ be requested using REV."
;;;###autoload
(defalias 'package-checkout #'package-vc-fetch)
+(defun package-vc-read-pkg (prompt)
+ "Query for a source package description with PROMPT."
+ (completing-read
+ prompt
+ package-alist
+ (lambda (pkg) (package-vc-p (cadr pkg)))
+ t))
+
+(defun package-vc-prepare-patch (pkg subject revisions)
+ "Send a patch to the maintainer of a package PKG.
+SUBJECT and REVISIONS are used passed on to `vc-prepare-patch'.
+PKG must be a package description."
+ (interactive
+ (list (package-vc-read-pkg "Package to prepare a patch for: ")
+ (and (not vc-prepare-patches-separately)
+ (read-string "Subject: " "[PATCH] " nil nil t))
+ (or (log-view-get-marked)
+ (vc-read-multiple-revisions "Revisions: "))))
+ (vc-prepare-patch (package-maintainers pkg t)
+ subject revisions))
+
(provide 'package-vc)
;;; package-vc.el ends here
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 9ac94fa6bc..6e891fede1 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -4516,20 +4516,23 @@ DESC must be a `package-desc' object."
(funcall browse-url-secondary-browser-function url)
(browse-url url))))
-(defun package-maintainers (pkg-desc)
+(defun package-maintainers (pkg-desc &optional no-error)
"Return an email address for the maintainers of PKG-DESC.
The email address may contain commas, if there are multiple
maintainers. If no maintainers are found, an error will be
-thrown."
+signalled. If the optional argument NO-ERROR is non-nil no error
+will be signalled in that case."
(unless pkg-desc
- (user-error "Invalid package description"))
+ (error "Invalid package description"))
(let* ((extras (package-desc-extras pkg-desc))
(maint (alist-get :maintainer extras)))
- (unless maint
+ (cond
+ ((and (null maint) (null no-error))
(user-error "Package has no explicit maintainer"))
- (with-temp-buffer
- (package--print-email-button maint)
- (string-trim (substring-no-properties (buffer-string))))))
+ ((not (null maint))
+ (with-temp-buffer
+ (package--print-email-button maint)
+ (string-trim (substring-no-properties (buffer-string))))))))
;; TODO: Allow attaching a patch to send directly to the maintainer.
;; Ideally this should be able to detect the local changes, convert
- feature/package+vc updated (bb2bd2ed91 -> a4a825df82), Philip Kaludercic, 2022/10/08
- feature/package+vc effe1f20f5 3/9: Extract package maintainer guessing code into a separate function, Philip Kaludercic, 2022/10/08
- feature/package+vc e75994f2ff 2/9: Add an inline procedure for checking for source packages, Philip Kaludercic, 2022/10/08
- feature/package+vc a4a825df82 9/9: Clone packages into a separate directory, Philip Kaludercic, 2022/10/08
- feature/package+vc 077c1533df 6/9: ; * package-vc.el (package-vc-read-pkg): Return package description, Philip Kaludercic, 2022/10/08
- feature/package+vc f9065c7951 5/9: Use 'package-vc-p' in package-vc.el, Philip Kaludercic, 2022/10/08
- feature/package+vc 8cfeb8a9e0 1/9: Merge branch 'master' into feature/package+vc, Philip Kaludercic, 2022/10/08
- feature/package+vc e092e60f15 4/9: Add a package-vc command for submitting ptches,
Philip Kaludercic <=
- feature/package+vc 7c66223dfb 8/9: * lisp/emacs-lisp/package.el (package-report-bug): Use 'file-in-directory-p', Philip Kaludercic, 2022/10/08
- feature/package+vc 432252c23f 7/9: Extend package-vc heuristics to multiple source forges, Philip Kaludercic, 2022/10/08