1
0
Fork 0

Don’t assume that a proper archive name has been provided

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.
This commit is contained in:
Tom Willemse 2019-02-18 23:54:10 -08:00
parent 614c0d7dbb
commit e6bd52e53a

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 20190218233951 ;; Version: 20190218235251
;; This program is free software; you can redistribute it and/or modify ;; 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 ;; 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 (list
(read-string "Title: ") (read-string "Title: ")
(read-string "Text: ") (read-string "Text: ")
(alist-get (completing-read "Archive: " (mapcar 'car package-archives)) (let ((archive-name
package-archives nil nil #'string-equal))) (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--update-file "elpa.rss"
"<description>" "<description>"
(package--make-rss-entry title description archive-url)) (package--make-rss-entry title description archive-url))