Update upstream source from tag 'upstream/2.4.1'
Update to upstream version '2.4.1'
with Debian dir f8c053702c3b7d15f67615d55be82e650ee68060
Lev Lamberov
3 years ago
14 | 14 | - tar xf emacs-bin-${EMACS_VERSION}.tar.gz -C / |
15 | 15 | - export EMACS=/tmp/emacs/bin/emacs |
16 | 16 | - $EMACS --version |
17 | dist: trusty | |
17 | dist: bionic | |
18 | 18 | addons: |
19 | 19 | apt: |
20 | 20 | packages: |
21 | 21 | - texinfo |
22 | - libgnutls30 | |
22 | 23 | script: |
23 | 24 | - make |
24 | 25 | - make test |
52 | 52 | $(info make test-interactive - run tests interactively) |
53 | 53 | $(info make emacs-Q - run emacs -Q plus Use-Package) |
54 | 54 | $(info ) |
55 | $(info Release Managment) | |
56 | $(info =================) | |
55 | $(info Release Management) | |
56 | $(info ==================) | |
57 | 57 | $(info ) |
58 | 58 | $(info make texi - regenerate texi from org) |
59 | 59 | $(info make stats - regenerate statistics) |
0 | 0 | # Changes |
1 | ||
2 | ## 2.4.1 | |
3 | ||
4 | This is mostly a bug-fix release: | |
5 | ||
6 | - Update the documentation for :custom as per #850 | |
7 | ||
8 | - Fix broken test due to #850 | |
9 | ||
10 | - better tests | |
11 | ||
12 | - add test for #845 | |
13 | ||
14 | - Support keymap symbol in bind-key. Fix #845 | |
15 | ||
16 | - use-package-core.el: use the Emacs set-default function to avoid saving :custom vars twice | |
17 | ||
18 | - Fix Travis | |
19 | ||
20 | - typo, should be a vector, not a bytecode object | |
21 | ||
22 | Solves https://github.com/jwiegley/use-package/issues/842 | |
23 | ||
24 | - Add special value back again, in case needed for backwards compat | |
25 | ||
26 | I don't know why this special value exists, but perhaps old client code uses it. | |
27 | ||
28 | The additional `t' in the macro expansion is accidental but not harmful I guess. | |
29 | ||
30 | - Even when there's no :config, run any pre/post config hooks | |
31 | ||
32 | i.e., following the existing docs for use-package-inject-hooks, these hooks are | |
33 | run: | |
34 | ||
35 | use-package--foo--pre-config-hook | |
36 | use-package--foo--post-config-hook | |
37 | ||
38 | This should make config customisations more predictable (for example, spacemacs | |
39 | uses these hooks extensively to allow 'layers' to be customised). | |
40 | ||
41 | I got rid of the "special" default value for :config, because it doesn't seem to | |
42 | be treated any differently than nil. | |
43 | ||
44 | Fixes #785 | |
45 | ||
46 | - Clarify the documentation for :after | |
47 | ||
48 | - add table of contents to README | |
49 | ||
50 | - Fix typos | |
51 | ||
52 | Typos found with codespell. | |
53 | ||
54 | - Fix typos | |
55 | ||
56 | - Attempt to explain omit "-hook" better | |
57 | ||
58 | - Update tests | |
59 | ||
60 | - Switch from `require' to `load' + `featurep' | |
61 | ||
62 | - Use `require', not `load', when byte-compiling | |
63 | ||
64 | - Make custom-face evaluate elisp. | |
65 | ||
66 | Fix #696. | |
67 | ||
68 | - Add a line of documentation for (use-pacakage ... :hook). | |
69 | ||
70 | - Fix typo in README | |
71 | ||
72 | - Fix documentation for defer | |
73 | ||
74 | - Add no-query option for pdf-tools-install | |
75 | ||
76 | - Fix typo in README | |
77 | ||
78 | - Fix all notes in README | |
79 | ||
80 | - Mention use-package-ensure in README | |
81 | ||
82 | Without requiring `use-package-ensure`, setting `use-package-always-ensure` | |
83 | did not actually work for me. | |
1 | 84 | |
2 | 85 | ## 2.4 |
3 | 86 | |
175 | 258 | |
176 | 259 | - For extension authors, there is a new customization variable |
177 | 260 | `use-package-merge-key-alist` that specifies how values passed to multiple |
178 | occurences of the same key should be merged into a single value, during | |
261 | occurrences of the same key should be merged into a single value, during | |
179 | 262 | normalization of the `use-package` declaration into a proper plist. The |
180 | 263 | default behavior is to simply append the values together (since they are |
181 | 264 | always normalized to lists). |
10 | 10 | were getting difficult to manage. Yet with this utility my total load time is |
11 | 11 | around 2 seconds, with no loss of functionality! |
12 | 12 | |
13 | Note that `use-package` is **not** a package manager! Although `use-package` | |
13 | **NOTE**: `use-package` is **not** a package manager! Although `use-package` | |
14 | 14 | does have the useful capability to interface with package managers (see |
15 | 15 | [below](#package-installation)), its primary purpose is for the configuration |
16 | 16 | and loading of packages. |
17 | 17 | |
18 | 18 | Notes for users upgrading to 2.x are located [at the bottom](#upgrading-to-2x). |
19 | 19 | |
20 | - [Installing use-package](#installing-use-package) | |
21 | - [Getting started](#getting-started) | |
22 | - [Key-binding](#key-binding) | |
23 | + [Binding to keymaps](#binding-to-keymaps) | |
24 | + [Binding within local keymaps](#binding-within-local-keymaps) | |
25 | - [Modes and interpreters](#modes-and-interpreters) | |
26 | - [Magic handlers](#magic-handlers) | |
27 | - [Hooks](#hooks) | |
28 | - [Package customization](#package-customization) | |
29 | + [Customizing variables](#customizing-variables) | |
30 | + [Customizing faces](#customizing-faces) | |
31 | - [Notes about lazy loading](#notes-about-lazy-loading) | |
32 | - [Information about package loads](#information-about-package-loads) | |
33 | - [Conditional loading](#conditional-loading) | |
34 | + [Conditional loading before :preface](#conditional-loading-before-preface) | |
35 | + [Loading packages in a sequence](#loading-packages-in-sequence) | |
36 | + [Prevent loading if dependencies are missing](#prevent-loading-if-dependencies-are-missing) | |
37 | - [Byte compiling your .emacs](#byte-compiling-your-emacs) | |
38 | + [Prevent a package from loading at compile-time](#prevent-a-package-from-loading-at-compile-time) | |
39 | - [Extending the load-path](#extending-the-load-path) | |
40 | - [Catching errors during use-package expansion](#catching-errors-during-use-package-expansion) | |
41 | - [Diminishing and delighting minor modes](#diminishing-and-delighting-minor-modes) | |
42 | - [Package installation](#package-installation) | |
43 | + [Usage with other package managers](#usage-with-other-package-managers) | |
44 | - [Gathering Statistics](#gathering-statistics) | |
45 | - [Keyword Extensions](#keyword-extensions) | |
46 | + [use-package-ensure-system-package](#use-package-ensure-system-package) | |
47 | + [use-package-chords](#use-package-chords) | |
48 | + [How to create an extension](#how-to-create-an-extension) | |
49 | + [First step: Add the keyword](#first-step-add-the-keyword) | |
50 | + [Second step: Create a normalizer](#second-step-create-a-normalizer) | |
51 | + [Third step: Create a handler](#third-step-create-a-handler) | |
52 | + [Fourth step: Test it out](#fourth-step-test-it-out) | |
53 | - [Some timing results](#some-timing-results) | |
54 | * [Upgrading to 2.x](#upgrading-to-2x) | |
55 | + [Semantics of :init is now consistent](#semantics-of-init-is-now-consistent) | |
56 | + [:idle has been removed](#idle-has-been-removed) | |
57 | + [:defer now accepts an optional numeric argument](#defer-now-accepts-an-optional-numeric-argument) | |
58 | + [Add :preface, occuring before everything except :disabled](#add-preface-occurring-before-everything-except-disabled) | |
59 | + [Add :functions, for declaring functions to the byte-compiler](#add-functions-for-declaring-functions-to-the-byte-compiler) | |
60 | + [use-package.el is no longer needed at runtime](#use-packageel-is-no-longer-needed-at-runtime) | |
20 | 61 | ## Installing use-package |
21 | 62 | |
22 | 63 | Either clone from this GitHub repository or install from |
122 | 163 | |
123 | 164 | The `:commands` keyword likewise takes either a symbol or a list of symbols. |
124 | 165 | |
125 | NOTE: Inside strings, special keys like `tab` or `F1`-`Fn` have to be written inside angle brackets, e.g. `"C-<up>"`. | |
166 | **NOTE**: inside strings, special keys like `tab` or `F1`-`Fn` have to be written inside angle brackets, e.g. `"C-<up>"`. | |
126 | 167 | Standalone special keys (and some combinations) can be written in square brackets, e.g. `[tab]` instead of `"<tab>"`. The syntax for the keybindings is similar to |
127 | 168 | the "kbd" syntax: see [https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Rebinding.html](https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Rebinding.html) |
128 | 169 | for more information. |
251 | 292 | :load-path "site-lisp/pdf-tools/lisp" |
252 | 293 | :magic ("%PDF" . pdf-view-mode) |
253 | 294 | :config |
254 | (pdf-tools-install)) | |
295 | (pdf-tools-install :no-query)) | |
255 | 296 | ``` |
256 | 297 | |
257 | 298 | This registers an autoloaded command for `pdf-view-mode`, defers loading of |
260 | 301 | |
261 | 302 | ## Hooks |
262 | 303 | |
263 | The `:hook` keyword allows adding functions onto hooks, here only the basename | |
264 | of the hook is required. Thus, all of the following are equivalent: | |
304 | The `:hook` keyword allows adding functions onto package hooks. Thus, | |
305 | all of the following are equivalent: | |
265 | 306 | |
266 | 307 | ``` elisp |
267 | 308 | (use-package ace-jump-mode |
297 | 338 | (add-hook 'text-mode-hook #'ace-jump-mode)) |
298 | 339 | ``` |
299 | 340 | |
341 | When using `:hook` omit the "-hook" suffix if you specify the hook | |
342 | explicitly, as this is appended by default. For example the following | |
343 | code will not work as it attempts to add to the `prog-mode-hook-hook` | |
344 | which does not exist: | |
345 | ||
346 | ``` elisp | |
347 | ;; DOES NOT WORK | |
348 | (use-package ace-jump-mode | |
349 | :hook (prog-mode-hook . ace-jump-mode)) | |
350 | ``` | |
351 | ||
352 | If you do not like this behaviour, set `use-package-hook-name-suffix` | |
353 | to nil. By default the value of this variable is "-hook". | |
354 | ||
300 | 355 | The use of `:hook`, as with `:bind`, `:mode`, `:interpreter`, etc., causes the |
301 | 356 | functions being hooked to implicitly be read as `:commands` (meaning they will |
302 | 357 | establish interactive `autoload` definitions for that module, if not already |
317 | 372 | |
318 | 373 | The documentation string is not mandatory. |
319 | 374 | |
320 | **NOTE**: These are only for people who wish to keep customizations with their | |
375 | **NOTE**: these are only for people who wish to keep customizations with their | |
321 | 376 | accompanying use-package declarations. Functionally, the only benefit over |
322 | 377 | using `setq` in a `:config` block is that customizations might execute code |
323 | when values are assigned. If you currently use `M-x customize-option` and save | |
324 | to a settings file, you do not want to use this option. | |
378 | when values are assigned. | |
379 | ||
380 | **NOTE**: The customized values are **not** saved in the Emacs `custom-file`. | |
381 | Thus you should either use the `:custom` option **or** you should use `M-x | |
382 | customize-option` which will save customized values in the Emacs `custom-file`. | |
383 | Do not use both. | |
325 | 384 | |
326 | 385 | ### Customizing faces |
327 | 386 | |
399 | 458 | When byte-compiling your `.emacs` file, disabled declarations are omitted |
400 | 459 | from the output entirely, to accelerate startup times. |
401 | 460 | |
402 | Note that `:when` is provided as an alias for `:if`, and `:unless foo` means | |
461 | **NOTE**: `:when` is provided as an alias for `:if`, and `:unless foo` means | |
403 | 462 | the same thing as `:if (not foo)`. For example, the following will also stop |
404 | 463 | `:ensure` from happening on Mac systems: |
405 | 464 | |
457 | 516 | means that the package will be loaded when either both `foo` and `bar` have |
458 | 517 | been loaded, or both `baz` and `quux` have been loaded. |
459 | 518 | |
460 | Note: Pay attention if you set `use-package-always-defer` to t, and also use | |
519 | **NOTE**: pay attention if you set `use-package-always-defer` to t, and also use | |
461 | 520 | the `:after` keyword, as you will need to specify how the declared package is |
462 | to be loaded: e.g., by some `:bind`. If you're not using one of tho mechanisms | |
521 | to be loaded: e.g., by some `:bind`. If you're not using one of the mechanisms | |
463 | 522 | that registers autoloads, such as `:bind` or `:hook`, and your package manager |
464 | 523 | does not provide autoloads, it's possible that without adding `:demand t` to |
465 | 524 | those declarations, your package will never be loaded. |
470 | 529 | the somewhat simpler `:requires` keyword simply never loads the package if the |
471 | 530 | dependencies are not available at the time the `use-package` declaration is |
472 | 531 | encountered. By "available" in this context it means that `foo` is available |
473 | of `(featurep 'foo)` evaulates to a non-nil value. For example: | |
532 | if `(featurep 'foo)` evaluates to a non-nil value. For example: | |
474 | 533 | |
475 | 534 | ``` elisp |
476 | 535 | (use-package abbrev |
556 | 615 | :commands R) |
557 | 616 | ``` |
558 | 617 | |
559 | Note that when using a symbol or a function to provide a dynamically generated | |
618 | **NOTE**: when using a symbol or a function to provide a dynamically generated | |
560 | 619 | list of paths, you must inform the byte-compiler of this definition so the |
561 | 620 | value is available at byte-compilation time. This is done by using the |
562 | 621 | special form `eval-and-compile` (as opposed to `eval-when-compile`). Further, |
668 | 727 | is particularly useful if you share your `.emacs` among several machines; the |
669 | 728 | relevant packages are downloaded automatically once declared in your `.emacs`. |
670 | 729 | The `:ensure` keyword causes the package(s) to be installed automatically if |
671 | not already present on your system (set `(setq use-package-always-ensure t)` | |
672 | if you wish this behavior to be global for all packages): | |
730 | not already present on your system: | |
673 | 731 | |
674 | 732 | ``` elisp |
675 | 733 | (use-package magit |
684 | 742 | :ensure auctex) |
685 | 743 | ``` |
686 | 744 | |
687 | Note that `:ensure` will install a package if it is not already installed, but | |
745 | Enable `use-package-always-ensure` if you wish this behavior to be global | |
746 | for all packages: | |
747 | ||
748 | ``` elisp | |
749 | (require 'use-package-ensure) | |
750 | (setq use-package-always-ensure t) | |
751 | ``` | |
752 | ||
753 | **NOTE**: `:ensure` will install a package if it is not already installed, but | |
688 | 754 | it does not keep it up-to-date. If you want to keep your packages updated |
689 | 755 | automatically, one option is to use |
690 | 756 | [auto-package-update](https://github.com/rranelli/auto-package-update.el), |
803 | 869 | This will expect a global binary package to exist called `rg`. If it |
804 | 870 | does not, it will use your system package manager (using the package |
805 | 871 | [`system-packages`](https://gitlab.com/jabranham/system-packages)) to |
806 | attempt an install of a binary by the same name asyncronously. For | |
872 | attempt an install of a binary by the same name asynchronously. For | |
807 | 873 | example, for most `macOS` users this would call: `brew install rg`. |
808 | 874 | |
809 | 875 | If the package is named differently than the binary, you can use a |
1026 | 1092 | It's possible that the user could use `featurep` in their idle to test for |
1027 | 1093 | this case, but that's a subtlety I'd rather avoid. |
1028 | 1094 | |
1029 | ## :defer now accepts an optional integer argument | |
1095 | ## :defer now accepts an optional numeric argument | |
1030 | 1096 | |
1031 | 1097 | `:defer [N]` causes the package to be loaded -- if it has not already been -- |
1032 | 1098 | after `N` seconds of idle time. |
1048 | 1114 | definitions are unknown because you have them within a guard block), and 2) |
1049 | 1115 | allow you to define code that can be used in an `:if` test. |
1050 | 1116 | |
1051 | Note that whatever is specified within `:preface` is evaluated both at load | |
1117 | **NOTE**: whatever is specified within `:preface` is evaluated both at load | |
1052 | 1118 | time and at byte-compilation time, in order to ensure that definitions are |
1053 | 1119 | seen by both the Lisp evaluator and the byte-compiler, so you should avoid |
1054 | 1120 | having any side-effects in your preface, and restrict it merely to symbol |
93 | 93 | ;; |
94 | 94 | ;; M-x describe-personal-keybindings |
95 | 95 | ;; |
96 | ;; This display will tell you if you've overriden a default keybinding, and | |
96 | ;; This display will tell you if you've overridden a default keybinding, and | |
97 | 97 | ;; what the default was. Also, it will tell you if the key was rebound after |
98 | 98 | ;; your binding it with `bind-key', and what it was rebound it to. |
99 | 99 | |
153 | 153 | |
154 | 154 | COMMAND must be an interactive function or lambda form. |
155 | 155 | |
156 | KEYMAP, if present, should be a keymap and not a quoted symbol. | |
156 | KEYMAP, if present, should be a keymap variable or symbol. | |
157 | 157 | For example: |
158 | 158 | |
159 | 159 | (bind-key \"M-h\" #'some-interactive-function my-mode-map) |
160 | ||
161 | (bind-key \"M-h\" #'some-interactive-function 'my-mode-map) | |
160 | 162 | |
161 | 163 | If PREDICATE is non-nil, it is a form evaluated to determine when |
162 | 164 | a key should be bound. It must return non-nil in such cases. |
170 | 172 | `(let* ((,namevar ,key-name) |
171 | 173 | (,keyvar (if (vectorp ,namevar) ,namevar |
172 | 174 | (read-kbd-macro ,namevar))) |
175 | (kmap (if (and ,keymap (symbolp ,keymap)) (symbol-value ,keymap) ,keymap)) | |
173 | 176 | (,kdescvar (cons (if (stringp ,namevar) ,namevar |
174 | 177 | (key-description ,namevar)) |
175 | (quote ,keymap))) | |
176 | (,bindingvar (lookup-key (or ,keymap global-map) ,keyvar))) | |
178 | (if (symbolp ,keymap) ,keymap (quote ,keymap)))) | |
179 | (,bindingvar (lookup-key (or kmap global-map) ,keyvar))) | |
177 | 180 | (let ((entry (assoc ,kdescvar personal-keybindings)) |
178 | 181 | (details (list ,command |
179 | 182 | (unless (numberp ,bindingvar) |
182 | 185 | (setcdr entry details) |
183 | 186 | (add-to-list 'personal-keybindings (cons ,kdescvar details)))) |
184 | 187 | ,(if predicate |
185 | `(define-key (or ,keymap global-map) ,keyvar | |
188 | `(define-key (or kmap global-map) ,keyvar | |
186 | 189 | '(menu-item "" nil :filter (lambda (&optional _) |
187 | 190 | (when ,predicate |
188 | 191 | ,command)))) |
189 | `(define-key (or ,keymap global-map) ,keyvar ,command))))) | |
192 | `(define-key (or kmap global-map) ,keyvar ,command))))) | |
190 | 193 | |
191 | 194 | ;;;###autoload |
192 | 195 | (defmacro unbind-key (key-name &optional keymap) |
62 | 62 | |
63 | 63 | ## Versions ########################################################## |
64 | 64 | |
65 | VERSION = 2.4 | |
65 | VERSION = 2.4.1 | |
66 | 66 | |
67 | USE_PACKAGE_VERSION = 2.4 | |
67 | USE_PACKAGE_VERSION = 2.4.1 | |
68 | 68 | |
69 | 69 | EMACS_VERSION = 24.3 |
70 | 70 |
11 | 11 | git clone git@github.com:digitalcraftsman/hugo-alabaster-theme.git themes/hugo-alabaster-theme |
12 | 12 | ``` |
13 | 13 | |
14 | > This theme uses the latest developement version of Hugo. Therefore, it doesn't work with the official releases. Look [here](https://github.com/spf13/hugo#build-and-install-the-binaries-from-source-advanced-install) if you want to know how to build Hugo from source. | |
14 | > This theme uses the latest development version of Hugo. Therefore, it doesn't work with the official releases. Look [here](https://github.com/spf13/hugo#build-and-install-the-binaries-from-source-advanced-install) if you want to know how to build Hugo from source. | |
15 | 15 | |
16 | 16 | Next, take a look in the `exampleSite` folder at. This directory contains an example config file and the content for the demo. It serves as an example setup for your documentation. |
17 | 17 |
5 | 5 | ;; Maintainer: John Wiegley <johnw@newartisans.com> |
6 | 6 | ;; Created: 17 Jun 2012 |
7 | 7 | ;; Modified: 29 Nov 2017 |
8 | ;; Version: 2.4 | |
8 | ;; Version: 2.4.1 | |
9 | 9 | ;; Package-Requires: ((emacs "24.3")) |
10 | 10 | ;; Keywords: dotemacs startup speed config package |
11 | 11 | ;; URL: https://github.com/jwiegley/use-package |
55 | 55 | "A use-package declaration for simplifying your `.emacs'." |
56 | 56 | :group 'startup) |
57 | 57 | |
58 | (defconst use-package-version "2.4" | |
58 | (defconst use-package-version "2.4.1" | |
59 | 59 | "This version of use-package.") |
60 | 60 | |
61 | 61 | (defcustom use-package-keywords |
650 | 650 | ,(when (eq use-package-verbose 'debug) |
651 | 651 | `(message ,(format "Compiling package %s" name-string))) |
652 | 652 | ,(unless (plist-get args :no-require) |
653 | `(load ,name-string nil t))))))))) | |
653 | `(unless (featurep ',name-symbol) | |
654 | (load ,name-string nil t)))))))))) | |
654 | 655 | |
655 | 656 | ;; Certain keywords imply :defer, if :demand was not specified. |
656 | 657 | (when (and (not (plist-member args :demand)) |
1027 | 1028 | "use-package statistics" |
1028 | 1029 | "Show current statistics gathered about use-package declarations." |
1029 | 1030 | (setq tabulated-list-format |
1030 | ;; The sum of column width is 80 caracters: | |
1031 | #[("Package" 25 t) | |
1032 | ("Status" 13 t) | |
1033 | ("Last Event" 23 t) | |
1034 | ("Time" 10 t)]) | |
1031 | ;; The sum of column width is 80 characters: | |
1032 | [("Package" 25 t) | |
1033 | ("Status" 13 t) | |
1034 | ("Last Event" 23 t) | |
1035 | ("Time" 10 t)]) | |
1035 | 1036 | (tabulated-list-init-header)) |
1036 | 1037 | |
1037 | 1038 | (defun use-package-statistics-gather (keyword name after) |
1392 | 1393 | (comment (nth 2 def))) |
1393 | 1394 | (unless (and comment (stringp comment)) |
1394 | 1395 | (setq comment (format "Customized with use-package %s" name))) |
1395 | `(customize-set-variable (quote ,variable) ,value ,comment))) | |
1396 | `(funcall (or (get (quote ,variable) 'custom-set) #'set-default) | |
1397 | (quote ,variable) | |
1398 | ,value))) | |
1396 | 1399 | args) |
1397 | 1400 | (use-package-process-keywords name rest state))) |
1398 | 1401 | |
1418 | 1421 | (defun use-package-handler/:custom-face (name _keyword args rest state) |
1419 | 1422 | "Generate use-package custom-face keyword code." |
1420 | 1423 | (use-package-concat |
1421 | (mapcar #'(lambda (def) `(custom-set-faces (quote ,def))) args) | |
1424 | (mapcar #'(lambda (def) `(custom-set-faces (backquote ,def))) args) | |
1422 | 1425 | (use-package-process-keywords name rest state))) |
1423 | 1426 | |
1424 | 1427 | ;;;; :init |
1466 | 1469 | (use-package-concat |
1467 | 1470 | (when use-package-compute-statistics |
1468 | 1471 | `((use-package-statistics-gather :config ',name nil))) |
1469 | (if (or (null arg) (equal arg '(t))) | |
1472 | (if (and (or (null arg) (equal arg '(t))) (not use-package-inject-hooks)) | |
1470 | 1473 | body |
1471 | 1474 | (use-package-with-elapsed-timer |
1472 | 1475 | (format "Configuring package %s" name-symbol) |
1532 | 1535 | package. This is useful if the package is being lazily |
1533 | 1536 | loaded, and you wish to conditionally call functions in your |
1534 | 1537 | `:init' block that are defined in the package. |
1538 | :hook Specify hook(s) to attach this package to. | |
1535 | 1539 | |
1536 | 1540 | :bind Bind keys, and define autoloads for the bound commands. |
1537 | 1541 | :bind* Bind keys, and define autoloads for the bound commands, |
1541 | 1545 | :bind-keymap* Like `:bind-keymap', but overrides all minor mode bindings |
1542 | 1546 | |
1543 | 1547 | :defer Defer loading of a package -- this is implied when using |
1544 | `:commands', `:bind', `:bind*', `:mode', `:magic', | |
1548 | `:commands', `:bind', `:bind*', `:mode', `:magic', `:hook', | |
1545 | 1549 | `:magic-fallback', or `:interpreter'. This can be an integer, |
1546 | 1550 | to force loading after N seconds of idle time, if the package |
1547 | 1551 | has not already been loaded. |
1548 | :after Defer loading of a package until after any of the named | |
1549 | features are loaded. | |
1550 | :demand Prevent deferred loading in all cases. | |
1552 | :after Delay the use-package declaration until after the named modules | |
1553 | have loaded. Once load, it will be as though the use-package | |
1554 | declaration (without `:after') had been seen at that moment. | |
1555 | :demand Prevent the automatic deferred loading introduced by constructs | |
1556 | such as `:bind' (see `:defer' for the complete list). | |
1551 | 1557 | |
1552 | 1558 | :if EXPR Initialize and load only if EXPR evaluates to a non-nil value. |
1553 | 1559 | :disabled The package is ignored completely if this keyword is present. |
1556 | 1562 | :load-path Add to the `load-path' before attempting to load the package. |
1557 | 1563 | :diminish Support for diminish.el (if installed). |
1558 | 1564 | :delight Support for delight.el (if installed). |
1559 | :custom Call `customize-set-variable' with each variable definition. | |
1565 | :custom Call `custom-set' or `set-default' with each variable | |
1566 | definition without modifying the Emacs `custom-file'. | |
1567 | (compare with `custom-set-variables'). | |
1560 | 1568 | :custom-face Call `customize-set-faces' with each face definition. |
1561 | 1569 | :ensure Loads the package using package.el if necessary. |
1562 | 1570 | :pin Pin the package to an archive." |
161 | 161 | (eval-when-compile |
162 | 162 | (with-demoted-errors |
163 | 163 | "Cannot load foo: %S" nil |
164 | (load "foo" nil t))) | |
164 | (unless (featurep 'foo) | |
165 | (load "foo" nil t)))) | |
165 | 166 | (t)) |
166 | 167 | (require 'foo nil nil))))) |
167 | 168 | |
181 | 182 | (eval-when-compile |
182 | 183 | (with-demoted-errors |
183 | 184 | "Cannot load foo: %S" nil |
184 | (load "foo" nil t))) | |
185 | (unless (featurep 'foo) | |
186 | (load "foo" nil t)))) | |
185 | 187 | (preface)) |
186 | 188 | (init) |
187 | 189 | (require 'foo nil nil) |
205 | 207 | (eval-when-compile |
206 | 208 | (with-demoted-errors |
207 | 209 | "Cannot load foo: %S" nil |
208 | (load "foo" nil t))) | |
210 | (unless (featurep 'foo) | |
211 | (load "foo" nil t)))) | |
209 | 212 | (preface)) |
210 | 213 | (init) |
211 | 214 | (eval-after-load 'foo |
452 | 455 | (eval-when-compile |
453 | 456 | (with-demoted-errors |
454 | 457 | "Cannot load foo: %S" nil |
455 | (load "foo" nil t)))) | |
458 | (unless (featurep 'foo) | |
459 | (load "foo" nil t))))) | |
456 | 460 | (require 'foo nil nil))))) |
457 | 461 | |
458 | 462 | (ert-deftest use-package-test/:requires-3 () |
469 | 473 | (eval-and-compile |
470 | 474 | (eval-when-compile |
471 | 475 | (with-demoted-errors "Cannot load foo: %S" nil |
472 | (load "foo" nil t)))) | |
476 | (unless (featurep 'foo) | |
477 | (load "foo" nil t))))) | |
473 | 478 | (require 'foo nil nil))))) |
474 | 479 | |
475 | 480 | (ert-deftest use-package-test/:load-path-1 () |
498 | 503 | (eval-and-compile |
499 | 504 | (eval-when-compile |
500 | 505 | (with-demoted-errors "Cannot load foo: %S" nil |
501 | (load "foo" nil t)))) | |
506 | (unless (featurep 'foo) | |
507 | (load "foo" nil t))))) | |
502 | 508 | (require 'foo nil nil))))) |
503 | 509 | |
504 | 510 | (ert-deftest use-package-test/:load-path-3 () |
815 | 821 | (eval-and-compile |
816 | 822 | (eval-when-compile |
817 | 823 | (with-demoted-errors "Cannot load foo: %S" nil |
818 | (load "foo" nil t)))) | |
824 | (unless (featurep 'foo) | |
825 | (load "foo" nil t))))) | |
819 | 826 | (unless (fboundp 'bar) |
820 | 827 | (autoload #'bar "foo" nil t)) |
821 | 828 | (eval-when-compile |
870 | 877 | (eval-and-compile |
871 | 878 | (eval-when-compile |
872 | 879 | (with-demoted-errors "Cannot load gnus-harvest: %S" nil |
873 | (load "gnus-harvest" nil t)))) | |
880 | (unless (featurep 'gnus-harvest) | |
881 | (load "gnus-harvest" nil t))))) | |
874 | 882 | (eval-when-compile |
875 | 883 | (declare-function gnus-harvest-install "gnus-harvest")) |
876 | 884 | (require 'gnus-harvest nil nil) |
895 | 903 | (eval-when-compile |
896 | 904 | (with-demoted-errors |
897 | 905 | "Cannot load foo: %S" nil |
898 | (load "foo" nil t)))) | |
906 | (unless (featurep 'foo) | |
907 | (load "foo" nil t))))) | |
899 | 908 | (require 'foo nil nil))))) |
900 | 909 | |
901 | 910 | (ert-deftest use-package-test/:functions-1 () |
913 | 922 | (eval-when-compile |
914 | 923 | (with-demoted-errors |
915 | 924 | "Cannot load foo: %S" nil |
916 | (load "foo" nil t)))) | |
925 | (unless (featurep 'foo) | |
926 | (load "foo" nil t))))) | |
917 | 927 | (require 'foo nil nil))))) |
918 | 928 | |
919 | 929 | (ert-deftest use-package-test/:functions-3 () |
929 | 939 | (declare-function bar "foo") |
930 | 940 | (eval-when-compile |
931 | 941 | (with-demoted-errors "Cannot load foo: %S" nil |
932 | (load "foo" nil t))))))) | |
942 | (unless (featurep 'foo) | |
943 | (load "foo" nil t)))))))) | |
933 | 944 | |
934 | 945 | (ert-deftest use-package-test/:functions-5 () |
935 | 946 | (let ((byte-compile-current-file t)) |
941 | 952 | (eval-when-compile |
942 | 953 | (with-demoted-errors |
943 | 954 | "Cannot load foo: %S" nil |
944 | (load "foo" nil t)))) | |
955 | (unless (featurep 'foo) | |
956 | (load "foo" nil t))))) | |
945 | 957 | (eval-after-load 'foo |
946 | 958 | '(progn |
947 | 959 | (config) |
960 | 972 | (eval-and-compile |
961 | 973 | (eval-when-compile |
962 | 974 | (with-demoted-errors "Cannot load foo: %S" nil |
963 | (load "foo" nil t)))) | |
975 | (unless (featurep 'foo) | |
976 | (load "foo" nil t))))) | |
964 | 977 | (require 'foo nil nil))))) |
965 | 978 | |
966 | 979 | (ert-deftest use-package-test/:defer-3 () |
975 | 988 | `(eval-and-compile |
976 | 989 | (eval-when-compile |
977 | 990 | (with-demoted-errors "Cannot load foo: %S" nil |
978 | (load "foo" nil t))))))) | |
991 | (unless (featurep 'foo) | |
992 | (load "foo" nil t)))))))) | |
979 | 993 | |
980 | 994 | (ert-deftest use-package-test-normalize/:hook () |
981 | 995 | (flet ((norm (&rest args) |
1008 | 1022 | (eval-when-compile |
1009 | 1023 | (with-demoted-errors |
1010 | 1024 | "Cannot load foo: %S" nil |
1011 | (load "foo" nil t)))) | |
1025 | (unless (featurep 'foo) | |
1026 | (load "foo" nil t))))) | |
1012 | 1027 | (unless |
1013 | 1028 | (fboundp 'key) |
1014 | 1029 | (autoload #'key "foo" nil t)) |
1117 | 1132 | (match-expansion |
1118 | 1133 | (use-package foo :custom (foo bar)) |
1119 | 1134 | `(progn |
1120 | (customize-set-variable 'foo bar "Customized with use-package foo") | |
1135 | (funcall | |
1136 | (or | |
1137 | (get 'foo 'custom-set) | |
1138 | (function set-default)) | |
1139 | 'foo bar) | |
1121 | 1140 | (require 'foo nil nil)))) |
1122 | 1141 | |
1123 | 1142 | (ert-deftest use-package-test/:custom-face-1 () |
1124 | 1143 | (match-expansion |
1125 | 1144 | (use-package foo :custom-face (foo ((t (:background "#e4edfc"))))) |
1126 | 1145 | `(progn |
1127 | (custom-set-faces '(foo ((t (:background "#e4edfc"))))) | |
1146 | (custom-set-faces (backquote (foo ((t (:background "#e4edfc")))))) | |
1128 | 1147 | (require 'foo nil nil)))) |
1129 | 1148 | |
1130 | 1149 | (ert-deftest use-package-test/:init-1 () |
1142 | 1161 | (eval-and-compile |
1143 | 1162 | (eval-when-compile |
1144 | 1163 | (with-demoted-errors "Cannot load foo: %S" nil |
1145 | (load "foo" nil t)))) | |
1164 | (unless (featurep 'foo) | |
1165 | (load "foo" nil t))))) | |
1146 | 1166 | (init) |
1147 | 1167 | (require 'foo nil nil))))) |
1148 | 1168 | |
1189 | 1209 | (eval-and-compile |
1190 | 1210 | (eval-when-compile |
1191 | 1211 | (with-demoted-errors "Cannot load foo: %S" nil |
1192 | (load "foo" nil t)))) | |
1212 | (unless (featurep 'foo) | |
1213 | (load "foo" nil t))))) | |
1193 | 1214 | (eval-after-load 'bar |
1194 | 1215 | '(require 'foo nil nil)))))) |
1195 | 1216 | |
1332 | 1353 | (eval-and-compile |
1333 | 1354 | (eval-when-compile |
1334 | 1355 | (with-demoted-errors "Cannot load foo: %S" nil |
1335 | (load "foo" nil t)))) | |
1356 | (unless (featurep 'foo) | |
1357 | (load "foo" nil t))))) | |
1336 | 1358 | (require 'foo nil nil))))) |
1337 | 1359 | |
1338 | 1360 | (ert-deftest use-package-test/:demand-3 () |
1351 | 1373 | (eval-and-compile |
1352 | 1374 | (eval-when-compile |
1353 | 1375 | (with-demoted-errors "Cannot load foo: %S" nil |
1354 | (load "foo" nil t)))) | |
1376 | (unless (featurep 'foo) | |
1377 | (load "foo" nil t))))) | |
1355 | 1378 | (require 'foo nil nil) |
1356 | 1379 | (config) |
1357 | 1380 | t)))) |
1371 | 1394 | (eval-and-compile |
1372 | 1395 | (eval-when-compile |
1373 | 1396 | (with-demoted-errors "Cannot load foo: %S" nil |
1374 | (load "foo" nil t)))) | |
1397 | (unless (featurep 'foo) | |
1398 | (load "foo" nil t))))) | |
1375 | 1399 | (eval-after-load 'bar |
1376 | 1400 | '(require 'foo nil nil)))))) |
1377 | 1401 | |
1424 | 1448 | (eval-and-compile |
1425 | 1449 | (eval-when-compile |
1426 | 1450 | (with-demoted-errors "Cannot load foo: %S" nil |
1427 | (load "foo" nil t)))) | |
1451 | (unless (featurep 'foo) | |
1452 | (load "foo" nil t))))) | |
1428 | 1453 | (require 'foo nil nil) |
1429 | 1454 | (config) |
1430 | 1455 | t)))) |
1445 | 1470 | (eval-and-compile |
1446 | 1471 | (eval-when-compile |
1447 | 1472 | (with-demoted-errors "Cannot load foo: %S" nil |
1448 | (load "foo" nil t)))) | |
1473 | (unless (featurep 'foo) | |
1474 | (load "foo" nil t))))) | |
1449 | 1475 | (eval-after-load 'foo |
1450 | 1476 | '(progn |
1451 | 1477 | (config) |
1452 | 1478 | t)))))) |
1479 | ||
1480 | (ert-deftest use-package-test/pre-post-hooks-with-:config () | |
1481 | (let ((use-package-inject-hooks t)) | |
1482 | (match-expansion | |
1483 | (use-package foo :config (config)) | |
1484 | `(progn | |
1485 | (when | |
1486 | (run-hook-with-args-until-failure 'use-package--foo--pre-init-hook) | |
1487 | (run-hooks 'use-package--foo--post-init-hook)) | |
1488 | (require 'foo nil nil) | |
1489 | (when | |
1490 | (run-hook-with-args-until-failure 'use-package--foo--pre-config-hook) | |
1491 | (config) | |
1492 | (run-hooks 'use-package--foo--post-config-hook)) | |
1493 | t)))) | |
1494 | ||
1495 | (ert-deftest use-package-test/pre-post-hooks-without-:config () | |
1496 | ;; https://github.com/jwiegley/use-package/issues/785 | |
1497 | (let ((use-package-inject-hooks t)) | |
1498 | (match-expansion | |
1499 | (use-package foo) | |
1500 | `(progn | |
1501 | (when | |
1502 | (run-hook-with-args-until-failure 'use-package--foo--pre-init-hook) | |
1503 | (run-hooks 'use-package--foo--post-init-hook)) | |
1504 | (require 'foo nil nil) | |
1505 | (when | |
1506 | (run-hook-with-args-until-failure 'use-package--foo--pre-config-hook) | |
1507 | t | |
1508 | (run-hooks 'use-package--foo--post-config-hook)) | |
1509 | t)))) | |
1453 | 1510 | |
1454 | 1511 | (ert-deftest use-package-test-normalize/:diminish () |
1455 | 1512 | (should (equal (use-package-normalize-diminish 'foopkg :diminish nil) |
1882 | 1939 | (define-prefix-command 'my/map) |
1883 | 1940 | (bind-key "<f1>" 'my/map nil nil)))) |
1884 | 1941 | |
1942 | ||
1943 | (ert-deftest bind-key/845 () | |
1944 | (defvar test-map (make-keymap)) | |
1945 | (bind-key "<f1>" 'ignore 'test-map) | |
1946 | (should (eq (lookup-key test-map (kbd "<f1>")) 'ignore)) | |
1947 | (let ((binding (cl-find "<f1>" personal-keybindings :test 'string= :key 'caar))) | |
1948 | (message "test-map %s" test-map) | |
1949 | (message "binding %s" binding) | |
1950 | (should (eq (cdar binding) 'test-map)) | |
1951 | (should (eq (nth 1 binding) 'ignore)) | |
1952 | (should (eq (nth 2 binding) nil)))) | |
1953 | ||
1885 | 1954 | ;; Local Variables: |
1886 | 1955 | ;; indent-tabs-mode: nil |
1887 | 1956 | ;; no-byte-compile: t |
5 | 5 | ;; Maintainer: John Wiegley <johnw@newartisans.com> |
6 | 6 | ;; Created: 17 Jun 2012 |
7 | 7 | ;; Modified: 29 Nov 2017 |
8 | ;; Version: 2.4 | |
8 | ;; Version: 2.4.1 | |
9 | 9 | ;; Package-Requires: ((emacs "24.3") (bind-key "2.4")) |
10 | 10 | ;; Keywords: dotemacs startup speed config package |
11 | 11 | ;; URL: https://github.com/jwiegley/use-package |
10 | 10 | #+TEXINFO_DIR_CATEGORY: Emacs |
11 | 11 | #+TEXINFO_DIR_TITLE: use-package: (use-package). |
12 | 12 | #+TEXINFO_DIR_DESC: Declarative package configuration for Emacs. |
13 | #+SUBTITLE: for version 2.4 | |
13 | #+SUBTITLE: for version 2.4.1 | |
14 | 14 | |
15 | 15 | #+TEXINFO_DEFFN: t |
16 | 16 | #+OPTIONS: H:4 num:3 toc:2 creator:t |
170 | 170 | should display something like |
171 | 171 | |
172 | 172 | #+BEGIN_EXAMPLE |
173 | use-package-version’s value is "2.4" | |
173 | use-package-version’s value is "2.4.1" | |
174 | 174 | #+END_EXAMPLE |
175 | 175 | |
176 | 176 | If you are completely new to use-package then see {{{link-jump(Getting |
262 | 262 | |
263 | 263 | *NOTE*: Pay attention if you set ~use-package-always-defer~ to t, and also use |
264 | 264 | the ~:after~ keyword, as you will need to specify how the declared package is |
265 | to be loaded: e.g., by some ~:bind~. If you're not using one of tho mechanisms | |
265 | to be loaded: e.g., by some ~:bind~. If you're not using one of the mechanisms | |
266 | 266 | that registers autoloads, such as ~:bind~ or ~:hook~, and your package manager |
267 | 267 | does not provide autoloads, it's possible that without adding ~:demand t~ to |
268 | 268 | those declarations, your package will never be loaded. |
821 | 821 | the somewhat simpler ~:requires~ keyword simply never loads the package if the |
822 | 822 | dependencies are not available at the time the ~use-package~ declaration is |
823 | 823 | encountered. By "available" in this context it means that ~foo~ is available |
824 | of ~(featurep 'foo)~ evaulates to a non-nil value. For example: | |
824 | of ~(featurep 'foo)~ evaluates to a non-nil value. For example: | |
825 | 825 | |
826 | 826 | #+BEGIN_SRC emacs-lisp |
827 | 827 | (use-package abbrev |
29 | 29 | @finalout |
30 | 30 | @titlepage |
31 | 31 | @title use-package User Manual |
32 | @subtitle for version 2.4 | |
32 | @subtitle for version 2.4.1 | |
33 | 33 | @author John Wiegley |
34 | 34 | @page |
35 | 35 | @vskip 0pt plus 1filll |
261 | 261 | should display something like |
262 | 262 | |
263 | 263 | @example |
264 | use-package-version’s value is "2.4" | |
264 | use-package-version’s value is "2.4.1" | |
265 | 265 | @end example |
266 | 266 | |
267 | 267 | If you are completely new to use-package then see @ref{Getting Started}. |
918 | 918 | the somewhat simpler @code{:requires} keyword simply never loads the package if the |
919 | 919 | dependencies are not available at the time the @code{use-package} declaration is |
920 | 920 | encountered. By "available" in this context it means that @code{foo} is available |
921 | of @code{(featurep 'foo)} evaulates to a non-nil value. For example: | |
921 | of @code{(featurep 'foo)} evaluates to a non-nil value. For example: | |
922 | 922 | |
923 | 923 | @lisp |
924 | 924 | (use-package abbrev |