diff --git a/core/core-lib.el b/core/core-lib.el index 1609beb51..75e90e060 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -621,5 +621,41 @@ testing advice (when combined with `rotate-text'). (dolist (target (cdr targets)) (advice-remove target #',symbol))))) + +;; +;;; Backports + +(when! (not EMACS27+) + ;; DEPRECATED Backported from Emacs 27 + (defmacro setq-local (&rest pairs) + "Make variables in PAIRS buffer-local and assign them the corresponding values. + +PAIRS is a list of variable/value pairs. For each variable, make +it buffer-local and assign it the corresponding value. The +variables are literal symbols and should not be quoted. + +The second VALUE is not computed until after the first VARIABLE +is set, and so on; each VALUE can use the new value of variables +set earlier in the ‘setq-local’. The return value of the +‘setq-local’ form is the value of the last VALUE. + +\(fn [VARIABLE VALUE]...)" + (declare (debug setq)) + (unless (zerop (mod (length pairs) 2)) + (error "PAIRS must have an even number of variable/value members")) + (let ((expr nil)) + (while pairs + (unless (symbolp (car pairs)) + (error "Attempting to set a non-symbol: %s" (car pairs))) + ;; Can't use backquote here, it's too early in the bootstrap. + (setq expr + (cons + (list 'set + (list 'make-local-variable (list 'quote (car pairs))) + (car (cdr pairs))) + expr)) + (setq pairs (cdr (cdr pairs)))) + (macroexp-progn (nreverse expr))))) + (provide 'core-lib) ;;; core-lib.el ends here diff --git a/modules/ui/vc-gutter/config.el b/modules/ui/vc-gutter/config.el index 4264f13a7..2c4ec0467 100644 --- a/modules/ui/vc-gutter/config.el +++ b/modules/ui/vc-gutter/config.el @@ -39,15 +39,14 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'." (not (memq major-mode git-gutter:disabled-modes)))) (if (and (display-graphic-p) (require 'git-gutter-fringe nil t)) - (progn - (setq-local git-gutter:init-function #'git-gutter-fr:init) - (setq-local git-gutter:view-diff-function #'git-gutter-fr:view-diff-infos) - (setq-local git-gutter:clear-function #'git-gutter-fr:clear) - (setq-local git-gutter:window-width -1)) - (setq-local git-gutter:init-function 'nil) - (setq-local git-gutter:view-diff-function #'git-gutter:view-diff-infos) - (setq-local git-gutter:clear-function #'git-gutter:clear-diff-infos) - (setq-local git-gutter:window-width 1)) + (setq-local git-gutter:init-function #'git-gutter-fr:init + git-gutter:view-diff-function #'git-gutter-fr:view-diff-infos + git-gutter:clear-function #'git-gutter-fr:clear + git-gutter:window-width -1) + (setq-local git-gutter:init-function 'nil + git-gutter:view-diff-function #'git-gutter:view-diff-infos + git-gutter:clear-function #'git-gutter:clear-diff-infos + git-gutter:window-width 1)) (git-gutter-mode +1) (remove-hook 'after-save-hook #'+vc-gutter-init-maybe-h 'local)))))))