;;;###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
(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