Merge remote-tracking branch 'origin/master' into pr-830

This commit is contained in:
John Wiegley 2022-11-15 09:21:07 -08:00
commit 49fffe7cf4
16 changed files with 223 additions and 196 deletions

View file

@ -8,7 +8,7 @@
@copying @copying
@quotation @quotation
Copyright (C) 2012-2022 John Wiegley <johnw@@newartisans.com> Copyright (C) 2012-2022 Free Software Foundation, Inc.
You can redistribute this document and/or modify it under the terms You can redistribute this document and/or modify it under the terms
of the GNU General Public License as published by the Free Software of the GNU General Public License as published by the Free Software
@ -31,7 +31,7 @@ General Public License for more details.
@finalout @finalout
@titlepage @titlepage
@title use-package User Manual @title use-package User Manual
@subtitle for version 2.4.1-81-gb185c6b+1 @subtitle for version 2.4.1-119-g0be480e+1
@author John Wiegley @author John Wiegley
@page @page
@vskip 0pt plus 1filll @vskip 0pt plus 1filll
@ -67,33 +67,33 @@ around 2 seconds, with no loss of functionality!
Installation Installation
* Installing from an Elpa Archive:: * Installing from GNU ELPA::
* Installing from the Git Repository:: * Installing from the Git Repository::
* Post-Installation Tasks:: * Post-Installation Tasks::
Keywords Keywords
* @code{after}:: * @code{after}:: @code{:after}.
* @code{bind-keymap}, @code{bind-keymap*}: @code{bind-keymap} @code{bind-keymap*}. * @code{bind-keymap} @code{bind-keymap*}:: @code{:bind-keymap}, @code{:bind-keymap*}.
* @code{bind}, @code{bind*}: @code{bind} @code{bind*}. * @code{bind} @code{bind*}:: @code{:bind}, @code{:bind*}.
* @code{commands}:: * @code{commands}:: @code{:commands}.
* @code{preface}, @code{init}, @code{config}: @code{preface} @code{init} @code{config}. * @code{preface} @code{init} @code{config}:: @code{:preface}, @code{:init}, @code{:config}.
* @code{custom}:: * @code{custom}:: @code{:custom}.
* @code{custom-face}:: * @code{custom-face}:: @code{:custom-face}.
* @code{defer}, @code{demand}: @code{defer} @code{demand}. * @code{defer} @code{demand}:: @code{:defer}, @code{:demand}.
* @code{defines}, @code{functions}: @code{defines} @code{functions}. * @code{defines} @code{functions}:: @code{:defines}, @code{:functions}.
* @code{diminish}, @code{delight}: @code{diminish} @code{delight}. * @code{diminish} @code{delight}:: @code{:diminish}, @code{:delight}.
* @code{disabled}:: * @code{disabled}:: @code{:disabled}.
* @code{ensure}, @code{pin}: @code{ensure} @code{pin}. * @code{ensure} @code{pin}:: @code{:ensure}, @code{:pin}.
* @code{hook}:: * @code{hook}:: @code{:hook}.
* @code{if}, @code{when}, @code{unless}: @code{if} @code{when} @code{unless}. * @code{if} @code{when} @code{unless}:: @code{:if}, @code{:when}, @code{:unless}.
* @code{load-path}:: * @code{load-path}:: @code{:load-path}.
* @code{mode}, @code{interpreter}: @code{mode} @code{interpreter}. * @code{mode} @code{interpreter}:: @code{:mode}, @code{:interpreter}.
* @code{magic}, @code{magic-fallback}: @code{magic} @code{magic-fallback}. * @code{magic} @code{magic-fallback}:: @code{:magic}, @code{:magic-fallback}.
* @code{no-require}:: * @code{no-require}:: @code{:no-require}.
* @code{requires}:: * @code{requires}:: @code{:requires}.
@code{:bind}, @code{:bind*} @code{bind}, @code{bind*}
* Binding to local keymaps:: * Binding to local keymaps::
@ -119,50 +119,27 @@ use-package can be installed using Emacs' package manager or manually from
its development repository. its development repository.
@menu @menu
* Installing from an Elpa Archive:: * Installing from GNU ELPA::
* Installing from the Git Repository:: * Installing from the Git Repository::
* Post-Installation Tasks:: * Post-Installation Tasks::
@end menu @end menu
@node Installing from an Elpa Archive @node Installing from GNU ELPA
@section Installing from an Elpa Archive @section Installing from GNU ELPA
use-package is available from Melpa and Melpa-Stable. If you haven't used use-package is available from GNU ELPA. If you haven't used
Emacs' package manager before, then it is high time you familiarize yourself Emacs' package manager before, then it is high time you familiarize yourself
with it by reading the documentation in the Emacs manual, see with it by reading the documentation in the Emacs manual, see
@ref{Packages,,,emacs,}. Then add one of the archives to @code{package-archives}: @ref{Packages,,,emacs,}. Then add one of the archives to @code{package-archives}:
@itemize First, you need to update the local package list using:
@item
To use Melpa:
@end itemize
@lisp
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
@end lisp
@itemize
@item
To use Melpa-Stable:
@end itemize
@lisp
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
@end lisp
Once you have added your preferred archive, you need to update the
local package list using:
@example @example
M-x package-refresh-contents RET M-x package-refresh-contents RET
@end example @end example
Once you have done that, you can install use-package and its dependencies Once you have done that, you can install use-package and its
using: dependencies using:
@example @example
M-x package-install RET use-package RET M-x package-install RET use-package RET
@ -239,7 +216,7 @@ C-h v use-package-version RET
should display something like should display something like
@example @example
use-package-versions value is "2.4.1" use-package-versions value is "2.4.3"
@end example @end example
If you are completely new to use-package then see @ref{Getting Started}. If you are completely new to use-package then see @ref{Getting Started}.
@ -290,25 +267,25 @@ used for speed (reason 3), it can still be used as a sanity check.
@chapter Keywords @chapter Keywords
@menu @menu
* @code{after}:: * @code{after}:: @code{after}.
* @code{bind-keymap}, @code{bind-keymap*}: @code{bind-keymap} @code{bind-keymap*}. * @code{bind-keymap} @code{bind-keymap*}:: @code{:bind-keymap}, @code{:bind-keymap*}.
* @code{bind}, @code{bind*}: @code{bind} @code{bind*}. * @code{bind} @code{bind*}:: @code{bind} @code{:bind*}.
* @code{commands}:: * @code{commands}:: @code{:commands}.
* @code{preface}, @code{init}, @code{config}: @code{preface} @code{init} @code{config}. * @code{preface} @code{init} @code{config}:: @code{:preface}, @code{:init}, @code{:config}.
* @code{custom}:: * @code{custom}:: @code{:custom}.
* @code{custom-face}:: * @code{custom-face}:: @code{:custom-face}.
* @code{defer}, @code{demand}: @code{defer} @code{demand}. * @code{defer} @code{demand}:: @code{:defer}, @code{:demand}.
* @code{defines}, @code{functions}: @code{defines} @code{functions}. * @code{defines} @code{functions}:: @code{:defines}, @code{:functions}.
* @code{diminish}, @code{delight}: @code{diminish} @code{delight}. * @code{diminish} @code{delight}:: @code{:diminish}, @code{:delight}.
* @code{disabled}:: * @code{disabled}:: @code{:disabled}.
* @code{ensure}, @code{pin}: @code{ensure} @code{pin}. * @code{ensure} @code{pin}:: @code{:ensure}, @code{:pin}.
* @code{hook}:: * @code{hook}:: @code{:hook}.
* @code{if}, @code{when}, @code{unless}: @code{if} @code{when} @code{unless}. * @code{if} @code{when} @code{unless}:: @code{:if}, @code{:when}, @code{:unless}.
* @code{load-path}:: * @code{load-path}:: @code{:load-path}.
* @code{mode}, @code{interpreter}: @code{mode} @code{interpreter}. * @code{mode} @code{interpreter}:: @code{:mode}, @code{:interpreter}.
* @code{magic}, @code{magic-fallback}: @code{magic} @code{magic-fallback}. * @code{magic} @code{magic-fallback}:: @code{:magic}, @code{:magic-fallback}.
* @code{no-require}:: * @code{no-require}:: @code{:no-require}.
* @code{requires}:: * @code{requires}:: @code{:requires}.
@end menu @end menu
@node @code{after} @node @code{after}

View file

@ -1,5 +1,9 @@
# Changes # Changes
## 2.4.4
This release prepares for inclusion to GNU ELPA and includes no other changes
## 2.4.1 ## 2.4.1
This is mostly a bug-fix release: This is mostly a bug-fix release:

View file

@ -1,6 +1,6 @@
;;; bind-chord.el --- key-chord binding helper for use-package-chords -*- lexical-binding: t; -*- ;;; bind-chord.el --- key-chord binding helper for use-package-chords -*- lexical-binding: t; -*-
;; Copyright (C) 2015-2019 Justin Talbott ;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
;; Author: Justin Talbott <justin@waymondo.com> ;; Author: Justin Talbott <justin@waymondo.com>
;; Keywords: convenience, tools, extensions ;; Keywords: convenience, tools, extensions

View file

@ -1,12 +1,12 @@
;;; bind-key.el --- A simple way to manage personal keybindings -*- lexical-binding: t; -*- ;;; bind-key.el --- A simple way to manage personal keybindings -*- lexical-binding: t; -*-
;; Copyright (c) 2012-2017 John Wiegley ;; Copyright (c) 2012-2022 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@newartisans.com> ;; Author: John Wiegley <johnw@newartisans.com>
;; Maintainer: John Wiegley <johnw@newartisans.com> ;; Maintainer: John Wiegley <johnw@newartisans.com>
;; Created: 16 Jun 2012 ;; Created: 16 Jun 2012
;; Modified: 29 Nov 2017 ;; Modified: 29 Nov 2017
;; Version: 2.4 ;; Version: 2.4.1
;; Keywords: keys keybinding config dotemacs ;; Keywords: keys keybinding config dotemacs
;; URL: https://github.com/jwiegley/use-package ;; URL: https://github.com/jwiegley/use-package
@ -29,7 +29,7 @@
;; If you have lots of keybindings set in your .emacs file, it can be hard to ;; If you have lots of keybindings set in your .emacs file, it can be hard to
;; know which ones you haven't set yet, and which may now be overriding some ;; know which ones you haven't set yet, and which may now be overriding some
;; new default in a new emacs version. This module aims to solve that ;; new default in a new Emacs version. This module aims to solve that
;; problem. ;; problem.
;; ;;
;; Bind keys as follows in your .emacs: ;; Bind keys as follows in your .emacs:
@ -104,7 +104,7 @@
(require 'easy-mmode) (require 'easy-mmode)
(defgroup bind-key nil (defgroup bind-key nil
"A simple way to manage personal keybindings" "A simple way to manage personal keybindings."
:group 'emacs) :group 'emacs)
(defcustom bind-key-column-widths '(18 . 40) (defcustom bind-key-column-widths '(18 . 40)
@ -127,7 +127,7 @@
;; Create override-global-mode to force key remappings ;; Create override-global-mode to force key remappings
(defvar override-global-map (make-keymap) (defvar override-global-map (make-keymap)
"override-global-mode keymap") "Keymap for `override-global-mode'.")
(define-minor-mode override-global-mode (define-minor-mode override-global-mode
"A minor mode so that keymap settings override other modes." "A minor mode so that keymap settings override other modes."
@ -150,7 +150,7 @@ Elements have the form ((KEY . [MAP]) CMD ORIGINAL-CMD)")
KEY-NAME may be a vector, in which case it is passed straight to KEY-NAME may be a vector, in which case it is passed straight to
`define-key'. Or it may be a string to be interpreted as `define-key'. Or it may be a string to be interpreted as
spelled-out keystrokes, e.g., \"C-c C-z\". See documentation of spelled-out keystrokes, e.g., `C-c C-z'. See documentation of
`edmacro-mode' for details. `edmacro-mode' for details.
COMMAND must be an interactive function or lambda form. COMMAND must be an interactive function or lambda form.
@ -223,7 +223,7 @@ See `bind-key' for more details."
In contrast to `define-key', this function removes the binding from the keymap." In contrast to `define-key', this function removes the binding from the keymap."
(define-key keymap key nil) (define-key keymap key nil)
;; Split M-key in ESC key ;; Split M-key in ESC key
(setq key (mapcan (lambda (k) (setq key (cl-mapcan (lambda (k)
(if (and (integerp k) (/= (logand k ?\M-\0) 0)) (if (and (integerp k) (/= (logand k ?\M-\0) 0))
(list ?\e (logxor k ?\M-\0)) (list ?\e (logxor k ?\M-\0))
(list k))) (list k)))

View file

@ -1,6 +1,6 @@
;;; use-package-bind-key.el --- Support for the :bind/:bind-keymap keywords -*- lexical-binding: t; -*- ;;; use-package-bind-key.el --- Support for the :bind/:bind-keymap keywords -*- lexical-binding: t; -*-
;; Copyright (C) 2012-2017 John Wiegley ;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@newartisans.com> ;; Author: John Wiegley <johnw@newartisans.com>
;; Maintainer: John Wiegley <johnw@newartisans.com> ;; Maintainer: John Wiegley <johnw@newartisans.com>

View file

@ -1,6 +1,6 @@
;;; use-package-chords.el --- key-chord keyword for use-package -*- lexical-binding: t; -*- ;;; use-package-chords.el --- key-chord keyword for use-package -*- lexical-binding: t; -*-
;; Copyright (C) 2015-2019 Justin Talbott ;; Copyright (C) 2015-2022 Free Software Foundation, Inc.
;; Author: Justin Talbott <justin@waymondo.com> ;; Author: Justin Talbott <justin@waymondo.com>
;; Keywords: convenience, tools, extensions ;; Keywords: convenience, tools, extensions

View file

@ -1,12 +1,12 @@
;;; use-package-core.el --- A configuration macro for simplifying your .emacs -*- lexical-binding: t; -*- ;;; use-package-core.el --- A configuration macro for simplifying your .emacs -*- lexical-binding: t; -*-
;; Copyright (C) 2012-2017 John Wiegley ;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@newartisans.com> ;; Author: John Wiegley <johnw@newartisans.com>
;; Maintainer: John Wiegley <johnw@newartisans.com> ;; Maintainer: John Wiegley <johnw@newartisans.com>
;; Created: 17 Jun 2012 ;; Created: 17 Jun 2012
;; Modified: 29 Nov 2017 ;; Modified: 29 Nov 2017
;; Version: 2.4.1 ;; Version: 2.4.4
;; Package-Requires: ((emacs "24.3")) ;; Package-Requires: ((emacs "24.3"))
;; Keywords: dotemacs startup speed config package ;; Keywords: dotemacs startup speed config package
;; URL: https://github.com/jwiegley/use-package ;; URL: https://github.com/jwiegley/use-package
@ -53,21 +53,28 @@
;; iterating over them to "disable all themes" won't disable it. ;; iterating over them to "disable all themes" won't disable it.
(setq custom-enabled-themes (remq 'use-package custom-enabled-themes)) (setq custom-enabled-themes (remq 'use-package custom-enabled-themes))
(eval-when-compile
(if (and (eq emacs-major-version 24) (eq emacs-minor-version 3)) (if (and (eq emacs-major-version 24) (eq emacs-minor-version 3))
(progn
(defsubst hash-table-keys (hash-table) (defsubst hash-table-keys (hash-table)
"Return a list of keys in HASH-TABLE." "Return a list of keys in HASH-TABLE."
(cl-loop for k being the hash-keys of hash-table collect k)) (cl-loop for k being the hash-keys of hash-table collect k))
(eval-when-compile (require 'subr-x))) (defsubst string-suffix-p (suffix string &optional ignore-case)
(let ((start-pos (- (length string) (length suffix))))
(and (>= start-pos 0)
(eq t (compare-strings suffix nil nil
string start-pos nil ignore-case))))))
(require 'subr-x)))
(eval-when-compile (eval-when-compile
(require 'regexp-opt)) (require 'regexp-opt))
(defgroup use-package nil (defgroup use-package nil
"A use-package declaration for simplifying your `.emacs'." "A `use-package' declaration for simplifying your `.emacs'."
:group 'startup) :group 'startup)
(defconst use-package-version "2.4.1" (defconst use-package-version "2.4.4"
"This version of use-package.") "This version of `use-package'.")
(defcustom use-package-keywords (defcustom use-package-keywords
'(:disabled '(:disabled
@ -94,6 +101,7 @@
;; Any other keyword that also declares commands to be autoloaded (such as ;; Any other keyword that also declares commands to be autoloaded (such as
;; :bind) must appear before this keyword. ;; :bind) must appear before this keyword.
:commands :commands
:autoload
:init :init
:defer :defer
:demand :demand
@ -107,11 +115,11 @@ The order of this list is *very important*, so it is only
advisable to insert new keywords, never to delete or reorder advisable to insert new keywords, never to delete or reorder
them. Further, attention should be paid to the NEWS.md if the them. Further, attention should be paid to the NEWS.md if the
default order ever changes, as they may have subtle effects on default order ever changes, as they may have subtle effects on
the semantics of use-package declarations and may necessitate the semantics of `use-package' declarations and may necessitate
changing where you had inserted a new keyword earlier. changing where you had inserted a new keyword earlier.
Note that `:disabled' is special in this list, as it causes Note that `:disabled' is special in this list, as it causes
nothing at all to happen, even if the rest of the use-package nothing at all to happen, even if the rest of the `use-package'
declaration is incorrect." declaration is incorrect."
:type '(repeat symbol) :type '(repeat symbol)
:group 'use-package) :group 'use-package)
@ -119,7 +127,8 @@ declaration is incorrect."
(defcustom use-package-deferring-keywords (defcustom use-package-deferring-keywords
'(:bind-keymap '(:bind-keymap
:bind-keymap* :bind-keymap*
:commands) :commands
:autoload)
"Unless `:demand' is used, keywords in this list imply deferred loading. "Unless `:demand' is used, keywords in this list imply deferred loading.
The reason keywords like `:hook' are not in this list is that The reason keywords like `:hook' are not in this list is that
they only imply deferred loading if they reference actual they only imply deferred loading if they reference actual
@ -130,9 +139,9 @@ otherwise requested."
:group 'use-package) :group 'use-package)
(defcustom use-package-ignore-unknown-keywords nil (defcustom use-package-ignore-unknown-keywords nil
"If non-nil, issue warning instead of error when unknown "If non-nil, warn instead of signaling error for unknown keywords.
keyword is encountered. The unknown keyword and its associated The unknown keyword and its associated arguments will be ignored
arguments will be ignored in the `use-package' expansion." in the `use-package' expansion."
:type 'boolean :type 'boolean
:group 'use-package) :group 'use-package)
@ -195,7 +204,7 @@ The first element is the `use-package' keyword.
The second is a form that can be evaluated to get the default The second is a form that can be evaluated to get the default
value. It can also be a function that will receive the name of value. It can also be a function that will receive the name of
the use-package declaration and the keyword plist given to the `use-package' declaration and the keyword plist given to
`use-package', in normalized form. The value it returns should `use-package', in normalized form. The value it returns should
also be in normalized form (which is sometimes *not* what one also be in normalized form (which is sometimes *not* what one
would normally write in a `use-package' declaration, so use would normally write in a `use-package' declaration, so use
@ -303,7 +312,7 @@ definitions, to understand the main intent of what's happening."
"\\s-+\\(")) "\\s-+\\("))
(or (bound-and-true-p lisp-mode-symbol-regexp) (or (bound-and-true-p lisp-mode-symbol-regexp)
"\\(?:\\sw\\|\\s_\\|\\\\.\\)+") "\\)") "\\(?:\\sw\\|\\s_\\|\\\\.\\)+") "\\)")
"Sexp providing regexp for finding use-package forms in user files. "Sexp providing regexp for finding `use-package' forms in user files.
This is used by `use-package-jump-to-package-form' and This is used by `use-package-jump-to-package-form' and
`use-package-enable-imenu-support'." `use-package-enable-imenu-support'."
:type 'sexp :type 'sexp
@ -314,7 +323,7 @@ This is used by `use-package-jump-to-package-form' and
This is done by adjusting `lisp-imenu-generic-expression' to This is done by adjusting `lisp-imenu-generic-expression' to
include support for finding `use-package' and `require' forms. include support for finding `use-package' and `require' forms.
Must be set before loading use-package." Must be set before loading `use-package'."
:type 'boolean :type 'boolean
:set :set
#'(lambda (sym value) #'(lambda (sym value)
@ -336,7 +345,7 @@ Must be set before loading use-package."
(font-lock-add-keywords 'emacs-lisp-mode use-package-font-lock-keywords) (font-lock-add-keywords 'emacs-lisp-mode use-package-font-lock-keywords)
(defcustom use-package-compute-statistics nil (defcustom use-package-compute-statistics nil
"If non-nil, compute statistics concerned use-package declarations. "If non-nil, compute statistics concerned `use-package' declarations.
View the statistical report using `use-package-report'. Note that View the statistical report using `use-package-report'. Note that
if this option is enabled, you must require `use-package' in your if this option is enabled, you must require `use-package' in your
user init file at loadup time, or you will see errors concerning user init file at loadup time, or you will see errors concerning
@ -363,14 +372,14 @@ undefined variables."
(and sym (symbolp sym))) (and sym (symbolp sym)))
(defsubst use-package-as-symbol (string-or-symbol) (defsubst use-package-as-symbol (string-or-symbol)
"If STRING-OR-SYMBOL is already a symbol, return it. Otherwise "If STRING-OR-SYMBOL is already a symbol, return it.
convert it to a symbol and return that." Otherwise convert it to a symbol and return that."
(if (symbolp string-or-symbol) string-or-symbol (if (symbolp string-or-symbol) string-or-symbol
(intern string-or-symbol))) (intern string-or-symbol)))
(defsubst use-package-as-string (string-or-symbol) (defsubst use-package-as-string (string-or-symbol)
"If STRING-OR-SYMBOL is already a string, return it. Otherwise "If STRING-OR-SYMBOL is already a string, return it.
convert it to a string and return that." Otherwise convert it to a string and return that."
(if (stringp string-or-symbol) string-or-symbol (if (stringp string-or-symbol) string-or-symbol
(symbol-name string-or-symbol))) (symbol-name string-or-symbol)))
@ -987,6 +996,8 @@ If RECURSED is non-nil, recurse into sublists."
;; ;;
(defun use-package-reset-statistics () (defun use-package-reset-statistics ()
"Reset statistics for `use-package'.
See also `use-package-statistics'."
(interactive) (interactive)
(setq use-package-statistics (make-hash-table))) (setq use-package-statistics (make-hash-table)))
@ -1029,7 +1040,7 @@ The information is formatted in a way suitable for
(format "%.2f" (use-package-statistics-time statistics)))))) (format "%.2f" (use-package-statistics-time statistics))))))
(defun use-package-report () (defun use-package-report ()
"Show current statistics gathered about use-package declarations. "Show current statistics gathered about `use-package' declarations.
In the table that's generated, the status field has the following In the table that's generated, the status field has the following
meaning: meaning:
Configured :config has been processed (the package is loaded!) Configured :config has been processed (the package is loaded!)
@ -1053,7 +1064,7 @@ meaning:
(define-derived-mode use-package-statistics-mode tabulated-list-mode (define-derived-mode use-package-statistics-mode tabulated-list-mode
"use-package statistics" "use-package statistics"
"Show current statistics gathered about use-package declarations." "Show current statistics gathered about `use-package' declarations."
(setq tabulated-list-format (setq tabulated-list-format
;; The sum of column width is 80 characters: ;; The sum of column width is 80 characters:
[("Package" 25 t) [("Package" 25 t)
@ -1347,6 +1358,28 @@ meaning:
(delete-dups arg))) (delete-dups arg)))
(use-package-process-keywords name rest state))) (use-package-process-keywords name rest state)))
;;;; :autoload
(defalias 'use-package-normalize/:autoload 'use-package-normalize/:commands)
(defun use-package-handler/:autoload (name _keyword arg rest state)
(use-package-concat
;; Since we deferring load, establish any necessary autoloads, and also
;; keep the byte-compiler happy.
(let ((name-string (use-package-as-string name)))
(cl-mapcan
#'(lambda (command)
(when (symbolp command)
(append
(unless (plist-get state :demand)
`((unless (fboundp ',command)
(autoload #',command ,name-string))))
(when (bound-and-true-p byte-compile-current-file)
`((eval-when-compile
(declare-function ,command ,name-string)))))))
(delete-dups arg)))
(use-package-process-keywords name rest state)))
;;;; :defer ;;;; :defer
(defalias 'use-package-normalize/:defer 'use-package-normalize-predicate) (defalias 'use-package-normalize/:defer 'use-package-normalize-predicate)
@ -1477,7 +1510,7 @@ no keyword implies `:all'."
(defun use-package-normalize/:custom-face (name-symbol _keyword arg) (defun use-package-normalize/:custom-face (name-symbol _keyword arg)
"Normalize use-package custom-face keyword." "Normalize use-package custom-face keyword."
(let ((error-msg (let ((error-msg
(format "%s wants a (<symbol> <face-spec>) or list of these" (format "%s wants a (<symbol> <face-spec> [spec-type]) or list of these"
name-symbol))) name-symbol)))
(unless (listp arg) (unless (listp arg)
(use-package-error error-msg)) (use-package-error error-msg))
@ -1488,13 +1521,13 @@ no keyword implies `:all'."
(spec (nth 1 def))) (spec (nth 1 def)))
(when (or (not face) (when (or (not face)
(not spec) (not spec)
(> (length def) 2)) (> (length def) 3))
(use-package-error error-msg)))))) (use-package-error error-msg))))))
(defun use-package-handler/:custom-face (name _keyword args rest state) (defun use-package-handler/:custom-face (name _keyword args rest state)
"Generate use-package custom-face keyword code." "Generate use-package custom-face keyword code."
(use-package-concat (use-package-concat
(mapcar #'(lambda (def) `(custom-set-faces (backquote ,def))) args) (mapcar #'(lambda (def) `(apply #'face-spec-set (backquote ,def))) args)
(use-package-process-keywords name rest state))) (use-package-process-keywords name rest state)))
;;;; :init ;;;; :init
@ -1633,6 +1666,7 @@ this file. Usage:
package. This is useful if the package is being lazily package. This is useful if the package is being lazily
loaded, and you wish to conditionally call functions in your loaded, and you wish to conditionally call functions in your
`:init' block that are defined in the package. `:init' block that are defined in the package.
:autoload Similar to :commands, but it for no-interactive one.
:hook Specify hook(s) to attach this package to. :hook Specify hook(s) to attach this package to.
:bind Bind keys, and define autoloads for the bound commands. :bind Bind keys, and define autoloads for the bound commands.

View file

@ -1,6 +1,6 @@
;;; use-package-delight.el --- Support for the :delight keyword -*- lexical-binding: t; -*- ;;; use-package-delight.el --- Support for the :delight keyword -*- lexical-binding: t; -*-
;; Copyright (C) 2012-2017 John Wiegley ;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@newartisans.com> ;; Author: John Wiegley <johnw@newartisans.com>
;; Maintainer: John Wiegley <johnw@newartisans.com> ;; Maintainer: John Wiegley <johnw@newartisans.com>

View file

@ -1,6 +1,6 @@
;;; use-package-diminish.el --- Support for the :diminish keyword -*- lexical-binding: t; -*- ;;; use-package-diminish.el --- Support for the :diminish keyword -*- lexical-binding: t; -*-
;; Copyright (C) 2012-2017 John Wiegley ;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@newartisans.com> ;; Author: John Wiegley <johnw@newartisans.com>
;; Maintainer: John Wiegley <johnw@newartisans.com> ;; Maintainer: John Wiegley <johnw@newartisans.com>

View file

@ -1,6 +1,6 @@
;;; use-package-ensure-system-package.el --- auto install system packages -*- lexical-binding: t; -*- ;;; use-package-ensure-system-package.el --- auto install system packages -*- lexical-binding: t; -*-
;; Copyright (C) 2017 Justin Talbott ;; Copyright (C) 2022 Free Software Foundation, Inc.
;; Author: Justin Talbott <justin@waymondo.com> ;; Author: Justin Talbott <justin@waymondo.com>
;; Keywords: convenience, tools, extensions ;; Keywords: convenience, tools, extensions
@ -29,7 +29,7 @@
"List of custom packages installed.") "List of custom packages installed.")
(defun use-package-ensure-system-package-consify (arg) (defun use-package-ensure-system-package-consify (arg)
"Turn `arg' into a cons of (`package-name' . `install-command')." "Turn ARG into a cons of (`package-name' . `install-command')."
(cond (cond
((stringp arg) ((stringp arg)
(cons arg `(system-packages-install ,arg))) (cons arg `(system-packages-install ,arg)))
@ -54,7 +54,7 @@
;;;###autoload ;;;###autoload
(defun use-package-normalize/:ensure-system-package (_name-symbol keyword args) (defun use-package-normalize/:ensure-system-package (_name-symbol keyword args)
"Turn `arg' into a list of cons-es of (`package-name' . `install-command')." "Turn ARGS into a list of conses of (`package-name' . `install-command')."
(use-package-as-one (symbol-name keyword) args (use-package-as-one (symbol-name keyword) args
(lambda (_label arg) (lambda (_label arg)
(cond (cond

View file

@ -1,6 +1,6 @@
;;; use-package-ensure.el --- Support for the :ensure and :pin keywords -*- lexical-binding: t; -*- ;;; use-package-ensure.el --- Support for the :ensure and :pin keywords -*- lexical-binding: t; -*-
;; Copyright (C) 2012-2017 John Wiegley ;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@newartisans.com> ;; Author: John Wiegley <johnw@newartisans.com>
;; Maintainer: John Wiegley <johnw@newartisans.com> ;; Maintainer: John Wiegley <johnw@newartisans.com>
@ -37,7 +37,7 @@
(require 'use-package-core) (require 'use-package-core)
(defgroup use-package-ensure nil (defgroup use-package-ensure nil
"Support for :ensure and :pin keywords in use-package declarations." "Support for :ensure and :pin keywords in `use-package' declarations."
:group 'use-package) :group 'use-package)
(eval-when-compile (eval-when-compile
@ -111,7 +111,7 @@ manually updated package."
(archive-name (if (stringp archive) archive (symbol-name archive)))) (archive-name (if (stringp archive) archive (symbol-name archive))))
(if (use-package-archive-exists-p archive-symbol) (if (use-package-archive-exists-p archive-symbol)
(add-to-list 'package-pinned-packages (cons package archive-name)) (add-to-list 'package-pinned-packages (cons package archive-name))
(error "Archive '%s' requested for package '%s' is not available." (error "Archive '%s' requested for package '%s' is not available"
archive-name package)) archive-name package))
(unless (bound-and-true-p package--initialized) (unless (bound-and-true-p package--initialized)
(package-initialize t)))) (package-initialize t))))

View file

@ -1,6 +1,6 @@
;;; use-package-jump.el --- Attempt to jump to a use-package declaration -*- lexical-binding: t; -*- ;;; use-package-jump.el --- Attempt to jump to a use-package declaration -*- lexical-binding: t; -*-
;; Copyright (C) 2012-2017 John Wiegley ;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@newartisans.com> ;; Author: John Wiegley <johnw@newartisans.com>
;; Maintainer: John Wiegley <johnw@newartisans.com> ;; Maintainer: John Wiegley <johnw@newartisans.com>
@ -30,8 +30,8 @@
;; Provides the command `M-x use-package-jump-to-package-form', however it ;; Provides the command `M-x use-package-jump-to-package-form', however it
;; only works if the package being jumped to was required during ;; only works if the package being jumped to was required during
;; initialization. If it was delay-loaded, it will not work. Improvements are ;; initialization. If it was delay-loaded, it will not work.
;; needed. ;; Improvements are needed.
;;; Code: ;;; Code:
@ -48,11 +48,10 @@ Returns an absolute file path or nil if none is found."
;;;###autoload ;;;###autoload
(defun use-package-jump-to-package-form (package) (defun use-package-jump-to-package-form (package)
"Attempt to find and jump to the `use-package' form that loaded "Attempt to find and jump to the `use-package' form that loaded PACKAGE.
PACKAGE. This will only find the form if that form actually This will only find the form if that form actually required
required PACKAGE. If PACKAGE was previously required then this PACKAGE. If PACKAGE was previously required then this function
function will jump to the file that originally required PACKAGE will jump to the file that originally required PACKAGE instead."
instead."
(interactive (list (completing-read "Package: " features))) (interactive (list (completing-read "Package: " features)))
(let* ((package (if (stringp package) (intern package) package)) (let* ((package (if (stringp package) (intern package) package))
(requiring-file (use-package-find-require package)) (requiring-file (use-package-find-require package))

View file

@ -1,6 +1,6 @@
;;; use-package-lint.el --- Attempt to find errors in use-package declarations -*- lexical-binding: t; -*- ;;; use-package-lint.el --- Attempt to find errors in use-package declarations -*- lexical-binding: t; -*-
;; Copyright (C) 2012-2017 John Wiegley ;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@newartisans.com> ;; Author: John Wiegley <johnw@newartisans.com>
;; Maintainer: John Wiegley <johnw@newartisans.com> ;; Maintainer: John Wiegley <johnw@newartisans.com>
@ -63,7 +63,7 @@
;;;###autoload ;;;###autoload
(defun use-package-lint () (defun use-package-lint ()
"Check for errors in use-package declarations. "Check for errors in `use-package' declarations.
For example, if the module's `:if' condition is met, but even For example, if the module's `:if' condition is met, but even
with the specified `:load-path' the module cannot be found." with the specified `:load-path' the module cannot be found."
(interactive) (interactive)

View file

@ -1,12 +1,12 @@
;;; use-package.el --- A configuration macro for simplifying your .emacs -*- lexical-binding: t; -*- ;;; use-package.el --- A configuration macro for simplifying your .emacs -*- lexical-binding: t; -*-
;; Copyright (C) 2012-2017 John Wiegley ;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@newartisans.com> ;; Author: John Wiegley <johnw@newartisans.com>
;; Maintainer: John Wiegley <johnw@newartisans.com> ;; Maintainer: John Wiegley <johnw@newartisans.com>
;; Created: 17 Jun 2012 ;; Created: 17 Jun 2012
;; Modified: 29 Nov 2017 ;; Modified: 29 Nov 2017
;; Version: 2.4.1 ;; Version: 2.4.4
;; Package-Requires: ((emacs "24.3") (bind-key "2.4")) ;; Package-Requires: ((emacs "24.3") (bind-key "2.4"))
;; Keywords: dotemacs startup speed config package ;; Keywords: dotemacs startup speed config package
;; URL: https://github.com/jwiegley/use-package ;; URL: https://github.com/jwiegley/use-package

View file

@ -158,4 +158,4 @@
;; no-update-autoloads: t ;; no-update-autoloads: t
;; End: ;; End:
;;; use-package-tests.el ends here ;;; use-package-chords-tests.el ends here

View file

@ -875,6 +875,12 @@
(gnus-harvest-install)) (gnus-harvest-install))
t)))) t))))
(ert-deftest use-package-test/:autoload-1 ()
(match-expansion
(use-package foo :autoload bar)
`(unless (fboundp 'bar)
(autoload #'bar "foo"))))
(ert-deftest use-package-test/:defines-1 () (ert-deftest use-package-test/:defines-1 ()
(match-expansion (match-expansion
(use-package foo :defines bar) (use-package foo :defines bar)
@ -1150,7 +1156,7 @@
(match-expansion (match-expansion
(use-package foo :custom-face (foo ((t (:background "#e4edfc"))))) (use-package foo :custom-face (foo ((t (:background "#e4edfc")))))
`(progn `(progn
(custom-set-faces (backquote (foo ((t (:background "#e4edfc")))))) (apply #'face-spec-set (backquote (foo ((t (:background "#e4edfc"))))))
(require 'foo nil nil)))) (require 'foo nil nil))))
(ert-deftest use-package-test/:custom-face-2 () (ert-deftest use-package-test/:custom-face-2 ()
@ -1160,12 +1166,19 @@
(example-1-face ((t (:foreground "LightPink")))) (example-1-face ((t (:foreground "LightPink"))))
(example-2-face ((t (:foreground "LightGreen"))))) (example-2-face ((t (:foreground "LightGreen")))))
`(progn `(progn
(custom-set-faces (apply #'face-spec-set
(backquote (example-1-face ((t (:foreground "LightPink")))))) (backquote (example-1-face ((t (:foreground "LightPink"))))))
(custom-set-faces (apply #'face-spec-set
(backquote (example-2-face ((t (:foreground "LightGreen")))))) (backquote (example-2-face ((t (:foreground "LightGreen"))))))
(require 'example nil nil)))) (require 'example nil nil))))
(ert-deftest use-package-test/:custom-face-3 ()
(match-expansion
(use-package foo :custom-face (foo ((t (:background "#e4edfc"))) face-defspec-spec))
`(progn
(apply #'face-spec-set (backquote (foo ((t (:background "#e4edfc"))) face-defspec-spec)))
(require 'foo nil nil))))
(ert-deftest use-package-test/:init-1 () (ert-deftest use-package-test/:init-1 ()
(match-expansion (match-expansion
(use-package foo :init (init)) (use-package foo :init (init))