Skip to content

Instantly share code, notes, and snippets.

@preetpalS
Created February 21, 2021 07:54
Show Gist options
  • Save preetpalS/28179b25cfcfe8aedca5c8ba8b133a18 to your computer and use it in GitHub Desktop.
Save preetpalS/28179b25cfcfe8aedca5c8ba8b133a18 to your computer and use it in GitHub Desktop.
Bug workarounds for Emacs
;; Provides workarounds for some bugs
;; Fixes issues related to not being able to connect to HTTPS (use at your own risk)
(when (version< emacs-version "26.3")
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
;; Fixes issue in certain packages related to change listed in Emacs news (for Emacs 28):
;; ** The WHEN argument of 'make-obsolete' and related functions is mandatory.
;; The use of those functions without a WHEN argument was marked obsolete
;; back in Emacs 23.1. The affected functions are: 'make-obsolete',
;; 'define-obsolete-function-alias', 'make-obsolete-variable',
;; 'define-obsolete-variable-alias'.
(defun bug-workarounds-wrap-obsolete (original-function &rest original-arguments)
"Adapted from https://github.com/syl20bnr/spacemacs/issues/14265#issue-780508460"
(let ((replacement-arguments (if (= (length original-arguments) 2)
(append original-arguments (list "0"))
original-arguments)))
(apply original-function replacement-arguments)))
(dolist (sym '(make-obsolete
define-obsolete-function-alias
make-obsolete-variable
define-obsolete-variable-alias))
(advice-add sym :around #'bug-workarounds-wrap-obsolete))
(provide 'bug-workarounds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment