Better hack to prevent TLS issues with Emacs 26.1 and 26.2

Make a test request to check if the bug happens.
If the bug happens then set gnutls-algorithm-priority to a working value.
This commit is contained in:
syl20bnr 2019-08-20 15:29:16 -04:00
parent 39b6156a2f
commit 25f639e403

View file

@ -15,8 +15,11 @@
(when (and (version< "25" emacs-version) (when (and (version< "25" emacs-version)
(version< emacs-version "26.3")) (version< emacs-version "26.3"))
;; backport fix for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341 ;; Hack to prevent TLS error with Emacs 26.1 and 26.2 and gnutls 3.6.4 and above
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")) ;; see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341
(with-current-buffer (url-retrieve-synchronously "https://api.github.com/users/syl20bnr/repos")
(when (string-empty-p (buffer-string))
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))))
(when (version< emacs-version "26") (when (version< emacs-version "26")
;; backport fix for macOS battery status ;; backport fix for macOS battery status