Skip to content

Instantly share code, notes, and snippets.

@preetpalS
Created February 21, 2021 07:54

Revisions

  1. preetpalS created this gist Feb 21, 2021.
    27 changes: 27 additions & 0 deletions bug-workarounds.el
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@

    ;; 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)