Commit graph

611 commits

Author SHA1 Message Date
Noam Postavsky
91b439c8e7 personal-keybindings: add docstring
fix typo in bind-key docstring
2014-05-31 15:03:58 -04:00
Alex Kost
c4ebcaa953 Add bind-keys* macro 2014-05-25 17:33:20 +04:00
Thomas Frössman
1c82b2377f Don't abort compiling if package loading fails 2014-05-17 10:48:20 +02:00
John Wiegley
a4939e7ef3 Revert "Merge pull request from alexko/master"
This reverts commit 8c04377608, reversing
changes made to a9ba368fa7.
GitHub-reference: https://github.com/jwiegley/use-package/issues/104
2014-05-08 13:25:39 -05:00
John Wiegley
8c04377608 Merge pull request from alexko/master
if package can't be located, treat it the same way as disabled
GitHub-reference: https://github.com/jwiegley/use-package/issues/104
2014-05-07 12:24:10 -05:00
Alex Kosorukoff
6d02a320f6 if package can't be located, treat it the same way as disabled
There will be a message "Unable to locate <package-name>" in the log.
2014-05-06 20:38:14 -07:00
Nicolas Richard
4e80d29daf Eval backquote earlier and support non-`progn' lists
* use-package.el (use-package-plist-get): add optional args: `eval-backquote'
  and `no-progn' to control how arguments are retrieved.
  (use-package-plist-get-value): remove this function
  (use-package): replace calls to old function to modified function.

Fixes issue https://github.com/jwiegley/use-package/issues/94.

Rationale :
- use-package-plist-get-value was just another layer for no good reason,
  and IMO its name was totally unclear.
- we now eval-as-backquote earlier, allowing constructs like:
(let ((my-list-of-commands-in-foo '(foo1 foo2)))
  (use-package foo :commands ,@my-list-of-commands-in-foo))
2014-05-05 12:14:53 +02:00
Nicolas Richard
9ca3690b59 * bind-key.el (bind-key): don't eval key-name at macro expansion time 2014-04-14 19:59:01 +02:00
Noam Postavsky
01196c81ac bind-keys: bind directly to prefix-map
instead of constructing equivalent key sequence by string concatenation.
This allows specifying vector key sequences, as in bind-key (since
f0776c2aeb).
2014-04-14 00:03:36 -04:00
Noam Postavsky
869ff53ab9 bind-keys: ,@(when map (list map)) => map
Omitting map is same as passing nil.
2014-04-14 00:03:35 -04:00
Noam Postavsky
053a1514a1 fix typo
Actually the reader accepts (list 'a'b) = (list 'a 'b); it still looks
wrong.
2014-04-14 00:02:48 -04:00
Nicolas Richard
0ab0d77691 Add new option use-package-idle-interval
* use-package.el (use-package-idle-interval): new defcustom
(use-package-start-idle-timer): use it
(use-package-idle-eval): use it
* README.md: document it

This addresses bug https://github.com/jwiegley/use-package/issues/77
2014-03-17 16:22:43 +01:00
François Févotte
6b30c15823 :idle-priority keyword to change the running order of idle functions
Lower-priority idle functions are run first. Idle functions with no
specified priority default to 5 and all functions with the same priority
are run in the order in which they are evaluated, meaning the behaviour
is backwards compatible.

Updated documentation as well.
2014-03-17 10:03:06 +01:00
Jonas Bernoulli
f32d24350c use-package-font-lock-keywords: add use-package-with-elapsed-timer 2014-03-09 18:59:06 +01:00
Jonas Bernoulli
2d7ecd867a use-package-with-elapsed-timer: add declare indent rule 2014-03-09 18:55:54 +01:00
Jonas Bernoulli
ea3a475d0b use-package-with-elapsed-timer: respect option at runtime
Previously the option `use-package-verbose' was consulted at macro
expansion time, and as a result customizing the option did nothing,
without also recompiling `use-package.el'.
2014-03-09 18:53:05 +01:00
Noam Postavsky
f0776c2aeb let bind-key accept vectors, add docstring 2014-03-01 22:05:56 -05:00
John Wiegley
0f7d54d1db Merge pull request from Fuco1/variable-col-width
Add variable column width
GitHub-reference: https://github.com/jwiegley/use-package/issues/90
2014-02-18 16:36:18 -06:00
Matus Goljer
38d4d2e2da Add variable column width 2014-02-18 13:52:25 +01:00
Matus Goljer
f90d65e149 Add better descriptions for lambdas, closures, keymaps 2014-02-18 13:40:25 +01:00
John Wiegley
aec1268960 Merge pull request from Fuco1/bind-keys
Add `bind-keys` macro
GitHub-reference: https://github.com/jwiegley/use-package/issues/87
2014-02-16 23:04:18 -06:00
Matus Goljer
7d0779114e Add bind-keys macro 2014-02-13 12:55:17 +01:00
Nicolas Richard
dd937c4e36 Move tests to separate file 2014-02-12 22:30:12 +01:00
Nicolas Richard
2676ff5d95 Allow multiple forms after keywords
* use-package.el (use-package-mplist-get):
(use-package-plist-get):
(use-package-mplist-keys): new functions

(plist-get-value):
(use-package): use new functions

(plist-keys): remove function

The idea is to allow a modified kind of plist where keys are all
keywords that appear in the list, and values are the intermediary
elements. If a keyword is present but it's another keyword just after it
(like (use-package :defer :config (setq foo 'bar))), its associated
value will be t. If a keyword is not present, its value associated value
will be nil. Otherwise the value will be the list of elements between
the keyword and the next keyword.
2014-02-10 18:57:27 +01:00
Adam Spiers
58ca076647 stop describe-personal-keybindings adding trailing space
When emacs is configured to highlight trailing whitespace,
the *Personal Keybindings* buffer looked pretty ugly.
This fixes that.
2014-02-05 16:19:56 +00:00
Adam Spiers
21cabfd334 fix bind-key URL (fixes)
Also makes a start on https://github.com/jwiegley/use-package/issues/32.
GitHub-reference: https://github.com/jwiegley/use-package/issues/58
2014-01-06 17:24:30 +00:00
Adam Spiers
8f7e878caf add 'use-package-' prefix to 'with-elapsed-timer'
Fixes https://github.com/jwiegley/use-package/issues/35.
2014-01-06 17:22:39 +00:00
John Wiegley
283653ff4b Merge pull request from aspiers/hyperlink-all-bindings
hyperlink functions in Comments column
GitHub-reference: https://github.com/jwiegley/use-package/issues/76
2014-01-06 08:49:52 -08:00
Adam Spiers
2dbee4cd75 fix DRY violation by only having documentation in one place
The documentation in README.md was previously identical to that
in the Commentary section of use-package.el, modulo the following
differences:

  - No elisp comment ";; " prefix
  - Code blocks indented 4 columns not 2, as required by Markdown
  - Elisp symbols marked in backtick delimiters for monospace, not
    emacs backtick/forward tick pairs.

Unfortunately due to this duplication, sometimes only one of the
two files got updated, so they got out of sync.  With us all being
human, this is likely to continue to happen as long as the
duplication exists ;-)  Therefore since most users are likely to
encounter README.md before the elisp, and bearing in mind that
Markdown is a much more flexible format for documentation than
elisp comments (richer formatting, can be exported to numerous
other formats etc.), it is better to replace the docs in
use-package.el with a pointer to the README.md.
2014-01-06 13:57:55 +00:00
Adam Spiers
984850be80 hyperlink functions in Comments column
Previously, only the functions in the Command column were hyper-linked.
Also clarify the meaning of the "was" entries in the Comments column.
2014-01-04 13:00:23 +00:00
Adam Spiers
75206228dd allow :mode and :interpreter to accept a string
Fixes https://github.com/jwiegley/use-package/issues/72.
2013-12-16 13:57:32 +00:00
Jonas Bernoulli
d588d0b382 use-package: use defun as lisp-indent-function
When `use-package' is called with only one keyword it is useful to
write:

(use-package foo :init
  (progn
    ... long lines ...))

instead of

(use-package foo
  :init (progn
  	  ... *too* long lines ...))

or

(use-package foo
  :init
  (progn
    ... long lines ...))

Even when there are multiple keywords or when one never wants to format
the calls to `use-package' as in the first example the use of `defun'
does not really pose a problem.
2013-12-10 00:44:11 +01:00
John Wiegley
c3704ac36e Add a :demand directive, to override deferred loading ()
GitHub-reference: https://github.com/jwiegley/use-package/issues/65
2013-12-04 19:44:09 -06:00
John Wiegley
9d395a4019 fboundp is a function, not a variable
Fixes https://github.com/jwiegley/use-package/issues/68
2013-12-04 13:31:25 -06:00
Dave Abrahams
f3e9e871a6 Backward compatibility with emacs-22.1
This change supports the emacs that ships with MacOS X, the last version not encumbered by GPLv3.
2013-12-02 10:44:28 -08:00
John Wiegley
90ca8adc41 Default use-package-verbose to nil 2013-12-02 03:06:27 -07:00
Philippe Vaucher
c7560f7be7 Remove el-get support 2013-11-05 10:32:21 +01:00
Ting-Yu Lin
36cf13ef47 Add :pre-load to use-package-keywords
The :pre-load keyword cannot be used unless it is in
`use-package-keywords' list.
2013-10-26 00:11:31 +08:00
Phil Hudson
a116fc2136 Properly enable runtime dependency for :idle stanza (issue)
See issue https://github.com/jwiegley/use-package/issues/60.
GitHub-reference: https://github.com/jwiegley/use-package/issues/60
2013-10-15 17:53:58 +01:00
Noam Postavsky
94072fba77 remove extra comma (added by 026c46c) 2013-10-14 12:59:41 -04:00
Noam Postavsky
026c46c057 let with-elapsed-timer return last form 2013-10-12 14:26:50 -04:00
Noam Postavsky
3d871c7994 make `with-elapsed-timer' hygienic 2013-10-12 14:26:50 -04:00
Noam Postavsky
61fd933807 with-elapsed-timer: only check verbosity once 2013-10-12 14:26:50 -04:00
Noam Postavsky
9921a76e86 remove after-init-hook for override-global-mode
The INIT-VALUE argument to define-minor-mode is t, so it's enabled by
default.
2013-10-12 14:25:49 -04:00
Noam Postavsky
29abf59bad macroexpand not needed
Since lambda thunking replaced quoting in a76d167.

To see why, observe that cases 3 and 4 disassemble to identical code.
The difference between cases 1 and 2 shows why the macroexpand was
needed originally.

(defmacro test-quote (name-string)
  `(eval-after-load "foo"
     `(with-elapsed-timer ,(format "Configuring package %s" name-string)
        (message "test-quote"))))

(defmacro test-expand-quote (name-string)
  `(eval-after-load "foo"
     ,(macroexpand-all
       `(with-elapsed-timer ,(format "Configuring package %s" name-string)
          (message "test-expand-quote")))))

(defmacro test-lambda (name-string)
  `(eval-after-load "foo"
     `(,(lambda ()
          (with-elapsed-timer ,(format "Configuring package %s" name-string)
            (message "test-lambda"))))))

(defmacro test-expand-lambda (name-string)
  `(eval-after-load "foo"
     `(,(lambda ()
          ,(macroexpand-all
            `(with-elapsed-timer ,(format "Configuring package %s" name-string)
               (message "test-lambda")))))))

(disassemble (lambda () (test-quote "testing...")))
(disassemble (lambda () (test-expand-quote "testing...")))
(disassemble (lambda () (test-lambda "testing...")))
(disassemble (lambda () (test-expand-lambda "testing...")))
2013-10-12 14:25:38 -04:00
Noam Postavsky
119a30f2ba cl not needed since flet was removed in 82903da 2013-10-12 13:14:21 -04:00
John Wiegley
901272a8c7 Merge pull request from phillord/first-keyword
Add a ":first" keyword for those occasions that it's necessary.
GitHub-reference: https://github.com/jwiegley/use-package/issues/42
2013-10-07 14:28:30 -07:00
Noam Postavsky
8c1c572857 use plist-get-value for all non-sexp args 2013-09-25 22:44:01 -04:00
Noam Postavsky
dd20db220d plist-get-value treats arg as backquoted
This allows use of variables or even arbitrary expressions to construct
use-package arguments:

(use-package some-package
  :mode ,mode-spec
  :bind (,binding
         ,@more-bindings
         ,@(cl-loop for i from ?a to ?z
                    collect `(,(string i) . nifty-function))))
2013-09-25 22:36:10 -04:00
Nicolas Dudebout
818c78f466 Removes plist-get-sexp
This function was not working as advertised.
Then `funcall` was evaluated too early and all the benefits of late evaluation for autoloads was lost.
Furthermore, this function was not really needed in the first place:

```
(use-package foo
  :config my-foo-function)
```

can easily be replaced by the following:

```
(use-package foo
  :config (my-foo-function))
```
2013-09-25 14:02:29 -04:00