From e6bd52e53afcd8c47e3819627e10098ecd3c4551 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 18 Feb 2019 23:54:10 -0800 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20assume=20that=20a=20proper=20ar?= =?UTF-8?q?chive=20name=20has=20been=20provided?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s possible that someone enters a URL that isn’t part of the ‘package-archives’ variable. If the name entered doesn’t correspond to a name in ‘package-archives’, use it directly, assuming that it was a URL that was specified. --- oni-package.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/oni-package.el b/oni-package.el index dfbed53..101dd71 100644 --- a/oni-package.el +++ b/oni-package.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 20190218233951 +;; Version: 20190218235251 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -63,8 +63,10 @@ DESCRIPTION is the text of the news item." (list (read-string "Title: ") (read-string "Text: ") - (alist-get (completing-read "Archive: " (mapcar 'car package-archives)) - package-archives nil nil #'string-equal))) + (let ((archive-name + (completing-read "Archive: " (mapcar 'car package-archives)))) + (or (alist-get archive-name package-archives nil nil #'string-equal) + archive-name)))) (package--update-file "elpa.rss" "" (package--make-rss-entry title description archive-url))