git-gutter
git-gutter copied to clipboard
Won't build on emacs 29 - linum-mode has been replaced
linum-mode has been replaced with display-line-numbers-mode Emacs 29 Release Notes:linum
linum-mode has enough issues that it was retired. Most users will not have it.
A vanilla emacs 29 build of git-gutter errors out with
Lisp error: (void-variable global-linum-mode)
All operations are using the macro bound-and-true-p for declaration check. What could be wrong? 🤔
I can corroborate this on Emacs 29.1. I did a lot of poking around with C-h v to see if there was something that needed to be set, but did not find anything. Finding out 29 removed linum explains it I think.
Debugger entered--Lisp error: (void-variable global-linum-mode)
byte-code("\10\203\15\0\301\302!\204\15\0\303 \210\301\207" [global-linum-mode boundp git-gutter-fringe git-gutter:linum-setup] 2)
require(git-gutter nil t)
(not (require 'git-gutter nil t))
(if (not (require 'git-gutter nil t)) (display-warning 'use-package (format "Cannot load %s" 'git-gutter) :error) (condition-case err (progn (global-git-gutter-mode 't) t) ((debug error) (funcall use-package--warning27 :config err))))
(condition-case err (if (not (require 'git-gutter nil t)) (display-warning 'use-package (format "Cannot load %s" 'git-gutter) :error) (condition-case err (progn (global-git-gutter-mode 't) t) ((debug error) (funcall use-package--warning27 :config err)))) ((debug error) (funcall use-package--warning27 :catch err)))
(progn (use-package-ensure-elpa 'git-gutter '(t) 'nil) (defvar use-package--warning27 #'(lambda (keyword err) (let ((msg (format "%s/%s: %s" ... keyword ...))) (display-warning 'use-package msg :error)))) (condition-case err (if (not (require 'git-gutter nil t)) (display-warning 'use-package (format "Cannot load %s" 'git-gutter) :error) (condition-case err (progn (global-git-gutter-mode 't) t) ((debug error) (funcall use-package--warning27 :config err)))) ((debug error) (funcall use-package--warning27 :catch err))))
elisp--eval-last-sexp(nil)
eval-last-sexp(nil)
funcall-interactively(eval-last-sexp nil)
command-execute(eval-last-sexp)
Apparently bound-and-true-p isn't working.
I fixed it by replacing the two lines in git-gutter.el that referred to global-linum-mode with a more explicit check, bypassing bound-and-true-p:
General: Old:
(bound-and-true-p global-linum-mode)
New:
(and (boundp 'global-linum-mode) global-linum-mode)
~533: Old:
(unless (bound-and-true-p global-linum-mode)
New:
(unless (and (boundp 'global-linum-mode) global-linum-mode)
~1148:
Old:
(when (and (bound-and-true-p global-linum-mode) (not (boundp 'git-gutter-fringe)))
New:
(when (and (and (boundp 'global-linum-mode) global-linum-mode) (not (boundp 'git-gutter-fringe)))
See also: https://github.com/emacsorphanage/git-gutter-fringe/issues/39