jwiegley / use-package

A use-package declaration for simplifying your .emacs
https://jwiegley.github.io/use-package
GNU General Public License v3.0
4.39k stars 259 forks source link

Use a single let binding when expanding consecutive :custom forms #906

Closed kljohann closed 3 years ago

kljohann commented 3 years ago

This is a small optimization for #881 / #899 (FYI @tzz). With the current master the following

(use-package recentf
  :demand t

  :custom
  (recentf-max-saved-items 1000)
  (recentf-max-menu-items 500)
  (recentf-auto-cleanup (* 5 60))
  (recentf-mode t))

expands to

(progn
  (let
      ((custom--inhibit-theme-enable nil))
    (custom-theme-set-variables 'use-package
                                '(recentf-max-saved-items 1000 nil nil "Customized with use-package recentf")))
  (let
      ((custom--inhibit-theme-enable nil))
    (custom-theme-set-variables 'use-package
                                '(recentf-max-menu-items 500 nil nil "Customized with use-package recentf")))
  (let
      ((custom--inhibit-theme-enable nil))
    (custom-theme-set-variables 'use-package
                                '(recentf-auto-cleanup
                                  (* 5 60)
                                  nil nil "Customized with use-package recentf")))
  (let
      ((custom--inhibit-theme-enable nil))
    (custom-theme-set-variables 'use-package
                                '(recentf-mode t nil nil "Customized with use-package recentf")))
  (require 'recentf nil nil))

With this change it will expand to:

(progn
  (let
      ((custom--inhibit-theme-enable nil))
    (custom-theme-set-variables 'use-package
                                '(recentf-max-saved-items 1000 nil nil "Customized with use-package recentf")
                                '(recentf-max-menu-items 500 nil nil "Customized with use-package recentf")
                                '(recentf-auto-cleanup
                                  (* 5 60)
                                  nil nil "Customized with use-package recentf")
                                '(recentf-mode t nil nil "Customized with use-package recentf")))
  (require 'recentf nil nil))