Commit graph

582 commits

Author SHA1 Message Date
John Lee
f30d5761af 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 https://github.com/jwiegley/use-package/issues/785

Copyright-paperwork-exempt: yes
2020-05-09 23:46:53 +01:00
John Wiegley
8b8522650e Clarify the documentation for :after 2020-03-04 16:29:16 -08:00
Jonas Bernoulli
8c7fa11a3f Fix typos 2019-11-06 13:49:46 +01:00
Radon Rosborough
4c8d5f0b21 Switch from require' to load' + `featurep' 2019-07-15 22:11:13 -07:00
Radon Rosborough
27fd32c47b Use require', not load', when byte-compiling 2019-07-12 08:25:21 -07:00
Justin Talbott
0d720a0f61 update bind-chords to use of eval-after-load when maps declared
also improve :chord keyword syntax processing to more closely mimic bind-keys since the same binding
normalizer is used.

also add tests for use-package-chords to cover these test cases
2019-06-20 11:48:55 -04:00
Justin Talbott
8f1a345b5b rename function 2019-06-14 20:00:16 -04:00
Justin Talbott
8ec41be418 extract use-package-hook-handler-flatten-mode-symbols function 2019-06-14 19:48:25 -04:00
Justin Talbott
4149ec6cfa use use-package-as-one for normalizing :ensure-system-package
This makes the preferred syntax consistent with other `use-package`
keywords. All of these are now valid:

```
(use-package format-all
  :ensure-system-package
  (prettier . "npm i -g prettier")
  (rufo . "gem install rufo"))

(use-package format-all
  :ensure-system-package
  ((prettier . "npm i -g prettier")
   (rufo . "gem install rufo")))

(use-package format-all
  :ensure-system-package
  (prettier . "npm i -g prettier"))
```
2019-06-14 18:50:38 -04:00
Vincent Zhang
c297dfdd20 Make custom-face evaluate elisp
Fix https://github.com/jwiegley/use-package/issues/696.

Copyright-paperwork-exempt: yes
2019-05-29 17:42:19 +08:00
Naoya Yamashita
8fe0ac2983 * use-package-core.el (use-package): fix declare style
use-package specified lisp-indent-function to indent like defun.

Currently, use-package main macro specify indent as (declare (indent 1)),
then change indent mode like defun.

(declare (indent defun)) is same effect.
And it is useful when redefining use-package.
2019-04-14 19:44:54 +09:00
Andrew Stribblehill
95f24f9628 Add a line of documentation for (use-pacakage ... :hook)
Copyright-paperwork-exempt: yes
2019-04-04 11:19:52 +02:00
John Wiegley
7e40a9c424 Merge pull request from conao3/fix_default_value
fix gethash default value for use-package-statistics-time
GitHub-reference: https://github.com/jwiegley/use-package/issues/681
2018-11-19 15:50:27 -08:00
Jonas Bernoulli
fc6fef6869 Silence byte-compiler on Emacs 25
Emacs 25 defined a global variable `features', which triggers a
warning "Lexical argument shadows the dynamic variable features".
That's not `use-package's fault, but we should suppress the warning
anyway, so that there is no additional noise that would cause us to
potentially overlook warnings that absolutely have to be addressed.
2018-11-10 18:52:37 +01:00
John Wiegley
3f96971feb Merge pull request from jwiegley/use-package-chords-suppress-compiler-message
prefix argument with _ to suppress Unused lexical argument warning
GitHub-reference: https://github.com/jwiegley/use-package/issues/713
2018-10-24 16:22:41 -07:00
Laurence Rochfort
ca39ed155f [] Install system packages using system-packages-install
:ensure-system-package was installing packages by running
system-packages-get-command via async-shell-command. This meant that
system-packages-use-sudo wasn't being honoured.

This patch makes :ensure-system-package use system-packages-install
for all cases, except where a custom install command is supplied, in
which case async-shell-command is used.

This issue was introduced in 9f034a0bcf [https://github.com/jwiegley/use-package/issues/673], as a fix for
[https://github.com/jwiegley/use-package/issues/661]. Prior to that commit, system-packages-use-sudo was being
honoured.

This patch also fixes a bug where a cons containing a lone symbol in a
list of conses causes nil to used as the package to install.
GitHub-reference: fix https://github.com/jwiegley/use-package/issues/720
Copyright-paperwork-exempt: yes
2018-09-12 19:12:49 +01:00
Justin Talbott
607879e647 prefix argument with _ to suppress Unused lexical argument warning
per @tarsius’s comment
5d9c854a6c (commitcomment-29996666)
2018-08-13 15:15:42 -04:00
John Wiegley
4a34b41f96 Merge pull request from justbur/autoload-keymap
Correct prefix keys after use-package-autoload-keymap
GitHub-reference: https://github.com/jwiegley/use-package/issues/686
2018-07-15 11:01:24 -07:00
Justin Talbott
2a8c2ffea2 allow :ensure-system-package to check the presence of files at path
closes https://github.com/jwiegley/use-package/issues/660
2018-07-09 17:48:40 -04:00
Russell Black
38dcba6872 Place :chords at beginning of use-package-keywords
When it is at the end, the keys don't get bound until after the package has been loaded, which is bad.  Placing it at the beginning allows the key bindings to be mapped to auto-loaded functions before the package is loaded, so that a key chord press triggers the package load.
2018-06-28 20:40:58 -06:00
John Wiegley
5fb369c968 Merge branch 'master' into patch-1 2018-06-25 12:09:44 -07:00
Alex Branham
bdd7fd3565 Fix use-package-normalize-function 2018-06-13 20:24:09 -05:00
Alex Branham
e2e6f9a44b Enable lexical binding
This supersedes https://github.com/jwiegley/use-package/issues/617 and closes https://github.com/jwiegley/use-package/issues/648
2018-06-13 20:24:09 -05:00
Justin Burkett
c980371f6f Correct prefix keys after use-package-autoload-keymap
By adding events of the form (cons t event) to unread-command-events, Emacs
correctly updates this-command-keys for the subsequent use of the prefix.

Before this change, packages like my which-key were not getting the correct
prefix after use-package-autoload-keymap loaded the relevant package.

See https://github.com/justbur/emacs-which-key/issues/192
2018-06-03 21:38:20 -04:00
Artyom Khramov
f38a100917 Ensure system package cleanup
The function introduced in https://github.com/jwiegley/use-package/issues/673 wasn't declared at compile time, and
it made byte compiler unhappy. Moreover, it was forgotten to remove
redundant compile time variables. Thanks @tarsius for pointing that
out.

This change
* Removes redundant variable declarations
* Adds `system-packages-get-command` function declaration.

Copyright-paperwork-exempt: yes
2018-05-20 00:53:08 +06:00
Naoya Yamashita
db35639457 fix gethash default value for use-package-statistics-time
float-time expect list like (HIGH LOW USEC PSEC)
> HIGH has the most significant bits of the seconds, while LOW has the
> least significant 16 bits.  USEC and PSEC are the microsecond and
> picosecond counts.
by `current-time` in editfns.c
2018-05-19 14:21:26 +09:00
Andrew Schwartzmeyer
d2fec5e5e3 Document that remapping commands is supported with bind-key
Copyright-paperwork-exempt: yes
2018-04-30 09:55:27 -07:00
Artyom Khramov
9f034a0bcf [] ensure-system-package: honor system-packages customizations
ensure-system-package doesn't honor system-packages
customizations (https://github.com/jwiegley/use-package/issues/661), because system-packages didn't provide an API
to retrieve shell command to be executed.

This change makes use of the new system-packages'
`system-package-get-command` function and therefore fixes the issue.
GitHub-reference: fix https://github.com/jwiegley/use-package/issues/661
Copyright-paperwork-exempt: yes
2018-04-26 03:01:19 +06:00
Russell Black
dc83e2f035 Update use-package-chords.el 2018-03-23 22:04:48 -06:00
Russell Black
c9f6cae603 Update use-package-chords.el
new style of auto-deferral for chords
2018-03-23 21:46:36 -06:00
Justin Talbott
e5d3826b62 :ensure-system-package allow cdr of cons to be a package name symbol
closes https://github.com/jwiegley/use-package/issues/652
2018-03-16 12:29:20 -04:00
Damien Cassou
69a561b86b Fix compile-time warnings due to the statistics-reporting code
The code worked because the file is using dynamic binding.
2018-03-12 08:42:16 +01:00
Damien Cassou
2a47998844 Add missing require
This is used for `hash-table-keys`.

Fix https://github.com/jwiegley/use-package/issues/644.
2018-03-12 08:42:16 +01:00
John Wiegley
cba5a11368 Revert "Fix report" 2018-03-11 21:37:02 -07:00
Damien Cassou
b28efb4847 Fix compile-time warnings due to the statistics-reporting code
The code worked because the file is using dynamic binding.
2018-03-11 13:24:08 +01:00
Damien Cassou
bce655f616 Add missing require
This is used for `hash-table-keys`.

Fix https://github.com/jwiegley/use-package/issues/644.
2018-03-11 13:23:49 +01:00
Damien Cassou
ae22d74a16 Use a tabulated-list to display package configuration statistics
Fix https://github.com/jwiegley/use-package/issues/641
2018-03-08 21:00:31 +01:00
Matthew Justin Bauer
2250f89ac0 Support ":package" in use-package
bind-key supports the keyword ":package" but use-package does not know that. Adding this should be helpful. In the future, maybe we could automatically fill in with the use-package package, but that could be a breaking change.
2018-02-25 15:03:43 -06:00
Justin Burkett
46503b194c Fix usage of plist argument in use-package-normalize-plist
Previously the argument was never used.
2018-02-06 12:48:51 -05:00
Justin Burkett
09266283b9 Add use-package-ignore-unknown-keywords option
This option allows use-package to skip over keywords it doesn't recognize.
2018-02-06 11:42:06 -05:00
John Wiegley
ab918196fa Revert "Merge pull request from jabranham/lexical-bindings"
This reverts commit d21787f1d6, reversing
changes made to fd8a3510fd.
GitHub-reference: https://github.com/jwiegley/use-package/issues/617
2018-01-27 14:13:48 -08:00
John Wiegley
566a2ea3a1 Revert "Move variable bindings to the bottom of each file"
This reverts commit c29193bf07.
2018-01-27 14:09:10 -08:00
John Wiegley
c29193bf07 Move variable bindings to the bottom of each file 2018-01-27 14:07:11 -08:00
Alex Branham
109167e8f5 Don't remove sharp quotes 2018-01-27 15:17:26 -06:00
Alex Branham
4c3abcf4eb Fix byte compiler warnings 2018-01-27 10:19:42 -06:00
Alex Branham
88bcb8b96d Use lexical bindings and remove cl package 2018-01-27 10:01:10 -06:00
Alex Branham
b7252f8e63 lexical binding 2018-01-26 22:37:47 -06:00
Alex Branham
46ee100327 Prefer non-obsolete var names 2018-01-26 22:37:31 -06:00
Alex Branham
8a6430835f Prefer org-table-align to orgtbl-ctrl-c-ctrl-c
org-table-align is an autoloaded function so the byte compiler can
find it. orgtbl-ctrl-c-ctrl-c isn't so we get a warning about
undefined functions.
2018-01-08 19:21:46 -06:00
John Wiegley
13a9e339f2 Merge pull request from justbur/elisp-cap
Handle automatic macro expansion by elisp-completion-at-point
GitHub-reference: https://github.com/jwiegley/use-package/issues/599
2017-12-26 11:04:41 -08:00