Browse Source

Update use-package

master
Brett Langdon 5 years ago
parent
commit
be53620580
Signed by: brettlangdon GPG Key ID: A70042D88B95AA2B
10 changed files with 131 additions and 20 deletions
  1. +2
    -1
      emacs.d/use-package/.travis.yml
  2. +83
    -0
      emacs.d/use-package/NEWS.md
  3. +6
    -2
      emacs.d/use-package/README.md
  4. +8
    -5
      emacs.d/use-package/bind-key.el
  5. +2
    -2
      emacs.d/use-package/default.mk
  6. +8
    -4
      emacs.d/use-package/use-package-core.el
  7. +17
    -1
      emacs.d/use-package/use-package-tests.el
  8. +1
    -1
      emacs.d/use-package/use-package.el
  9. +2
    -2
      emacs.d/use-package/use-package.org
  10. +2
    -2
      emacs.d/use-package/use-package.texi

+ 2
- 1
emacs.d/use-package/.travis.yml View File

@ -15,11 +15,12 @@ install:
- tar xf emacs-bin-${EMACS_VERSION}.tar.gz -C / - tar xf emacs-bin-${EMACS_VERSION}.tar.gz -C /
- export EMACS=/tmp/emacs/bin/emacs - export EMACS=/tmp/emacs/bin/emacs
- $EMACS --version - $EMACS --version
dist: trusty
dist: bionic
addons: addons:
apt: apt:
packages: packages:
- texinfo - texinfo
- libgnutls30
script: script:
- make - make
- make test - make test


+ 83
- 0
emacs.d/use-package/NEWS.md View File

@ -1,5 +1,88 @@
# Changes # Changes
## 2.4.1
This is mostly a bug-fix release:
- Update the documentation for :custom as per #850
- Fix broken test due to #850
- better tests
- add test for #845
- Support keymap symbol in bind-key. Fix #845
- use-package-core.el: use the Emacs set-default function to avoid saving :custom vars twice
- Fix Travis
- typo, should be a vector, not a bytecode object
Solves https://github.com/jwiegley/use-package/issues/842
- Add special value back again, in case needed for backwards compat
I don't know why this special value exists, but perhaps old client code uses it.
The additional `t' in the macro expansion is accidental but not harmful I guess.
- Even when there's no :config, run any pre/post config hooks
i.e., following the existing docs for use-package-inject-hooks, these hooks are
run:
use-package--foo--pre-config-hook
use-package--foo--post-config-hook
This should make config customisations more predictable (for example, spacemacs
uses these hooks extensively to allow 'layers' to be customised).
I got rid of the "special" default value for :config, because it doesn't seem to
be treated any differently than nil.
Fixes #785
- Clarify the documentation for :after
- add table of contents to README
- Fix typos
Typos found with codespell.
- Fix typos
- Attempt to explain omit "-hook" better
- Update tests
- Switch from `require' to `load' + `featurep'
- Use `require', not `load', when byte-compiling
- Make custom-face evaluate elisp.
Fix #696.
- Add a line of documentation for (use-pacakage ... :hook).
- Fix typo in README
- Fix documentation for defer
- Add no-query option for pdf-tools-install
- Fix typo in README
- Fix all notes in README
- Mention use-package-ensure in README
Without requiring `use-package-ensure`, setting `use-package-always-ensure`
did not actually work for me.
## 2.4 ## 2.4
### Breaking changes ### Breaking changes


+ 6
- 2
emacs.d/use-package/README.md View File

@ -376,8 +376,12 @@ The documentation string is not mandatory.
**NOTE**: these are only for people who wish to keep customizations with their **NOTE**: these are only for people who wish to keep customizations with their
accompanying use-package declarations. Functionally, the only benefit over accompanying use-package declarations. Functionally, the only benefit over
using `setq` in a `:config` block is that customizations might execute code using `setq` in a `:config` block is that customizations might execute code
when values are assigned. If you currently use `M-x customize-option` and save
to a settings file, you do not want to use this option.
when values are assigned.
**NOTE**: The customized values are **not** saved in the Emacs `custom-file`.
Thus you should either use the `:custom` option **or** you should use `M-x
customize-option` which will save customized values in the Emacs `custom-file`.
Do not use both.
### Customizing faces ### Customizing faces


+ 8
- 5
emacs.d/use-package/bind-key.el View File

@ -154,11 +154,13 @@ spelled-out keystrokes, e.g., \"C-c C-z\". See documentation of
COMMAND must be an interactive function or lambda form. COMMAND must be an interactive function or lambda form.
KEYMAP, if present, should be a keymap and not a quoted symbol.
KEYMAP, if present, should be a keymap variable or symbol.
For example: For example:
(bind-key \"M-h\" #'some-interactive-function my-mode-map) (bind-key \"M-h\" #'some-interactive-function my-mode-map)
(bind-key \"M-h\" #'some-interactive-function 'my-mode-map)
If PREDICATE is non-nil, it is a form evaluated to determine when If PREDICATE is non-nil, it is a form evaluated to determine when
a key should be bound. It must return non-nil in such cases. a key should be bound. It must return non-nil in such cases.
Emacs can evaluate this form at any time that it does redisplay Emacs can evaluate this form at any time that it does redisplay
@ -171,10 +173,11 @@ can safely be called at any time."
`(let* ((,namevar ,key-name) `(let* ((,namevar ,key-name)
(,keyvar (if (vectorp ,namevar) ,namevar (,keyvar (if (vectorp ,namevar) ,namevar
(read-kbd-macro ,namevar))) (read-kbd-macro ,namevar)))
(kmap (if (and ,keymap (symbolp ,keymap)) (symbol-value ,keymap) ,keymap))
(,kdescvar (cons (if (stringp ,namevar) ,namevar (,kdescvar (cons (if (stringp ,namevar) ,namevar
(key-description ,namevar)) (key-description ,namevar))
(quote ,keymap)))
(,bindingvar (lookup-key (or ,keymap global-map) ,keyvar)))
(if (symbolp ,keymap) ,keymap (quote ,keymap))))
(,bindingvar (lookup-key (or kmap global-map) ,keyvar)))
(let ((entry (assoc ,kdescvar personal-keybindings)) (let ((entry (assoc ,kdescvar personal-keybindings))
(details (list ,command (details (list ,command
(unless (numberp ,bindingvar) (unless (numberp ,bindingvar)
@ -183,11 +186,11 @@ can safely be called at any time."
(setcdr entry details) (setcdr entry details)
(add-to-list 'personal-keybindings (cons ,kdescvar details)))) (add-to-list 'personal-keybindings (cons ,kdescvar details))))
,(if predicate ,(if predicate
`(define-key (or ,keymap global-map) ,keyvar
`(define-key (or kmap global-map) ,keyvar
'(menu-item "" nil :filter (lambda (&optional _) '(menu-item "" nil :filter (lambda (&optional _)
(when ,predicate (when ,predicate
,command)))) ,command))))
`(define-key (or ,keymap global-map) ,keyvar ,command)))))
`(define-key (or kmap global-map) ,keyvar ,command)))))
;;;###autoload ;;;###autoload
(defmacro unbind-key (key-name &optional keymap) (defmacro unbind-key (key-name &optional keymap)


+ 2
- 2
emacs.d/use-package/default.mk View File

@ -63,9 +63,9 @@ ELGS =
## Versions ########################################################## ## Versions ##########################################################
VERSION = 2.4
VERSION = 2.4.1
USE_PACKAGE_VERSION = 2.4
USE_PACKAGE_VERSION = 2.4.1
EMACS_VERSION = 24.3 EMACS_VERSION = 24.3


+ 8
- 4
emacs.d/use-package/use-package-core.el View File

@ -6,7 +6,7 @@
;; 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
;; Version: 2.4.1
;; 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
@ -56,7 +56,7 @@
"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"
(defconst use-package-version "2.4.1"
"This version of use-package.") "This version of use-package.")
(defcustom use-package-keywords (defcustom use-package-keywords
@ -1394,7 +1394,9 @@ no keyword implies `:all'."
(comment (nth 2 def))) (comment (nth 2 def)))
(unless (and comment (stringp comment)) (unless (and comment (stringp comment))
(setq comment (format "Customized with use-package %s" name))) (setq comment (format "Customized with use-package %s" name)))
`(customize-set-variable (quote ,variable) ,value ,comment)))
`(funcall (or (get (quote ,variable) 'custom-set) #'set-default)
(quote ,variable)
,value)))
args) args)
(use-package-process-keywords name rest state))) (use-package-process-keywords name rest state)))
@ -1561,7 +1563,9 @@ this file. Usage:
:load-path Add to the `load-path' before attempting to load the package. :load-path Add to the `load-path' before attempting to load the package.
:diminish Support for diminish.el (if installed). :diminish Support for diminish.el (if installed).
:delight Support for delight.el (if installed). :delight Support for delight.el (if installed).
:custom Call `customize-set-variable' with each variable definition.
:custom Call `custom-set' or `set-default' with each variable
definition without modifying the Emacs `custom-file'.
(compare with `custom-set-variables').
:custom-face Call `customize-set-faces' with each face definition. :custom-face Call `customize-set-faces' with each face definition.
:ensure Loads the package using package.el if necessary. :ensure Loads the package using package.el if necessary.
:pin Pin the package to an archive." :pin Pin the package to an archive."


+ 17
- 1
emacs.d/use-package/use-package-tests.el View File

@ -1133,7 +1133,11 @@
(match-expansion (match-expansion
(use-package foo :custom (foo bar)) (use-package foo :custom (foo bar))
`(progn `(progn
(customize-set-variable 'foo bar "Customized with use-package foo")
(funcall
(or
(get 'foo 'custom-set)
(function set-default))
'foo bar)
(require 'foo nil nil)))) (require 'foo nil nil))))
(ert-deftest use-package-test/:custom-face-1 () (ert-deftest use-package-test/:custom-face-1 ()
@ -1936,6 +1940,18 @@
(define-prefix-command 'my/map) (define-prefix-command 'my/map)
(bind-key "<f1>" 'my/map nil nil)))) (bind-key "<f1>" 'my/map nil nil))))
(ert-deftest bind-key/845 ()
(defvar test-map (make-keymap))
(bind-key "<f1>" 'ignore 'test-map)
(should (eq (lookup-key test-map (kbd "<f1>")) 'ignore))
(let ((binding (cl-find "<f1>" personal-keybindings :test 'string= :key 'caar)))
(message "test-map %s" test-map)
(message "binding %s" binding)
(should (eq (cdar binding) 'test-map))
(should (eq (nth 1 binding) 'ignore))
(should (eq (nth 2 binding) nil))))
;; Local Variables: ;; Local Variables:
;; indent-tabs-mode: nil ;; indent-tabs-mode: nil
;; no-byte-compile: t ;; no-byte-compile: t


+ 1
- 1
emacs.d/use-package/use-package.el View File

@ -6,7 +6,7 @@
;; 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
;; Version: 2.4.1
;; 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


+ 2
- 2
emacs.d/use-package/use-package.org View File

@ -11,7 +11,7 @@
#+TEXINFO_DIR_CATEGORY: Emacs #+TEXINFO_DIR_CATEGORY: Emacs
#+TEXINFO_DIR_TITLE: use-package: (use-package). #+TEXINFO_DIR_TITLE: use-package: (use-package).
#+TEXINFO_DIR_DESC: Declarative package configuration for Emacs. #+TEXINFO_DIR_DESC: Declarative package configuration for Emacs.
#+SUBTITLE: for version 2.4
#+SUBTITLE: for version 2.4.1
#+TEXINFO_DEFFN: t #+TEXINFO_DEFFN: t
#+OPTIONS: H:4 num:3 toc:2 creator:t #+OPTIONS: H:4 num:3 toc:2 creator:t
@ -171,7 +171,7 @@ doing so, to make sure you are not using an outdated value for ~load-path~.
should display something like should display something like
#+BEGIN_EXAMPLE #+BEGIN_EXAMPLE
use-package-version’s value is "2.4"
use-package-version’s value is "2.4.1"
#+END_EXAMPLE #+END_EXAMPLE
If you are completely new to use-package then see {{{link-jump(Getting If you are completely new to use-package then see {{{link-jump(Getting


+ 2
- 2
emacs.d/use-package/use-package.texi View File

@ -30,7 +30,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
@subtitle for version 2.4.1
@author John Wiegley @author John Wiegley
@page @page
@vskip 0pt plus 1filll @vskip 0pt plus 1filll
@ -262,7 +262,7 @@ C-h v use-package-version RET
should display something like should display something like
@example @example
use-package-version’s value is "2.4"
use-package-version’s value is "2.4.1"
@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}.


Loading…
Cancel
Save