Do not include a local copy of use-package anymore
This requires Emacs 29.1 and later.
This commit is contained in:
parent
2f6aa6a1f7
commit
5caa7227f0
|
@ -10,7 +10,6 @@
|
||||||
/elpa/*
|
/elpa/*
|
||||||
!/elpa/diminish-[0-9]*
|
!/elpa/diminish-[0-9]*
|
||||||
!/elpa/bind-key-[0-9]*
|
!/elpa/bind-key-[0-9]*
|
||||||
!/elpa/use-package-[0-9]*
|
|
||||||
!/elpa/dash-[0-9]*
|
!/elpa/dash-[0-9]*
|
||||||
!/elpa/hydra-[0-9]*
|
!/elpa/hydra-[0-9]*
|
||||||
!/elpa/page-break-lines-[0-9]*
|
!/elpa/page-break-lines-[0-9]*
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
My personal Emacs Configuration, containing bits of code collected from around
|
My personal Emacs Configuration, containing bits of code collected from around
|
||||||
the web. Have fun with it!
|
the web. Have fun with it!
|
||||||
|
|
||||||
This configuration is known to work with Emacs 25.2 (and later) on
|
This configuration is known to work with Emacs 29.1 (and later) on
|
||||||
Debian GNU/Linux and Windows 10 (sigh).
|
Debian GNU/Linux and Windows 11 (sigh).
|
||||||
|
|
||||||
* Features
|
* Features
|
||||||
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
This is the file .../info/dir, which contains the
|
|
||||||
topmost node of the Info hierarchy, called (dir)Top.
|
|
||||||
The first time you invoke Info you start off looking at this node.
|
|
||||||
|
|
||||||
File: dir, Node: Top This is the top of the INFO tree
|
|
||||||
|
|
||||||
This (the Directory node) gives a menu of major topics.
|
|
||||||
Typing "q" exits, "H" lists all Info commands, "d" returns here,
|
|
||||||
"h" gives a primer for first-timers,
|
|
||||||
"mEmacs<Return>" visits the Emacs manual, etc.
|
|
||||||
|
|
||||||
In Emacs, you can click mouse button 2 on a menu item or cross reference
|
|
||||||
to select it.
|
|
||||||
|
|
||||||
* Menu:
|
|
||||||
|
|
||||||
Emacs
|
|
||||||
* use-package: (use-package). Declarative package configuration for Emacs.
|
|
|
@ -1,191 +0,0 @@
|
||||||
;;; use-package-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*-
|
|
||||||
;; Generated by the `loaddefs-generate' function.
|
|
||||||
|
|
||||||
;; This file is part of GNU Emacs.
|
|
||||||
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path)))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;; Generated autoloads from use-package-bind-key.el
|
|
||||||
|
|
||||||
(autoload 'use-package-autoload-keymap "use-package-bind-key" "\
|
|
||||||
Loads PACKAGE and then binds the key sequence used to invoke
|
|
||||||
this function to KEYMAP-SYMBOL. It then simulates pressing the
|
|
||||||
same key sequence a again, so that the next key pressed is routed
|
|
||||||
to the newly loaded keymap.
|
|
||||||
|
|
||||||
This function supports use-package's :bind-keymap keyword. It
|
|
||||||
works by binding the given key sequence to an invocation of this
|
|
||||||
function for a particular keymap. The keymap is expected to be
|
|
||||||
defined by the package. In this way, loading the package is
|
|
||||||
deferred until the prefix key sequence is pressed.
|
|
||||||
|
|
||||||
(fn KEYMAP-SYMBOL PACKAGE OVERRIDE)")
|
|
||||||
(autoload 'use-package-normalize-binder "use-package-bind-key" "\
|
|
||||||
|
|
||||||
|
|
||||||
(fn NAME KEYWORD ARGS)")
|
|
||||||
(defalias 'use-package-normalize/:bind 'use-package-normalize-binder)
|
|
||||||
(defalias 'use-package-normalize/:bind* 'use-package-normalize-binder)
|
|
||||||
(defalias 'use-package-autoloads/:bind 'use-package-autoloads-mode)
|
|
||||||
(defalias 'use-package-autoloads/:bind* 'use-package-autoloads-mode)
|
|
||||||
(autoload 'use-package-handler/:bind "use-package-bind-key" "\
|
|
||||||
|
|
||||||
|
|
||||||
(fn NAME KEYWORD ARGS REST STATE &optional BIND-MACRO)")
|
|
||||||
(defalias 'use-package-normalize/:bind-keymap 'use-package-normalize-binder)
|
|
||||||
(defalias 'use-package-normalize/:bind-keymap* 'use-package-normalize-binder)
|
|
||||||
(autoload 'use-package-handler/:bind-keymap "use-package-bind-key" "\
|
|
||||||
|
|
||||||
|
|
||||||
(fn NAME KEYWORD ARGS REST STATE &optional OVERRIDE)")
|
|
||||||
(autoload 'use-package-handler/:bind-keymap* "use-package-bind-key" "\
|
|
||||||
|
|
||||||
|
|
||||||
(fn NAME KEYWORD ARG REST STATE)")
|
|
||||||
(register-definition-prefixes "use-package-bind-key" '("use-package-handler/:bind*"))
|
|
||||||
|
|
||||||
|
|
||||||
;;; Generated autoloads from use-package-core.el
|
|
||||||
|
|
||||||
(autoload 'use-package "use-package-core" "\
|
|
||||||
Declare an Emacs package by specifying a group of configuration options.
|
|
||||||
|
|
||||||
For full documentation, please see the README file that came with
|
|
||||||
this file. Usage:
|
|
||||||
|
|
||||||
(use-package package-name
|
|
||||||
[:keyword [option]]...)
|
|
||||||
|
|
||||||
:init Code to run before PACKAGE-NAME has been loaded.
|
|
||||||
:config Code to run after PACKAGE-NAME has been loaded. Note that
|
|
||||||
if loading is deferred for any reason, this code does not
|
|
||||||
execute until the lazy load has occurred.
|
|
||||||
:preface Code to be run before everything except `:disabled'; this
|
|
||||||
can be used to define functions for use in `:if', or that
|
|
||||||
should be seen by the byte-compiler.
|
|
||||||
|
|
||||||
:mode Form to be added to `auto-mode-alist'.
|
|
||||||
:magic Form to be added to `magic-mode-alist'.
|
|
||||||
:magic-fallback Form to be added to `magic-fallback-mode-alist'.
|
|
||||||
:interpreter Form to be added to `interpreter-mode-alist'.
|
|
||||||
|
|
||||||
:commands Define autoloads for commands that will be defined by the
|
|
||||||
package. This is useful if the package is being lazily
|
|
||||||
loaded, and you wish to conditionally call functions in your
|
|
||||||
`: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.
|
|
||||||
|
|
||||||
:bind Bind keys, and define autoloads for the bound commands.
|
|
||||||
:bind* Bind keys, and define autoloads for the bound commands,
|
|
||||||
*overriding all minor mode bindings*.
|
|
||||||
:bind-keymap Bind a key prefix to an auto-loaded keymap defined in the
|
|
||||||
package. This is like `:bind', but for keymaps.
|
|
||||||
:bind-keymap* Like `:bind-keymap', but overrides all minor mode bindings
|
|
||||||
|
|
||||||
:defer Defer loading of a package -- this is implied when using
|
|
||||||
`:commands', `:bind', `:bind*', `:mode', `:magic', `:hook',
|
|
||||||
`:magic-fallback', or `:interpreter'. This can be an integer,
|
|
||||||
to force loading after N seconds of idle time, if the package
|
|
||||||
has not already been loaded.
|
|
||||||
:after Delay the use-package declaration until after the named modules
|
|
||||||
have loaded. Once load, it will be as though the use-package
|
|
||||||
declaration (without `:after') had been seen at that moment.
|
|
||||||
:demand Prevent the automatic deferred loading introduced by constructs
|
|
||||||
such as `:bind' (see `:defer' for the complete list).
|
|
||||||
|
|
||||||
:if EXPR Initialize and load only if EXPR evaluates to a non-nil value.
|
|
||||||
:disabled The package is ignored completely if this keyword is present.
|
|
||||||
:defines Declare certain variables to silence the byte-compiler.
|
|
||||||
:functions Declare certain functions to silence the byte-compiler.
|
|
||||||
:load-path Add to the `load-path' before attempting to load the package.
|
|
||||||
:diminish Support for diminish.el (if installed).
|
|
||||||
:delight Support for delight.el (if installed).
|
|
||||||
: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 `custom-set-faces' with each face definition.
|
|
||||||
:ensure Loads the package using package.el if necessary.
|
|
||||||
:pin Pin the package to an archive.
|
|
||||||
|
|
||||||
(fn NAME &rest ARGS)" nil t)
|
|
||||||
(function-put 'use-package 'lisp-indent-function 'defun)
|
|
||||||
(register-definition-prefixes "use-package-core" '("use-package-"))
|
|
||||||
|
|
||||||
|
|
||||||
;;; Generated autoloads from use-package-delight.el
|
|
||||||
|
|
||||||
(autoload 'use-package-normalize/:delight "use-package-delight" "\
|
|
||||||
Normalize arguments to delight.
|
|
||||||
|
|
||||||
(fn NAME KEYWORD ARGS)")
|
|
||||||
(autoload 'use-package-handler/:delight "use-package-delight" "\
|
|
||||||
|
|
||||||
|
|
||||||
(fn NAME KEYWORD ARGS REST STATE)")
|
|
||||||
(register-definition-prefixes "use-package-delight" '("use-package-normalize-delight"))
|
|
||||||
|
|
||||||
|
|
||||||
;;; Generated autoloads from use-package-diminish.el
|
|
||||||
|
|
||||||
(autoload 'use-package-normalize/:diminish "use-package-diminish" "\
|
|
||||||
|
|
||||||
|
|
||||||
(fn NAME KEYWORD ARGS)")
|
|
||||||
(autoload 'use-package-handler/:diminish "use-package-diminish" "\
|
|
||||||
|
|
||||||
|
|
||||||
(fn NAME KEYWORD ARG REST STATE)")
|
|
||||||
(register-definition-prefixes "use-package-diminish" '("use-package-normalize-diminish"))
|
|
||||||
|
|
||||||
|
|
||||||
;;; Generated autoloads from use-package-ensure.el
|
|
||||||
|
|
||||||
(autoload 'use-package-normalize/:ensure "use-package-ensure" "\
|
|
||||||
|
|
||||||
|
|
||||||
(fn NAME KEYWORD ARGS)")
|
|
||||||
(autoload 'use-package-handler/:ensure "use-package-ensure" "\
|
|
||||||
|
|
||||||
|
|
||||||
(fn NAME KEYWORD ENSURE REST STATE)")
|
|
||||||
(register-definition-prefixes "use-package-ensure" '("use-package-"))
|
|
||||||
|
|
||||||
|
|
||||||
;;; Generated autoloads from use-package-jump.el
|
|
||||||
|
|
||||||
(autoload 'use-package-jump-to-package-form "use-package-jump" "\
|
|
||||||
Attempt to find and jump to the `use-package' form that loaded PACKAGE.
|
|
||||||
This will only find the form if that form actually required
|
|
||||||
PACKAGE. If PACKAGE was previously required then this function
|
|
||||||
will jump to the file that originally required PACKAGE instead.
|
|
||||||
|
|
||||||
(fn PACKAGE)" t)
|
|
||||||
(register-definition-prefixes "use-package-jump" '("use-package-find-require"))
|
|
||||||
|
|
||||||
|
|
||||||
;;; Generated autoloads from use-package-lint.el
|
|
||||||
|
|
||||||
(autoload 'use-package-lint "use-package-lint" "\
|
|
||||||
Check for errors in `use-package' declarations.
|
|
||||||
For example, if the module's `:if' condition is met, but even
|
|
||||||
with the specified `:load-path' the module cannot be found." t)
|
|
||||||
(register-definition-prefixes "use-package-lint" '("use-package-lint-declaration"))
|
|
||||||
|
|
||||||
;;; End of scraped data
|
|
||||||
|
|
||||||
(provide 'use-package-autoloads)
|
|
||||||
|
|
||||||
;; Local Variables:
|
|
||||||
;; version-control: never
|
|
||||||
;; no-byte-compile: t
|
|
||||||
;; no-update-autoloads: t
|
|
||||||
;; no-native-compile: t
|
|
||||||
;; coding: utf-8-emacs-unix
|
|
||||||
;; End:
|
|
||||||
|
|
||||||
;;; use-package-autoloads.el ends here
|
|
|
@ -1,171 +0,0 @@
|
||||||
;;; use-package-bind-key.el --- Support for the :bind/:bind-keymap keywords -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
;; Author: John Wiegley <johnw@newartisans.com>
|
|
||||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
|
||||||
;; it under the terms of the GNU General Public License as published by
|
|
||||||
;; the Free Software Foundation, either version 3 of the License, or
|
|
||||||
;; (at your option) any later version.
|
|
||||||
|
|
||||||
;; This program is distributed in the hope that it will be useful,
|
|
||||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
;; GNU General Public License for more details.
|
|
||||||
|
|
||||||
;; You should have received a copy of the GNU General Public License
|
|
||||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
;;; Commentary:
|
|
||||||
|
|
||||||
;; Provides support for the :bind, :bind*, :bind-keymap and :bind-keymap*
|
|
||||||
;; keywords. Note that these are currently still baked into
|
|
||||||
;; `use-package-keywords' and `use-package-deferring-keywords', although this
|
|
||||||
;; is harmless if they are never used.
|
|
||||||
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
(require 'use-package-core)
|
|
||||||
(require 'bind-key)
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun use-package-autoload-keymap (keymap-symbol package override)
|
|
||||||
"Loads PACKAGE and then binds the key sequence used to invoke
|
|
||||||
this function to KEYMAP-SYMBOL. It then simulates pressing the
|
|
||||||
same key sequence a again, so that the next key pressed is routed
|
|
||||||
to the newly loaded keymap.
|
|
||||||
|
|
||||||
This function supports use-package's :bind-keymap keyword. It
|
|
||||||
works by binding the given key sequence to an invocation of this
|
|
||||||
function for a particular keymap. The keymap is expected to be
|
|
||||||
defined by the package. In this way, loading the package is
|
|
||||||
deferred until the prefix key sequence is pressed."
|
|
||||||
(if (not (require package nil t))
|
|
||||||
(use-package-error (format "Cannot load package.el: %s" package))
|
|
||||||
(if (and (boundp keymap-symbol)
|
|
||||||
(keymapp (symbol-value keymap-symbol)))
|
|
||||||
(let* ((kv (this-command-keys-vector))
|
|
||||||
(key (key-description kv))
|
|
||||||
(keymap (symbol-value keymap-symbol)))
|
|
||||||
(if override
|
|
||||||
(bind-key* key keymap)
|
|
||||||
(bind-key key keymap))
|
|
||||||
(setq unread-command-events
|
|
||||||
(mapcar (lambda (ev) (cons t ev))
|
|
||||||
(listify-key-sequence kv))))
|
|
||||||
(use-package-error
|
|
||||||
(format "package.el %s failed to define keymap %s"
|
|
||||||
package keymap-symbol)))))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun use-package-normalize-binder (name keyword args)
|
|
||||||
(let ((arg args)
|
|
||||||
args*)
|
|
||||||
(while arg
|
|
||||||
(let ((x (car arg)))
|
|
||||||
(cond
|
|
||||||
;; (KEY . COMMAND)
|
|
||||||
((and (consp x)
|
|
||||||
(or (stringp (car x))
|
|
||||||
(vectorp (car x)))
|
|
||||||
(or (use-package-recognize-function (cdr x) t #'stringp)))
|
|
||||||
(setq args* (nconc args* (list x)))
|
|
||||||
(setq arg (cdr arg)))
|
|
||||||
;; KEYWORD
|
|
||||||
;; :map KEYMAP
|
|
||||||
;; :prefix-docstring STRING
|
|
||||||
;; :prefix-map SYMBOL
|
|
||||||
;; :prefix STRING
|
|
||||||
;; :repeat-docstring STRING
|
|
||||||
;; :repeat-map SYMBOL
|
|
||||||
;; :filter SEXP
|
|
||||||
;; :menu-name STRING
|
|
||||||
;; :package SYMBOL
|
|
||||||
;; :continue and :exit are used within :repeat-map
|
|
||||||
((or (and (eq x :map) (symbolp (cadr arg)))
|
|
||||||
(and (eq x :prefix) (stringp (cadr arg)))
|
|
||||||
(and (eq x :prefix-map) (symbolp (cadr arg)))
|
|
||||||
(and (eq x :prefix-docstring) (stringp (cadr arg)))
|
|
||||||
(and (eq x :repeat-map) (symbolp (cadr arg)))
|
|
||||||
(eq x :continue)
|
|
||||||
(eq x :exit)
|
|
||||||
(and (eq x :repeat-docstring) (stringp (cadr arg)))
|
|
||||||
(eq x :filter)
|
|
||||||
(and (eq x :menu-name) (stringp (cadr arg)))
|
|
||||||
(and (eq x :package) (symbolp (cadr arg))))
|
|
||||||
(setq args* (nconc args* (list x (cadr arg))))
|
|
||||||
(setq arg (cddr arg)))
|
|
||||||
((listp x)
|
|
||||||
(setq args*
|
|
||||||
(nconc args* (use-package-normalize-binder name keyword x)))
|
|
||||||
(setq arg (cdr arg)))
|
|
||||||
(t
|
|
||||||
;; Error!
|
|
||||||
(use-package-error
|
|
||||||
(concat (symbol-name name)
|
|
||||||
" wants arguments acceptable to the `bind-keys' macro,"
|
|
||||||
" or a list of such values"))))))
|
|
||||||
args*))
|
|
||||||
|
|
||||||
;;;; :bind, :bind*
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defalias 'use-package-normalize/:bind 'use-package-normalize-binder)
|
|
||||||
;;;###autoload
|
|
||||||
(defalias 'use-package-normalize/:bind* 'use-package-normalize-binder)
|
|
||||||
|
|
||||||
;; jww (2017-12-07): This is too simplistic. It will fail to determine
|
|
||||||
;; autoloads in this situation:
|
|
||||||
;; (use-package foo
|
|
||||||
;; :bind (:map foo-map (("C-a" . func))))
|
|
||||||
;;;###autoload
|
|
||||||
(defalias 'use-package-autoloads/:bind 'use-package-autoloads-mode)
|
|
||||||
;;;###autoload
|
|
||||||
(defalias 'use-package-autoloads/:bind* 'use-package-autoloads-mode)
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun use-package-handler/:bind
|
|
||||||
(name _keyword args rest state &optional bind-macro)
|
|
||||||
(use-package-concat
|
|
||||||
(use-package-process-keywords name rest state)
|
|
||||||
`(,@(mapcar
|
|
||||||
#'(lambda (xs)
|
|
||||||
`(,(if bind-macro bind-macro 'bind-keys)
|
|
||||||
:package ,name ,@(use-package-normalize-commands xs)))
|
|
||||||
(use-package-split-list-at-keys :break args)))))
|
|
||||||
|
|
||||||
(defun use-package-handler/:bind* (name keyword arg rest state)
|
|
||||||
(use-package-handler/:bind name keyword arg rest state 'bind-keys*))
|
|
||||||
|
|
||||||
;;;; :bind-keymap, :bind-keymap*
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defalias 'use-package-normalize/:bind-keymap 'use-package-normalize-binder)
|
|
||||||
;;;###autoload
|
|
||||||
(defalias 'use-package-normalize/:bind-keymap* 'use-package-normalize-binder)
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun use-package-handler/:bind-keymap
|
|
||||||
(name _keyword args rest state &optional override)
|
|
||||||
(use-package-concat
|
|
||||||
(use-package-process-keywords name rest state)
|
|
||||||
(mapcar
|
|
||||||
#'(lambda (binding)
|
|
||||||
`(,(if override 'bind-key* 'bind-key)
|
|
||||||
,(car binding)
|
|
||||||
#'(lambda ()
|
|
||||||
(interactive)
|
|
||||||
(use-package-autoload-keymap
|
|
||||||
',(cdr binding) ',(use-package-as-symbol name)
|
|
||||||
,override))))
|
|
||||||
args)))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun use-package-handler/:bind-keymap* (name keyword arg rest state)
|
|
||||||
(use-package-handler/:bind-keymap name keyword arg rest state t))
|
|
||||||
|
|
||||||
(provide 'use-package-bind-key)
|
|
||||||
|
|
||||||
;;; use-package-bind-key.el ends here
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,83 +0,0 @@
|
||||||
;;; use-package-delight.el --- Support for the :delight keyword -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
;; Author: John Wiegley <johnw@newartisans.com>
|
|
||||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
|
||||||
;; it under the terms of the GNU General Public License as published by
|
|
||||||
;; the Free Software Foundation, either version 3 of the License, or
|
|
||||||
;; (at your option) any later version.
|
|
||||||
|
|
||||||
;; This program is distributed in the hope that it will be useful,
|
|
||||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
;; GNU General Public License for more details.
|
|
||||||
|
|
||||||
;; You should have received a copy of the GNU General Public License
|
|
||||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
;;; Commentary:
|
|
||||||
|
|
||||||
;; Provides support for the :delight keyword, which is made available by
|
|
||||||
;; default by requiring `use-package'.
|
|
||||||
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
(require 'use-package-core)
|
|
||||||
|
|
||||||
(defun use-package-normalize-delight (name args)
|
|
||||||
"Normalize ARGS for a single call to `delight'."
|
|
||||||
(when (eq :eval (car args))
|
|
||||||
;; Handle likely common mistake.
|
|
||||||
(use-package-error ":delight mode line constructs must be quoted"))
|
|
||||||
(cond ((and (= (length args) 1)
|
|
||||||
(use-package-non-nil-symbolp (car args)))
|
|
||||||
`(,(nth 0 args) nil ,name))
|
|
||||||
((= (length args) 2)
|
|
||||||
`(,(nth 0 args) ,(nth 1 args) ,name))
|
|
||||||
((= (length args) 3)
|
|
||||||
args)
|
|
||||||
(t
|
|
||||||
(use-package-error
|
|
||||||
":delight expects `delight' arguments or a list of them"))))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun use-package-normalize/:delight (name _keyword args)
|
|
||||||
"Normalize arguments to delight."
|
|
||||||
(cond ((null args)
|
|
||||||
`((,(use-package-as-mode name) nil ,name)))
|
|
||||||
((and (= (length args) 1)
|
|
||||||
(use-package-non-nil-symbolp (car args)))
|
|
||||||
`((,(car args) nil ,name)))
|
|
||||||
((and (= (length args) 1)
|
|
||||||
(stringp (car args)))
|
|
||||||
`((,(use-package-as-mode name) ,(car args) ,name)))
|
|
||||||
((and (= (length args) 1)
|
|
||||||
(listp (car args))
|
|
||||||
(eq 'quote (caar args)))
|
|
||||||
`((,(use-package-as-mode name) ,@(cdar args) ,name)))
|
|
||||||
((and (= (length args) 2)
|
|
||||||
(listp (nth 1 args))
|
|
||||||
(eq 'quote (car (nth 1 args))))
|
|
||||||
`((,(car args) ,@(cdr (nth 1 args)) ,name)))
|
|
||||||
(t (mapcar
|
|
||||||
(apply-partially #'use-package-normalize-delight name)
|
|
||||||
(if (use-package-non-nil-symbolp (car args))
|
|
||||||
(list args)
|
|
||||||
args)))))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun use-package-handler/:delight (name _keyword args rest state)
|
|
||||||
(let ((body (use-package-process-keywords name rest state)))
|
|
||||||
(use-package-concat
|
|
||||||
body
|
|
||||||
`((if (fboundp 'delight)
|
|
||||||
(delight '(,@args)))))))
|
|
||||||
|
|
||||||
(add-to-list 'use-package-keywords :delight t)
|
|
||||||
|
|
||||||
(provide 'use-package-delight)
|
|
||||||
|
|
||||||
;;; use-package-delight.el ends here
|
|
|
@ -1,72 +0,0 @@
|
||||||
;;; use-package-diminish.el --- Support for the :diminish keyword -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
;; Author: John Wiegley <johnw@newartisans.com>
|
|
||||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
|
||||||
;; it under the terms of the GNU General Public License as published by
|
|
||||||
;; the Free Software Foundation, either version 3 of the License, or
|
|
||||||
;; (at your option) any later version.
|
|
||||||
|
|
||||||
;; This program is distributed in the hope that it will be useful,
|
|
||||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
;; GNU General Public License for more details.
|
|
||||||
|
|
||||||
;; You should have received a copy of the GNU General Public License
|
|
||||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
;;; Commentary:
|
|
||||||
|
|
||||||
;; Provides support for the :diminish keyword, which is made available by
|
|
||||||
;; default by requiring `use-package'.
|
|
||||||
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
(require 'use-package-core)
|
|
||||||
|
|
||||||
(defun use-package-normalize-diminish (name label arg &optional recursed)
|
|
||||||
"Normalize the arguments to diminish down to a list of one of two forms:
|
|
||||||
SYMBOL
|
|
||||||
(SYMBOL . STRING)"
|
|
||||||
(cond
|
|
||||||
((not arg)
|
|
||||||
(list (use-package-as-mode name)))
|
|
||||||
((use-package-non-nil-symbolp arg)
|
|
||||||
(list arg))
|
|
||||||
((stringp arg)
|
|
||||||
(list (cons (use-package-as-mode name) arg)))
|
|
||||||
((and (consp arg) (stringp (cdr arg)))
|
|
||||||
(list arg))
|
|
||||||
((and (not recursed) (listp arg) (listp (cdr arg)))
|
|
||||||
(mapcar #'(lambda (x) (car (use-package-normalize-diminish
|
|
||||||
name label x t))) arg))
|
|
||||||
(t
|
|
||||||
(use-package-error
|
|
||||||
(concat label " wants a string, symbol, "
|
|
||||||
"(symbol . string) or list of these")))))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun use-package-normalize/:diminish (name keyword args)
|
|
||||||
(use-package-as-one (symbol-name keyword) args
|
|
||||||
(apply-partially #'use-package-normalize-diminish name) t))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun use-package-handler/:diminish (name _keyword arg rest state)
|
|
||||||
(let ((body (use-package-process-keywords name rest state)))
|
|
||||||
(use-package-concat
|
|
||||||
(mapcar #'(lambda (var)
|
|
||||||
`(if (fboundp 'diminish)
|
|
||||||
,(if (consp var)
|
|
||||||
`(diminish ',(car var) ,(cdr var))
|
|
||||||
`(diminish ',var))))
|
|
||||||
arg)
|
|
||||||
body)))
|
|
||||||
|
|
||||||
(add-to-list 'use-package-keywords :diminish t)
|
|
||||||
|
|
||||||
(provide 'use-package-diminish)
|
|
||||||
|
|
||||||
;;; use-package-diminish.el ends here
|
|
|
@ -1,206 +0,0 @@
|
||||||
;;; use-package-ensure.el --- Support for the :ensure and :pin keywords -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
;; Author: John Wiegley <johnw@newartisans.com>
|
|
||||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
|
||||||
;; it under the terms of the GNU General Public License as published by
|
|
||||||
;; the Free Software Foundation, either version 3 of the License, or
|
|
||||||
;; (at your option) any later version.
|
|
||||||
|
|
||||||
;; This program is distributed in the hope that it will be useful,
|
|
||||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
;; GNU General Public License for more details.
|
|
||||||
|
|
||||||
;; You should have received a copy of the GNU General Public License
|
|
||||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
;;; Commentary:
|
|
||||||
|
|
||||||
;; Provides support for the :ensure and :pin keywords, which is made available
|
|
||||||
;; by default by requiring `use-package'.
|
|
||||||
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
(require 'cl-lib)
|
|
||||||
(require 'use-package-core)
|
|
||||||
|
|
||||||
(defgroup use-package-ensure nil
|
|
||||||
"Support for :ensure and :pin keywords in `use-package' declarations."
|
|
||||||
:group 'use-package)
|
|
||||||
|
|
||||||
(eval-when-compile
|
|
||||||
(declare-function package-installed-p "package")
|
|
||||||
(declare-function package-read-all-archive-contents "package" ()))
|
|
||||||
|
|
||||||
(defcustom use-package-always-ensure nil
|
|
||||||
"Treat every package as though it had specified using `:ensure SEXP'.
|
|
||||||
See also `use-package-defaults', which uses this value."
|
|
||||||
:type 'sexp
|
|
||||||
:group 'use-package-ensure)
|
|
||||||
|
|
||||||
(defcustom use-package-always-pin nil
|
|
||||||
"Treat every package as though it had specified using `:pin SYM'.
|
|
||||||
See also `use-package-defaults', which uses this value."
|
|
||||||
:type 'symbol
|
|
||||||
:group 'use-package-ensure)
|
|
||||||
|
|
||||||
(defcustom use-package-ensure-function 'use-package-ensure-elpa
|
|
||||||
"Function that ensures a package is installed.
|
|
||||||
This function is called with three arguments: the name of the
|
|
||||||
package declared in the `use-package' form; the arguments passed
|
|
||||||
to all `:ensure' keywords (always a list, even if only one); and
|
|
||||||
the current `state' plist created by previous handlers.
|
|
||||||
|
|
||||||
Note that this function is called whenever `:ensure' is provided,
|
|
||||||
even if it is nil. It is up to the function to decide on the
|
|
||||||
semantics of the various values for `:ensure'.
|
|
||||||
|
|
||||||
This function should return non-nil if the package is installed.
|
|
||||||
|
|
||||||
The default value uses package.el to install the package."
|
|
||||||
:type '(choice (const :tag "package.el" use-package-ensure-elpa)
|
|
||||||
(function :tag "Custom"))
|
|
||||||
:group 'use-package-ensure)
|
|
||||||
|
|
||||||
;;;; :pin
|
|
||||||
|
|
||||||
(defun use-package-normalize/:pin (_name keyword args)
|
|
||||||
(use-package-only-one (symbol-name keyword) args
|
|
||||||
#'(lambda (_label arg)
|
|
||||||
(cond
|
|
||||||
((stringp arg) arg)
|
|
||||||
((use-package-non-nil-symbolp arg) (symbol-name arg))
|
|
||||||
(t
|
|
||||||
(use-package-error
|
|
||||||
":pin wants an archive name (a string)"))))))
|
|
||||||
|
|
||||||
(eval-when-compile
|
|
||||||
(defvar package-pinned-packages)
|
|
||||||
(defvar package-archives))
|
|
||||||
|
|
||||||
(defun use-package-archive-exists-p (archive)
|
|
||||||
"Check if a given ARCHIVE is enabled.
|
|
||||||
|
|
||||||
ARCHIVE can be a string or a symbol or `manual' to indicate a
|
|
||||||
manually updated package."
|
|
||||||
(if (member archive '(manual "manual"))
|
|
||||||
't
|
|
||||||
(let ((valid nil))
|
|
||||||
(dolist (pa package-archives)
|
|
||||||
(when (member archive (list (car pa) (intern (car pa))))
|
|
||||||
(setq valid 't)))
|
|
||||||
valid)))
|
|
||||||
|
|
||||||
(defun use-package-pin-package (package archive)
|
|
||||||
"Pin PACKAGE to ARCHIVE."
|
|
||||||
(unless (boundp 'package-pinned-packages)
|
|
||||||
(setq package-pinned-packages ()))
|
|
||||||
(let ((archive-symbol (if (symbolp archive) archive (intern archive)))
|
|
||||||
(archive-name (if (stringp archive) archive (symbol-name archive))))
|
|
||||||
(if (use-package-archive-exists-p archive-symbol)
|
|
||||||
(add-to-list 'package-pinned-packages (cons package archive-name))
|
|
||||||
(error "Archive '%s' requested for package '%s' is not available"
|
|
||||||
archive-name package))
|
|
||||||
(unless (bound-and-true-p package--initialized)
|
|
||||||
(package-initialize t))))
|
|
||||||
|
|
||||||
(defun use-package-handler/:pin (name _keyword archive-name rest state)
|
|
||||||
(let ((body (use-package-process-keywords name rest state))
|
|
||||||
(pin-form (if archive-name
|
|
||||||
`(use-package-pin-package ',(use-package-as-symbol name)
|
|
||||||
,archive-name))))
|
|
||||||
;; Pinning should occur just before ensuring
|
|
||||||
;; See `use-package-handler/:ensure'.
|
|
||||||
(if (bound-and-true-p byte-compile-current-file)
|
|
||||||
(eval pin-form) ; Eval when byte-compiling,
|
|
||||||
(push pin-form body)) ; or else wait until runtime.
|
|
||||||
body))
|
|
||||||
|
|
||||||
;;;; :ensure
|
|
||||||
|
|
||||||
(defvar package-archive-contents)
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun use-package-normalize/:ensure (_name keyword args)
|
|
||||||
(if (null args)
|
|
||||||
(list t)
|
|
||||||
(use-package-only-one (symbol-name keyword) args
|
|
||||||
#'(lambda (_label arg)
|
|
||||||
(cond
|
|
||||||
((symbolp arg)
|
|
||||||
(list arg))
|
|
||||||
((and (listp arg) (= 3 (length arg))
|
|
||||||
(symbolp (nth 0 arg))
|
|
||||||
(eq :pin (nth 1 arg))
|
|
||||||
(or (stringp (nth 2 arg))
|
|
||||||
(symbolp (nth 2 arg))))
|
|
||||||
(list (cons (nth 0 arg) (nth 2 arg))))
|
|
||||||
(t
|
|
||||||
(use-package-error
|
|
||||||
(concat ":ensure wants an optional package name "
|
|
||||||
"(an unquoted symbol name), or (<symbol> :pin <string>)"))))))))
|
|
||||||
|
|
||||||
(defun use-package-ensure-elpa (name args _state &optional _no-refresh)
|
|
||||||
(dolist (ensure args)
|
|
||||||
(let ((package
|
|
||||||
(or (and (eq ensure t) (use-package-as-symbol name))
|
|
||||||
ensure)))
|
|
||||||
(when package
|
|
||||||
(require 'package)
|
|
||||||
(when (consp package)
|
|
||||||
(use-package-pin-package (car package) (cdr package))
|
|
||||||
(setq package (car package)))
|
|
||||||
(unless (package-installed-p package)
|
|
||||||
(condition-case-unless-debug err
|
|
||||||
(progn
|
|
||||||
(when (assoc package (bound-and-true-p
|
|
||||||
package-pinned-packages))
|
|
||||||
(package-read-all-archive-contents))
|
|
||||||
(if (assoc package package-archive-contents)
|
|
||||||
(package-install package)
|
|
||||||
(package-refresh-contents)
|
|
||||||
(when (assoc package (bound-and-true-p
|
|
||||||
package-pinned-packages))
|
|
||||||
(package-read-all-archive-contents))
|
|
||||||
(package-install package))
|
|
||||||
t)
|
|
||||||
(error
|
|
||||||
(display-warning 'use-package
|
|
||||||
(format "Failed to install %s: %s"
|
|
||||||
name (error-message-string err))
|
|
||||||
:error))))))))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun use-package-handler/:ensure (name _keyword ensure rest state)
|
|
||||||
(let* ((body (use-package-process-keywords name rest state)))
|
|
||||||
;; We want to avoid installing packages when the `use-package' macro is
|
|
||||||
;; being macro-expanded by elisp completion (see `lisp--local-variables'),
|
|
||||||
;; but still install packages when byte-compiling, to avoid requiring
|
|
||||||
;; `package' at runtime.
|
|
||||||
(if (bound-and-true-p byte-compile-current-file)
|
|
||||||
;; Eval when byte-compiling,
|
|
||||||
(funcall use-package-ensure-function name ensure state)
|
|
||||||
;; or else wait until runtime.
|
|
||||||
(push `(,use-package-ensure-function ',name ',ensure ',state)
|
|
||||||
body))
|
|
||||||
body))
|
|
||||||
|
|
||||||
(add-to-list 'use-package-defaults
|
|
||||||
'(:ensure (list use-package-always-ensure)
|
|
||||||
(lambda (name args)
|
|
||||||
(and use-package-always-ensure
|
|
||||||
(not (plist-member args :load-path))))) t)
|
|
||||||
|
|
||||||
(add-to-list 'use-package-defaults
|
|
||||||
'(:pin use-package-always-pin use-package-always-pin) t)
|
|
||||||
|
|
||||||
(add-to-list 'use-package-keywords :ensure)
|
|
||||||
(add-to-list 'use-package-keywords :pin)
|
|
||||||
|
|
||||||
(provide 'use-package-ensure)
|
|
||||||
|
|
||||||
;;; use-package-ensure.el ends here
|
|
|
@ -1,70 +0,0 @@
|
||||||
;;; use-package-jump.el --- Attempt to jump to a use-package declaration -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
;; Author: John Wiegley <johnw@newartisans.com>
|
|
||||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
|
||||||
;; it under the terms of the GNU General Public License as published by
|
|
||||||
;; the Free Software Foundation, either version 3 of the License, or
|
|
||||||
;; (at your option) any later version.
|
|
||||||
|
|
||||||
;; This program is distributed in the hope that it will be useful,
|
|
||||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
;; GNU General Public License for more details.
|
|
||||||
|
|
||||||
;; You should have received a copy of the GNU General Public License
|
|
||||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
;;; Commentary:
|
|
||||||
|
|
||||||
;; Provides the command `M-x use-package-jump-to-package-form', however it
|
|
||||||
;; only works if the package being jumped to was required during
|
|
||||||
;; initialization. If it was delay-loaded, it will not work.
|
|
||||||
;; Improvements are needed.
|
|
||||||
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
(require 'use-package-core)
|
|
||||||
|
|
||||||
(defun use-package-find-require (package)
|
|
||||||
"Find file that required PACKAGE by searching `load-history'.
|
|
||||||
Returns an absolute file path or nil if none is found."
|
|
||||||
(catch 'suspect
|
|
||||||
(dolist (filespec load-history)
|
|
||||||
(dolist (entry (cdr filespec))
|
|
||||||
(when (equal entry (cons 'require package))
|
|
||||||
(throw 'suspect (car filespec)))))))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun use-package-jump-to-package-form (package)
|
|
||||||
"Attempt to find and jump to the `use-package' form that loaded PACKAGE.
|
|
||||||
This will only find the form if that form actually required
|
|
||||||
PACKAGE. If PACKAGE was previously required then this function
|
|
||||||
will jump to the file that originally required PACKAGE instead."
|
|
||||||
(interactive (list (completing-read "Package: " features)))
|
|
||||||
(let* ((package (if (stringp package) (intern package) package))
|
|
||||||
(requiring-file (use-package-find-require package))
|
|
||||||
file location)
|
|
||||||
(if (null requiring-file)
|
|
||||||
(user-error "Can't find file requiring file; may have been autoloaded")
|
|
||||||
(setq file (if (string= (file-name-extension requiring-file) "elc")
|
|
||||||
(concat (file-name-sans-extension requiring-file) ".el")
|
|
||||||
requiring-file))
|
|
||||||
(when (file-exists-p file)
|
|
||||||
(find-file-other-window file)
|
|
||||||
(save-excursion
|
|
||||||
(goto-char (point-min))
|
|
||||||
(setq location
|
|
||||||
(re-search-forward
|
|
||||||
(format (eval use-package-form-regexp-eval) package) nil t)))
|
|
||||||
(if (null location)
|
|
||||||
(message "No use-package form found.")
|
|
||||||
(goto-char location)
|
|
||||||
(beginning-of-line))))))
|
|
||||||
|
|
||||||
(provide 'use-package-jump)
|
|
||||||
|
|
||||||
;;; use-package-jump.el ends here
|
|
|
@ -1,76 +0,0 @@
|
||||||
;;; use-package-lint.el --- Attempt to find errors in use-package declarations -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
;; Author: John Wiegley <johnw@newartisans.com>
|
|
||||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
|
||||||
;; it under the terms of the GNU General Public License as published by
|
|
||||||
;; the Free Software Foundation, either version 3 of the License, or
|
|
||||||
;; (at your option) any later version.
|
|
||||||
|
|
||||||
;; This program is distributed in the hope that it will be useful,
|
|
||||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
;; GNU General Public License for more details.
|
|
||||||
|
|
||||||
;; You should have received a copy of the GNU General Public License
|
|
||||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
;;; Commentary:
|
|
||||||
|
|
||||||
;; Provides the command `M-x use-package-lint'.
|
|
||||||
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
(require 'cl-lib)
|
|
||||||
(require 'use-package-core)
|
|
||||||
|
|
||||||
(defun use-package-lint-declaration (name plist)
|
|
||||||
(dolist (path (plist-get plist :load-path))
|
|
||||||
(unless (file-exists-p path)
|
|
||||||
(display-warning
|
|
||||||
'use-package
|
|
||||||
(format "%s :load-path does not exist: %s"
|
|
||||||
name path) :error)))
|
|
||||||
|
|
||||||
(unless (or (plist-member plist :disabled)
|
|
||||||
(plist-get plist :no-require)
|
|
||||||
(locate-library (use-package-as-string name) nil
|
|
||||||
(plist-get plist :load-path)))
|
|
||||||
(display-warning
|
|
||||||
'use-package
|
|
||||||
(format "%s module cannot be located" name) :error))
|
|
||||||
|
|
||||||
;; (dolist (command (plist-get plist :commands))
|
|
||||||
;; (unless (string= (find-lisp-object-file-name command nil)
|
|
||||||
;; (locate-library (use-package-as-string name) nil
|
|
||||||
;; (plist-get plist :load-path)))
|
|
||||||
;; (display-warning
|
|
||||||
;; 'use-package
|
|
||||||
;; (format "%s :command is from different path: %s"
|
|
||||||
;; name (symbol-name command)) :error)))
|
|
||||||
)
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun use-package-lint ()
|
|
||||||
"Check for errors in `use-package' declarations.
|
|
||||||
For example, if the module's `:if' condition is met, but even
|
|
||||||
with the specified `:load-path' the module cannot be found."
|
|
||||||
(interactive)
|
|
||||||
(save-excursion
|
|
||||||
(goto-char (point-min))
|
|
||||||
(let ((re (eval use-package-form-regexp-eval)))
|
|
||||||
(while (re-search-forward re nil t)
|
|
||||||
(goto-char (match-beginning 0))
|
|
||||||
(let ((decl (read (current-buffer))))
|
|
||||||
(when (eq (car decl) 'use-package)
|
|
||||||
(use-package-lint-declaration
|
|
||||||
(use-package-as-string (cadr decl))
|
|
||||||
(use-package-normalize-keywords
|
|
||||||
(cadr decl) (cddr decl)))))))))
|
|
||||||
|
|
||||||
(provide 'use-package-lint)
|
|
||||||
|
|
||||||
;;; use-package-lint.el ends here
|
|
|
@ -1,15 +0,0 @@
|
||||||
(define-package "use-package" "2.4.4" "A configuration macro for simplifying your .emacs"
|
|
||||||
'((emacs "24.3")
|
|
||||||
(bind-key "2.4"))
|
|
||||||
:commit "9090080b15486c3e337be254226efe7e5fde4c99" :authors
|
|
||||||
'(("John Wiegley" . "johnw@newartisans.com"))
|
|
||||||
:maintainers
|
|
||||||
'(("John Wiegley" . "johnw@newartisans.com"))
|
|
||||||
:maintainer
|
|
||||||
'("John Wiegley" . "johnw@newartisans.com")
|
|
||||||
:keywords
|
|
||||||
'("dotemacs" "startup" "speed" "config" "package" "extensions")
|
|
||||||
:url "https://github.com/jwiegley/use-package")
|
|
||||||
;; Local Variables:
|
|
||||||
;; no-byte-compile: t
|
|
||||||
;; End:
|
|
|
@ -1,51 +0,0 @@
|
||||||
;;; use-package.el --- A configuration macro for simplifying your .emacs -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
;; Author: John Wiegley <johnw@newartisans.com>
|
|
||||||
;; Maintainer: John Wiegley <johnw@newartisans.com>
|
|
||||||
;; Created: 17 Jun 2012
|
|
||||||
;; Version: 2.4.4
|
|
||||||
;; Package-Requires: ((emacs "24.3") (bind-key "2.4"))
|
|
||||||
;; Keywords: dotemacs startup speed config package extensions
|
|
||||||
;; URL: https://github.com/jwiegley/use-package
|
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
|
||||||
;; it under the terms of the GNU General Public License as published by
|
|
||||||
;; the Free Software Foundation, either version 3 of the License, or
|
|
||||||
;; (at your option) any later version.
|
|
||||||
|
|
||||||
;; This program is distributed in the hope that it will be useful,
|
|
||||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
;; GNU General Public License for more details.
|
|
||||||
|
|
||||||
;; You should have received a copy of the GNU General Public License
|
|
||||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
;;; Commentary:
|
|
||||||
|
|
||||||
;; The `use-package' declaration macro allows you to isolate package
|
|
||||||
;; configuration in your ".emacs" in a way that is performance-oriented and,
|
|
||||||
;; well, just tidy. I created it because I have over 80 packages that I use
|
|
||||||
;; in Emacs, and things were getting difficult to manage. Yet with this
|
|
||||||
;; utility my total load time is just under 1 second, with no loss of
|
|
||||||
;; functionality!
|
|
||||||
;;
|
|
||||||
;; Please see README.md from the same repository for documentation.
|
|
||||||
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
(require 'use-package-core)
|
|
||||||
|
|
||||||
(require 'use-package-bind-key)
|
|
||||||
(require 'use-package-diminish)
|
|
||||||
(require 'use-package-delight)
|
|
||||||
(require 'use-package-ensure)
|
|
||||||
|
|
||||||
(declare-function use-package-jump-to-package-form "use-package-jump")
|
|
||||||
(autoload #'use-package-jump-to-package-form "use-package-jump" nil t)
|
|
||||||
|
|
||||||
(provide 'use-package)
|
|
||||||
|
|
||||||
;;; use-package.el ends here
|
|
|
@ -1,989 +0,0 @@
|
||||||
This is use-package.info, produced by makeinfo version 6.7 from
|
|
||||||
use-package.texi.
|
|
||||||
|
|
||||||
Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
You can redistribute this document and/or modify it under the terms
|
|
||||||
of the GNU General Public License as published by the Free Software
|
|
||||||
Foundation, either version 3 of the License, or (at your option)
|
|
||||||
any later version.
|
|
||||||
|
|
||||||
This document is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
INFO-DIR-SECTION Emacs
|
|
||||||
START-INFO-DIR-ENTRY
|
|
||||||
* use-package: (use-package). Declarative package configuration for Emacs.
|
|
||||||
END-INFO-DIR-ENTRY
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: Top, Next: Introduction, Up: (dir)
|
|
||||||
|
|
||||||
use-package User Manual
|
|
||||||
***********************
|
|
||||||
|
|
||||||
The ‘use-package’ macro allows you to isolate package configuration in
|
|
||||||
your ‘.emacs’ file in a way that is both performance-oriented and, well,
|
|
||||||
tidy. I created it because I have over 80 packages that I use in Emacs,
|
|
||||||
and things were getting difficult to manage. Yet with this utility my
|
|
||||||
total load time is around 2 seconds, with no loss of functionality!
|
|
||||||
|
|
||||||
Copyright (C) 2012-2022 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
You can redistribute this document and/or modify it under the terms
|
|
||||||
of the GNU General Public License as published by the Free Software
|
|
||||||
Foundation, either version 3 of the License, or (at your option)
|
|
||||||
any later version.
|
|
||||||
|
|
||||||
This document is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
* Menu:
|
|
||||||
|
|
||||||
* Introduction::
|
|
||||||
* Installation::
|
|
||||||
* Getting Started::
|
|
||||||
* Basic Concepts::
|
|
||||||
* Issues/Requests::
|
|
||||||
* Keywords::
|
|
||||||
* Debugging Tools::
|
|
||||||
|
|
||||||
— The Detailed Node Listing —
|
|
||||||
|
|
||||||
Installation
|
|
||||||
|
|
||||||
* Installing from GNU ELPA::
|
|
||||||
* Installing from the Git Repository::
|
|
||||||
* Post-Installation Tasks::
|
|
||||||
|
|
||||||
Keywords
|
|
||||||
|
|
||||||
* after:: ‘:after’.
|
|
||||||
* bind-keymap bind-keymap*:: ‘:bind-keymap’, ‘:bind-keymap*’.
|
|
||||||
* bind bind*:: ‘:bind’, ‘:bind*’.
|
|
||||||
* commands:: ‘:commands’.
|
|
||||||
* preface init config:: ‘:preface’, ‘:init’, ‘:config’.
|
|
||||||
* custom:: ‘:custom’.
|
|
||||||
* custom-face:: ‘:custom-face’.
|
|
||||||
* defer demand:: ‘:defer’, ‘:demand’.
|
|
||||||
* defines functions:: ‘:defines’, ‘:functions’.
|
|
||||||
* diminish delight:: ‘:diminish’, ‘:delight’.
|
|
||||||
* disabled:: ‘:disabled’.
|
|
||||||
* ensure pin:: ‘:ensure’, ‘:pin’.
|
|
||||||
* hook:: ‘:hook’.
|
|
||||||
* if when unless:: ‘:if’, ‘:when’, ‘:unless’.
|
|
||||||
* load-path:: ‘:load-path’.
|
|
||||||
* mode interpreter:: ‘:mode’, ‘:interpreter’.
|
|
||||||
* magic magic-fallback:: ‘:magic’, ‘:magic-fallback’.
|
|
||||||
* no-require:: ‘:no-require’.
|
|
||||||
* requires:: ‘:requires’.
|
|
||||||
|
|
||||||
‘bind’, ‘bind*’
|
|
||||||
|
|
||||||
* Binding to local keymaps::
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: Introduction, Next: Installation, Prev: Top, Up: Top
|
|
||||||
|
|
||||||
1 Introduction
|
|
||||||
**************
|
|
||||||
|
|
||||||
The ‘use-package’ macro allows you to isolate package configuration in
|
|
||||||
your ‘.emacs’ file in a way that is both performance-oriented and, well,
|
|
||||||
tidy. I created it because I have over 80 packages that I use in Emacs,
|
|
||||||
and things were getting difficult to manage. Yet with this utility my
|
|
||||||
total load time is around 2 seconds, with no loss of functionality!
|
|
||||||
|
|
||||||
More text to come...
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: Installation, Next: Getting Started, Prev: Introduction, Up: Top
|
|
||||||
|
|
||||||
2 Installation
|
|
||||||
**************
|
|
||||||
|
|
||||||
use-package can be installed using Emacs’ package manager or manually
|
|
||||||
from its development repository.
|
|
||||||
|
|
||||||
* Menu:
|
|
||||||
|
|
||||||
* Installing from GNU ELPA::
|
|
||||||
* Installing from the Git Repository::
|
|
||||||
* Post-Installation Tasks::
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: Installing from GNU ELPA, Next: Installing from the Git Repository, Up: Installation
|
|
||||||
|
|
||||||
2.1 Installing from GNU ELPA
|
|
||||||
============================
|
|
||||||
|
|
||||||
use-package is available from GNU ELPA. If you haven’t used Emacs’
|
|
||||||
package manager before, then it is high time you familiarize yourself
|
|
||||||
with it by reading the documentation in the Emacs manual, see *note
|
|
||||||
(emacs)Packages::. Then add one of the archives to ‘package-archives’:
|
|
||||||
|
|
||||||
First, you need to update the local package list using:
|
|
||||||
|
|
||||||
M-x package-refresh-contents RET
|
|
||||||
|
|
||||||
Once you have done that, you can install use-package and its
|
|
||||||
dependencies using:
|
|
||||||
|
|
||||||
M-x package-install RET use-package RET
|
|
||||||
|
|
||||||
Now see *note Post-Installation Tasks::.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: Installing from the Git Repository, Next: Post-Installation Tasks, Prev: Installing from GNU ELPA, Up: Installation
|
|
||||||
|
|
||||||
2.2 Installing from the Git Repository
|
|
||||||
======================================
|
|
||||||
|
|
||||||
First, use Git to clone the use-package repository:
|
|
||||||
|
|
||||||
$ git clone https://github.com/jwiegley/use-package.git ~/.emacs.d/site-lisp/use-package
|
|
||||||
$ cd ~/.emacs.d/site-lisp/use-package
|
|
||||||
|
|
||||||
Then compile the libraries and generate the info manuals:
|
|
||||||
|
|
||||||
$ make
|
|
||||||
|
|
||||||
You may need to create ‘/path/to/use-package/config.mk’ with the
|
|
||||||
following content before running ‘make’:
|
|
||||||
|
|
||||||
LOAD_PATH = -L /path/to/use-package
|
|
||||||
|
|
||||||
Finally add this to your init file:
|
|
||||||
|
|
||||||
(add-to-list 'load-path "~/.emacs.d/site-lisp/use-package")
|
|
||||||
(require 'use-package)
|
|
||||||
|
|
||||||
(with-eval-after-load 'info
|
|
||||||
(info-initialize)
|
|
||||||
(add-to-list 'Info-directory-list
|
|
||||||
"~/.emacs.d/site-lisp/use-package/"))
|
|
||||||
|
|
||||||
Note that elements of ‘load-path’ should not end with a slash, while
|
|
||||||
those of ‘Info-directory-list’ should.
|
|
||||||
|
|
||||||
Instead of running use-package directly from the repository by adding
|
|
||||||
it to the ‘load-path’, you might want to instead install it in some
|
|
||||||
other directory using ‘sudo make install’ and setting ‘load-path’
|
|
||||||
accordingly.
|
|
||||||
|
|
||||||
To update use-package use:
|
|
||||||
|
|
||||||
$ git pull
|
|
||||||
$ make
|
|
||||||
|
|
||||||
At times it might be necessary to run ‘make clean all’ instead.
|
|
||||||
|
|
||||||
To view all available targets use ‘make help’.
|
|
||||||
|
|
||||||
Now see *note Post-Installation Tasks::.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: Post-Installation Tasks, Prev: Installing from the Git Repository, Up: Installation
|
|
||||||
|
|
||||||
2.3 Post-Installation Tasks
|
|
||||||
===========================
|
|
||||||
|
|
||||||
After installing use-package you should verify that you are indeed using
|
|
||||||
the use-package release you think you are using. It’s best to restart
|
|
||||||
Emacs before doing so, to make sure you are not using an outdated value
|
|
||||||
for ‘load-path’.
|
|
||||||
|
|
||||||
C-h v use-package-version RET
|
|
||||||
|
|
||||||
should display something like
|
|
||||||
|
|
||||||
use-package-version’s value is "2.4.3"
|
|
||||||
|
|
||||||
If you are completely new to use-package then see *note Getting
|
|
||||||
Started::.
|
|
||||||
|
|
||||||
If you run into problems, then please see the *note Debugging
|
|
||||||
Tools::.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: Getting Started, Next: Basic Concepts, Prev: Installation, Up: Top
|
|
||||||
|
|
||||||
3 Getting Started
|
|
||||||
*****************
|
|
||||||
|
|
||||||
TODO. For now, see ‘README.md’.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: Basic Concepts, Next: Issues/Requests, Prev: Getting Started, Up: Top
|
|
||||||
|
|
||||||
4 Basic Concepts
|
|
||||||
****************
|
|
||||||
|
|
||||||
‘use-package’ was created for few basic reasons, each of which drove the
|
|
||||||
design in various ways. Understanding these reasons may help make some
|
|
||||||
of those decisions clearer:
|
|
||||||
|
|
||||||
• To gather all configuration details of a package into one place,
|
|
||||||
making it easier to copy, disable, or move it elsewhere in the init
|
|
||||||
file.
|
|
||||||
|
|
||||||
• To reduce duplication and boilerplate, capturing several common
|
|
||||||
practices as mere keywords both easy and intuitive to use.
|
|
||||||
|
|
||||||
• To make startup time of Emacs as quick as possible, without
|
|
||||||
sacrificing the quantity of add-on packages used.
|
|
||||||
|
|
||||||
• To make it so errors encountered during startup disable only the
|
|
||||||
package raising the error, and as little else as possible, leaving
|
|
||||||
a close to a functional Emacs as possible.
|
|
||||||
|
|
||||||
• To allow byte-compilation of one’s init file so that any warnings
|
|
||||||
or errors seen are meaningful. In this way, even if
|
|
||||||
byte-compilation is not used for speed (reason 3), it can still be
|
|
||||||
used as a sanity check.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: Issues/Requests, Next: Keywords, Prev: Basic Concepts, Up: Top
|
|
||||||
|
|
||||||
5 Issues/Requests
|
|
||||||
*****************
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: Keywords, Next: Debugging Tools, Prev: Issues/Requests, Up: Top
|
|
||||||
|
|
||||||
6 Keywords
|
|
||||||
**********
|
|
||||||
|
|
||||||
* Menu:
|
|
||||||
|
|
||||||
* after:: ‘after’.
|
|
||||||
* bind-keymap bind-keymap*:: ‘:bind-keymap’, ‘:bind-keymap*’.
|
|
||||||
* bind bind*:: ‘bind’ ‘:bind*’.
|
|
||||||
* commands:: ‘:commands’.
|
|
||||||
* preface init config:: ‘:preface’, ‘:init’, ‘:config’.
|
|
||||||
* custom:: ‘:custom’.
|
|
||||||
* custom-face:: ‘:custom-face’.
|
|
||||||
* defer demand:: ‘:defer’, ‘:demand’.
|
|
||||||
* defines functions:: ‘:defines’, ‘:functions’.
|
|
||||||
* diminish delight:: ‘:diminish’, ‘:delight’.
|
|
||||||
* disabled:: ‘:disabled’.
|
|
||||||
* ensure pin:: ‘:ensure’, ‘:pin’.
|
|
||||||
* hook:: ‘:hook’.
|
|
||||||
* if when unless:: ‘:if’, ‘:when’, ‘:unless’.
|
|
||||||
* load-path:: ‘:load-path’.
|
|
||||||
* mode interpreter:: ‘:mode’, ‘:interpreter’.
|
|
||||||
* magic magic-fallback:: ‘:magic’, ‘:magic-fallback’.
|
|
||||||
* no-require:: ‘:no-require’.
|
|
||||||
* requires:: ‘:requires’.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: after, Next: bind-keymap bind-keymap*, Up: Keywords
|
|
||||||
|
|
||||||
6.1 ‘:after’
|
|
||||||
============
|
|
||||||
|
|
||||||
Sometimes it only makes sense to configure a package after another has
|
|
||||||
been loaded, because certain variables or functions are not in scope
|
|
||||||
until that time. This can achieved using an ‘:after’ keyword that
|
|
||||||
allows a fairly rich description of the exact conditions when loading
|
|
||||||
should occur. Here is an example:
|
|
||||||
|
|
||||||
(use-package hydra
|
|
||||||
:load-path "site-lisp/hydra")
|
|
||||||
|
|
||||||
(use-package ivy
|
|
||||||
:load-path "site-lisp/swiper")
|
|
||||||
|
|
||||||
(use-package ivy-hydra
|
|
||||||
:after (ivy hydra))
|
|
||||||
|
|
||||||
In this case, because all of these packages are demand-loaded in the
|
|
||||||
order they occur, the use of ‘:after’ is not strictly necessary. By
|
|
||||||
using it, however, the above code becomes order-independent, without an
|
|
||||||
implicit depedence on the nature of your init file.
|
|
||||||
|
|
||||||
By default, ‘:after (foo bar)’ is the same as ‘:after (:all foo
|
|
||||||
bar)’, meaning that loading of the given package will not happen until
|
|
||||||
both ‘foo’ and ‘bar’ have been loaded. Here are some of the other
|
|
||||||
possibilities:
|
|
||||||
|
|
||||||
:after (foo bar)
|
|
||||||
:after (:all foo bar)
|
|
||||||
:after (:any foo bar)
|
|
||||||
:after (:all (:any foo bar) (:any baz quux))
|
|
||||||
:after (:any (:all foo bar) (:all baz quux))
|
|
||||||
|
|
||||||
When you nest selectors, such as ‘(:any (:all foo bar) (:all baz
|
|
||||||
quux))’, it means that the package will be loaded when either both ‘foo’
|
|
||||||
and ‘bar’ have been loaded, or both ‘baz’ and ‘quux’ have been loaded.
|
|
||||||
|
|
||||||
*NOTE*: Pay attention if you set ‘use-package-always-defer’ to t, and
|
|
||||||
also use the ‘:after’ keyword, as you will need to specify how the
|
|
||||||
declared package is to be loaded: e.g., by some ‘:bind’. If you’re not
|
|
||||||
using one of the mechanisms that registers autoloads, such as ‘:bind’ or
|
|
||||||
‘:hook’, and your package manager does not provide autoloads, it’s
|
|
||||||
possible that without adding ‘:demand t’ to those declarations, your
|
|
||||||
package will never be loaded.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: bind-keymap bind-keymap*, Next: bind bind*, Prev: after, Up: Keywords
|
|
||||||
|
|
||||||
6.2 ‘:bind-keymap’, ‘:bind-keymap*’
|
|
||||||
===================================
|
|
||||||
|
|
||||||
Normally ‘:bind’ expects that commands are functions that will be
|
|
||||||
autoloaded from the given package. However, this does not work if one
|
|
||||||
of those commands is actually a keymap, since keymaps are not functions,
|
|
||||||
and cannot be autoloaded using Emacs’ ‘autoload’ mechanism.
|
|
||||||
|
|
||||||
To handle this case, ‘use-package’ offers a special, limited variant
|
|
||||||
of ‘:bind’ called ‘:bind-keymap’. The only difference is that the
|
|
||||||
"commands" bound to by ‘:bind-keymap’ must be keymaps defined in the
|
|
||||||
package, rather than command functions. This is handled behind the
|
|
||||||
scenes by generating custom code that loads the package containing the
|
|
||||||
keymap, and then re-executes your keypress after the first load, to
|
|
||||||
reinterpret that keypress as a prefix key.
|
|
||||||
|
|
||||||
For example:
|
|
||||||
|
|
||||||
(use-package projectile
|
|
||||||
:bind-keymap
|
|
||||||
("C-c p" . projectile-command-map)
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: bind bind*, Next: commands, Prev: bind-keymap bind-keymap*, Up: Keywords
|
|
||||||
|
|
||||||
6.3 ‘:bind’, ‘:bind*’
|
|
||||||
=====================
|
|
||||||
|
|
||||||
Another common thing to do when loading a module is to bind a key to
|
|
||||||
primary commands within that module:
|
|
||||||
|
|
||||||
(use-package ace-jump-mode
|
|
||||||
:bind ("C-." . ace-jump-mode))
|
|
||||||
|
|
||||||
This does two things: first, it creates an autoload for the
|
|
||||||
‘ace-jump-mode’ command and defers loading of ‘ace-jump-mode’ until you
|
|
||||||
actually use it. Second, it binds the key ‘C-.’ to that command. After
|
|
||||||
loading, you can use ‘M-x describe-personal-keybindings’ to see all such
|
|
||||||
keybindings you’ve set throughout your ‘.emacs’ file.
|
|
||||||
|
|
||||||
A more literal way to do the exact same thing is:
|
|
||||||
|
|
||||||
(use-package ace-jump-mode
|
|
||||||
:commands ace-jump-mode
|
|
||||||
:init
|
|
||||||
(bind-key "C-." 'ace-jump-mode))
|
|
||||||
|
|
||||||
When you use the ‘:commands’ keyword, it creates autoloads for those
|
|
||||||
commands and defers loading of the module until they are used. Since
|
|
||||||
the ‘:init’ form is always run—even if ‘ace-jump-mode’ might not be on
|
|
||||||
your system—remember to restrict ‘:init’ code to only what would succeed
|
|
||||||
either way.
|
|
||||||
|
|
||||||
The ‘:bind’ keyword takes either a cons or a list of conses:
|
|
||||||
|
|
||||||
(use-package hi-lock
|
|
||||||
:bind (("M-o l" . highlight-lines-matching-regexp)
|
|
||||||
("M-o r" . highlight-regexp)
|
|
||||||
("M-o w" . highlight-phrase)))
|
|
||||||
|
|
||||||
The ‘:commands’ keyword likewise takes either a symbol or a list of
|
|
||||||
symbols.
|
|
||||||
|
|
||||||
NOTE: Special keys like ‘tab’ or ‘F1’-‘Fn’ can be written in square
|
|
||||||
brackets, i.e. ‘[tab]’ instead of ‘"tab"’. The syntax for the
|
|
||||||
keybindings is similar to the "kbd" syntax: see the Emacs Manual
|
|
||||||
(https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Rebinding.html)
|
|
||||||
for more information.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
(use-package helm
|
|
||||||
:bind (("M-x" . helm-M-x)
|
|
||||||
("M-<f5>" . helm-find-files)
|
|
||||||
([f10] . helm-buffers-list)
|
|
||||||
([S-f10] . helm-recentf)))
|
|
||||||
|
|
||||||
* Menu:
|
|
||||||
|
|
||||||
* Binding to local keymaps::
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: Binding to local keymaps, Up: bind bind*
|
|
||||||
|
|
||||||
6.3.1 Binding to local keymaps
|
|
||||||
------------------------------
|
|
||||||
|
|
||||||
Slightly different from binding a key to a keymap, is binding a key
|
|
||||||
*within* a local keymap that only exists after the package is loaded.
|
|
||||||
‘use-package’ supports this with a ‘:map’ modifier, taking the local
|
|
||||||
keymap to bind to:
|
|
||||||
|
|
||||||
(use-package helm
|
|
||||||
:bind (:map helm-command-map
|
|
||||||
("C-c h" . helm-execute-persistent-action)))
|
|
||||||
|
|
||||||
The effect of this statement is to wait until ‘helm’ has loaded, and
|
|
||||||
then to bind the key ‘C-c h’ to ‘helm-execute-persistent-action’ within
|
|
||||||
Helm’s local keymap, ‘helm-mode-map’.
|
|
||||||
|
|
||||||
Multiple uses of ‘:map’ may be specified. Any binding occurring
|
|
||||||
before the first use of ‘:map’ are applied to the global keymap:
|
|
||||||
|
|
||||||
(use-package term
|
|
||||||
:bind (("C-c t" . term)
|
|
||||||
:map term-mode-map
|
|
||||||
("M-p" . term-send-up)
|
|
||||||
("M-n" . term-send-down)
|
|
||||||
:map term-raw-map
|
|
||||||
("M-o" . other-window)
|
|
||||||
("M-p" . term-send-up)
|
|
||||||
("M-n" . term-send-down)))
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: commands, Next: preface init config, Prev: bind bind*, Up: Keywords
|
|
||||||
|
|
||||||
6.4 ‘:commands’
|
|
||||||
===============
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: preface init config, Next: custom, Prev: commands, Up: Keywords
|
|
||||||
|
|
||||||
6.5 ‘:preface’, ‘:init’, ‘:config’
|
|
||||||
==================================
|
|
||||||
|
|
||||||
Here is the simplest ‘use-package’ declaration:
|
|
||||||
|
|
||||||
;; This is only needed once, near the top of the file
|
|
||||||
(eval-when-compile
|
|
||||||
;; Following line is not needed if use-package.el is in ~/.emacs.d
|
|
||||||
(add-to-list 'load-path "<path where use-package is installed>")
|
|
||||||
(require 'use-package))
|
|
||||||
|
|
||||||
(use-package foo)
|
|
||||||
|
|
||||||
This loads in the package ‘foo’, but only if ‘foo’ is available on
|
|
||||||
your system. If not, a warning is logged to the ‘*Messages*’ buffer.
|
|
||||||
If it succeeds, a message about ‘"Loading foo"’ is logged, along with
|
|
||||||
the time it took to load, if it took over 0.1 seconds.
|
|
||||||
|
|
||||||
Use the ‘:init’ keyword to execute code before a package is loaded.
|
|
||||||
It accepts one or more forms, up until the next keyword:
|
|
||||||
|
|
||||||
(use-package foo
|
|
||||||
:init
|
|
||||||
(setq foo-variable t))
|
|
||||||
|
|
||||||
Similarly, ‘:config’ can be used to execute code after a package is
|
|
||||||
loaded. In cases where loading is done lazily (see more about
|
|
||||||
autoloading below), this execution is deferred until after the autoload
|
|
||||||
occurs:
|
|
||||||
|
|
||||||
(use-package foo
|
|
||||||
:init
|
|
||||||
(setq foo-variable t)
|
|
||||||
:config
|
|
||||||
(foo-mode 1))
|
|
||||||
|
|
||||||
As you might expect, you can use ‘:init’ and ‘:config’ together:
|
|
||||||
|
|
||||||
(use-package color-moccur
|
|
||||||
:commands (isearch-moccur isearch-all)
|
|
||||||
:bind (("M-s O" . moccur)
|
|
||||||
:map isearch-mode-map
|
|
||||||
("M-o" . isearch-moccur)
|
|
||||||
("M-O" . isearch-moccur-all))
|
|
||||||
:init
|
|
||||||
(setq isearch-lazy-highlight t)
|
|
||||||
:config
|
|
||||||
(use-package moccur-edit))
|
|
||||||
|
|
||||||
In this case, I want to autoload the commands ‘isearch-moccur’ and
|
|
||||||
‘isearch-all’ from ‘color-moccur.el’, and bind keys both at the global
|
|
||||||
level and within the ‘isearch-mode-map’ (see next section). When the
|
|
||||||
package is actually loaded (by using one of these commands),
|
|
||||||
‘moccur-edit’ is also loaded, to allow editing of the ‘moccur’ buffer.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: custom, Next: custom-face, Prev: preface init config, Up: Keywords
|
|
||||||
|
|
||||||
6.6 ‘:custom’
|
|
||||||
=============
|
|
||||||
|
|
||||||
The ‘:custom’ keyword allows customization of package custom variables.
|
|
||||||
|
|
||||||
(use-package comint
|
|
||||||
:custom
|
|
||||||
(comint-buffer-maximum-size 20000 "Increase comint buffer size.")
|
|
||||||
(comint-prompt-read-only t "Make the prompt read only."))
|
|
||||||
|
|
||||||
The documentation string is not mandatory.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: custom-face, Next: defer demand, Prev: custom, Up: Keywords
|
|
||||||
|
|
||||||
6.7 ‘:custom-face’
|
|
||||||
==================
|
|
||||||
|
|
||||||
The ‘:custom-face’ keyword allows customization of package custom faces.
|
|
||||||
|
|
||||||
(use-package eruby-mode
|
|
||||||
:custom-face
|
|
||||||
(eruby-standard-face ((t (:slant italic)))))
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: defer demand, Next: defines functions, Prev: custom-face, Up: Keywords
|
|
||||||
|
|
||||||
6.8 ‘:defer’, ‘:demand’
|
|
||||||
=======================
|
|
||||||
|
|
||||||
In almost all cases you don’t need to manually specify ‘:defer t’. This
|
|
||||||
is implied whenever ‘:bind’ or ‘:mode’ or ‘:interpreter’ is used.
|
|
||||||
Typically, you only need to specify ‘:defer’ if you know for a fact that
|
|
||||||
some other package will do something to cause your package to load at
|
|
||||||
the appropriate time, and thus you would like to defer loading even
|
|
||||||
though use-package isn’t creating any autoloads for you.
|
|
||||||
|
|
||||||
You can override package deferral with the ‘:demand’ keyword. Thus,
|
|
||||||
even if you use ‘:bind’, using ‘:demand’ will force loading to occur
|
|
||||||
immediately and not establish an autoload for the bound key.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: defines functions, Next: diminish delight, Prev: defer demand, Up: Keywords
|
|
||||||
|
|
||||||
6.9 ‘:defines’, ‘:functions’
|
|
||||||
============================
|
|
||||||
|
|
||||||
Another feature of ‘use-package’ is that it always loads every file that
|
|
||||||
it can when ‘.emacs’ is being byte-compiled. This helps to silence
|
|
||||||
spurious warnings about unknown variables and functions.
|
|
||||||
|
|
||||||
However, there are times when this is just not enough. For those
|
|
||||||
times, use the ‘:defines’ and ‘:functions’ keywords to introduce dummy
|
|
||||||
variable and function declarations solely for the sake of the
|
|
||||||
byte-compiler:
|
|
||||||
|
|
||||||
(use-package texinfo
|
|
||||||
:defines texinfo-section-list
|
|
||||||
:commands texinfo-mode
|
|
||||||
:init
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.texi$" . texinfo-mode)))
|
|
||||||
|
|
||||||
If you need to silence a missing function warning, you can use
|
|
||||||
‘:functions’:
|
|
||||||
|
|
||||||
(use-package ruby-mode
|
|
||||||
:mode "\\.rb\\'"
|
|
||||||
:interpreter "ruby"
|
|
||||||
:functions inf-ruby-keys
|
|
||||||
:config
|
|
||||||
(defun my-ruby-mode-hook ()
|
|
||||||
(require 'inf-ruby)
|
|
||||||
(inf-ruby-keys))
|
|
||||||
|
|
||||||
(add-hook 'ruby-mode-hook 'my-ruby-mode-hook))
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: diminish delight, Next: disabled, Prev: defines functions, Up: Keywords
|
|
||||||
|
|
||||||
6.10 ‘:diminish’, ‘:delight’
|
|
||||||
============================
|
|
||||||
|
|
||||||
‘use-package’ also provides built-in support for the diminish and
|
|
||||||
delight utilities—if you have them installed. Their purpose is to
|
|
||||||
remove or change minor mode strings in your mode-line.
|
|
||||||
|
|
||||||
diminish (https://github.com/myrjola/diminish.el) is invoked with the
|
|
||||||
‘:diminish’ keyword, which is passed either a minor mode symbol, a cons
|
|
||||||
of the symbol and its replacement string, or just a replacement string,
|
|
||||||
in which case the minor mode symbol is guessed to be the package name
|
|
||||||
with "-mode" appended at the end:
|
|
||||||
|
|
||||||
(use-package abbrev
|
|
||||||
:diminish abbrev-mode
|
|
||||||
:config
|
|
||||||
(if (file-exists-p abbrev-file-name)
|
|
||||||
(quietly-read-abbrev-file)))
|
|
||||||
|
|
||||||
delight (https://elpa.gnu.org/packages/delight.html) is invoked with
|
|
||||||
the ‘:delight’ keyword, which is passed a minor mode symbol, a
|
|
||||||
replacement string or quoted mode-line data
|
|
||||||
(https://www.gnu.org/software/emacs/manual/html_node/elisp/Mode-Line-Data.html)
|
|
||||||
(in which case the minor mode symbol is guessed to be the package name
|
|
||||||
with "-mode" appended at the end), both of these, or several lists of
|
|
||||||
both. If no arguments are provided, the default mode name is hidden
|
|
||||||
completely.
|
|
||||||
|
|
||||||
;; Don't show anything for rainbow-mode.
|
|
||||||
(use-package rainbow-mode
|
|
||||||
:delight)
|
|
||||||
|
|
||||||
;; Don't show anything for auto-revert-mode, which doesn't match
|
|
||||||
;; its package name.
|
|
||||||
(use-package autorevert
|
|
||||||
:delight auto-revert-mode)
|
|
||||||
|
|
||||||
;; Remove the mode name for projectile-mode, but show the project name.
|
|
||||||
(use-package projectile
|
|
||||||
:delight '(:eval (concat " " (projectile-project-name))))
|
|
||||||
|
|
||||||
;; Completely hide visual-line-mode and change auto-fill-mode to " AF".
|
|
||||||
(use-package emacs
|
|
||||||
:delight
|
|
||||||
(auto-fill-function " AF")
|
|
||||||
(visual-line-mode))
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: disabled, Next: ensure pin, Prev: diminish delight, Up: Keywords
|
|
||||||
|
|
||||||
6.11 ‘:disabled’
|
|
||||||
================
|
|
||||||
|
|
||||||
The ‘:disabled’ keyword can turn off a module you’re having difficulties
|
|
||||||
with, or stop loading something you’re not using at the present time:
|
|
||||||
|
|
||||||
(use-package ess-site
|
|
||||||
:disabled
|
|
||||||
:commands R)
|
|
||||||
|
|
||||||
When byte-compiling your ‘.emacs’ file, disabled declarations are
|
|
||||||
omitted from the output entirely, to accelerate startup times.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: ensure pin, Next: hook, Prev: disabled, Up: Keywords
|
|
||||||
|
|
||||||
6.12 ‘:ensure’, ‘:pin’
|
|
||||||
======================
|
|
||||||
|
|
||||||
You can use ‘use-package’ to load packages from ELPA with ‘package.el’.
|
|
||||||
This is particularly useful if you share your ‘.emacs’ among several
|
|
||||||
machines; the relevant packages are downloaded automatically once
|
|
||||||
declared in your ‘.emacs’. The ‘:ensure’ keyword causes the package(s)
|
|
||||||
to be installed automatically if not already present on your system (set
|
|
||||||
‘(setq use-package-always-ensure t)’ if you wish this behavior to be
|
|
||||||
global for all packages):
|
|
||||||
|
|
||||||
(use-package magit
|
|
||||||
:ensure t)
|
|
||||||
|
|
||||||
If you need to install a different package from the one named by
|
|
||||||
‘use-package’, you can specify it like this:
|
|
||||||
|
|
||||||
(use-package tex
|
|
||||||
:ensure auctex)
|
|
||||||
|
|
||||||
Lastly, when running on Emacs 24.4 or later, use-package can pin a
|
|
||||||
package to a specific archive, allowing you to mix and match packages
|
|
||||||
from different archives. The primary use-case for this is preferring
|
|
||||||
packages from the ‘melpa-stable’ and ‘gnu’ archives, but using specific
|
|
||||||
packages from ‘melpa’ when you need to track newer versions than what is
|
|
||||||
available in the ‘stable’ archives is also a valid use-case.
|
|
||||||
|
|
||||||
By default ‘package.el’ prefers ‘melpa’ over ‘melpa-stable’ due to
|
|
||||||
the versioning ‘(> evil-20141208.623 evil-1.0.9)’, so even if you are
|
|
||||||
tracking only a single package from ‘melpa’, you will need to tag all
|
|
||||||
the non-‘melpa’ packages with the appropriate archive. If this really
|
|
||||||
annoys you, then you can set ‘use-package-always-pin’ to set a default.
|
|
||||||
|
|
||||||
If you want to manually keep a package updated and ignore upstream
|
|
||||||
updates, you can pin it to ‘manual’, which as long as there is no
|
|
||||||
repository by that name, will Just Work(tm).
|
|
||||||
|
|
||||||
‘use-package’ throws an error if you try to pin a package to an
|
|
||||||
archive that has not been configured using ‘package-archives’ (apart
|
|
||||||
from the magic ‘manual’ archive mentioned above):
|
|
||||||
|
|
||||||
Archive 'foo' requested for package 'bar' is not available.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
(use-package company
|
|
||||||
:ensure t
|
|
||||||
:pin melpa-stable)
|
|
||||||
|
|
||||||
(use-package evil
|
|
||||||
:ensure t)
|
|
||||||
;; no :pin needed, as package.el will choose the version in melpa
|
|
||||||
|
|
||||||
(use-package adaptive-wrap
|
|
||||||
:ensure t
|
|
||||||
;; as this package is available only in the gnu archive, this is
|
|
||||||
;; technically not needed, but it helps to highlight where it
|
|
||||||
;; comes from
|
|
||||||
:pin gnu)
|
|
||||||
|
|
||||||
(use-package org
|
|
||||||
:ensure t
|
|
||||||
;; ignore org-mode from upstream and use a manually installed version
|
|
||||||
:pin manual)
|
|
||||||
|
|
||||||
*NOTE*: the ‘:pin’ argument has no effect on emacs versions < 24.4.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: hook, Next: if when unless, Prev: ensure pin, Up: Keywords
|
|
||||||
|
|
||||||
6.13 ‘:hook’
|
|
||||||
============
|
|
||||||
|
|
||||||
The ‘:hook’ keyword allows adding functions onto hooks, here only the
|
|
||||||
basename of the hook is required. Thus, all of the following are
|
|
||||||
equivalent:
|
|
||||||
|
|
||||||
(use-package ace-jump-mode
|
|
||||||
:hook prog-mode)
|
|
||||||
|
|
||||||
(use-package ace-jump-mode
|
|
||||||
:hook (prog-mode . ace-jump-mode))
|
|
||||||
|
|
||||||
(use-package ace-jump-mode
|
|
||||||
:commands ace-jump-mode
|
|
||||||
:init
|
|
||||||
(add-hook 'prog-mode-hook #'ace-jump-mode))
|
|
||||||
|
|
||||||
And likewise, when multiple hooks should be applied, the following
|
|
||||||
are also equivalent:
|
|
||||||
|
|
||||||
(use-package ace-jump-mode
|
|
||||||
:hook (prog-mode text-mode))
|
|
||||||
|
|
||||||
(use-package ace-jump-mode
|
|
||||||
:hook ((prog-mode text-mode) . ace-jump-mode))
|
|
||||||
|
|
||||||
(use-package ace-jump-mode
|
|
||||||
:hook ((prog-mode . ace-jump-mode)
|
|
||||||
(text-mode . ace-jump-mode)))
|
|
||||||
|
|
||||||
(use-package ace-jump-mode
|
|
||||||
:commands ace-jump-mode
|
|
||||||
:init
|
|
||||||
(add-hook 'prog-mode-hook #'ace-jump-mode)
|
|
||||||
(add-hook 'text-mode-hook #'ace-jump-mode))
|
|
||||||
|
|
||||||
The use of ‘:hook’, as with ‘:bind’, ‘:mode’, ‘:interpreter’, etc.,
|
|
||||||
causes the functions being hooked to implicitly be read as ‘:commands’
|
|
||||||
(meaning they will establish interactive ‘autoload’ definitions for that
|
|
||||||
module, if not already defined as functions), and so ‘:defer t’ is also
|
|
||||||
implied by ‘:hook’.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: if when unless, Next: load-path, Prev: hook, Up: Keywords
|
|
||||||
|
|
||||||
6.14 ‘:if’, ‘:when’, ‘:unless’
|
|
||||||
==============================
|
|
||||||
|
|
||||||
You can use the ‘:if’ keyword to predicate the loading and
|
|
||||||
initialization of modules.
|
|
||||||
|
|
||||||
For example, I only want ‘edit-server’ running for my main, graphical
|
|
||||||
Emacs, not for other Emacsen I may start at the command line:
|
|
||||||
|
|
||||||
(use-package edit-server
|
|
||||||
:if window-system
|
|
||||||
:init
|
|
||||||
(add-hook 'after-init-hook 'server-start t)
|
|
||||||
(add-hook 'after-init-hook 'edit-server-start t))
|
|
||||||
|
|
||||||
In another example, we can load things conditional on the operating
|
|
||||||
system:
|
|
||||||
|
|
||||||
(use-package exec-path-from-shell
|
|
||||||
:if (memq window-system '(mac ns))
|
|
||||||
:ensure t
|
|
||||||
:config
|
|
||||||
(exec-path-from-shell-initialize))
|
|
||||||
|
|
||||||
Note that ‘:when’ is provided as an alias for ‘:if’, and ‘:unless
|
|
||||||
foo’ means the same thing as ‘:if (not foo)’.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: load-path, Next: mode interpreter, Prev: if when unless, Up: Keywords
|
|
||||||
|
|
||||||
6.15 ‘:load-path’
|
|
||||||
=================
|
|
||||||
|
|
||||||
If your package needs a directory added to the ‘load-path’ in order to
|
|
||||||
load, use ‘:load-path’. This takes a symbol, a function, a string or a
|
|
||||||
list of strings. If the path is relative, it is expanded within
|
|
||||||
‘user-emacs-directory’:
|
|
||||||
|
|
||||||
(use-package ess-site
|
|
||||||
:load-path "site-lisp/ess/lisp/"
|
|
||||||
:commands R)
|
|
||||||
|
|
||||||
Note that when using a symbol or a function to provide a dynamically
|
|
||||||
generated list of paths, you must inform the byte-compiler of this
|
|
||||||
definition so the value is available at byte-compilation time. This is
|
|
||||||
done by using the special form ‘eval-and-compile’ (as opposed to
|
|
||||||
‘eval-when-compile’). Further, this value is fixed at whatever was
|
|
||||||
determined during compilation, to avoid looking up the same information
|
|
||||||
again on each startup:
|
|
||||||
|
|
||||||
(eval-and-compile
|
|
||||||
(defun ess-site-load-path ()
|
|
||||||
(shell-command "find ~ -path ess/lisp")))
|
|
||||||
|
|
||||||
(use-package ess-site
|
|
||||||
:load-path (lambda () (list (ess-site-load-path)))
|
|
||||||
:commands R)
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: mode interpreter, Next: magic magic-fallback, Prev: load-path, Up: Keywords
|
|
||||||
|
|
||||||
6.16 ‘:mode’, ‘:interpreter’
|
|
||||||
============================
|
|
||||||
|
|
||||||
Similar to ‘:bind’, you can use ‘:mode’ and ‘:interpreter’ to establish
|
|
||||||
a deferred binding within the ‘auto-mode-alist’ and
|
|
||||||
‘interpreter-mode-alist’ variables. The specifier to either keyword can
|
|
||||||
be a cons cell, a list of cons cells, or a string or regexp:
|
|
||||||
|
|
||||||
(use-package ruby-mode
|
|
||||||
:mode "\\.rb\\'"
|
|
||||||
:interpreter "ruby")
|
|
||||||
|
|
||||||
;; The package is "python" but the mode is "python-mode":
|
|
||||||
(use-package python
|
|
||||||
:mode ("\\.py\\'" . python-mode)
|
|
||||||
:interpreter ("python" . python-mode))
|
|
||||||
|
|
||||||
If you aren’t using ‘:commands’, ‘:bind’, ‘:bind*’, ‘:bind-keymap’,
|
|
||||||
‘:bind-keymap*’, ‘:mode’, or ‘:interpreter’ (all of which imply
|
|
||||||
‘:defer’; see the docstring for ‘use-package’ for a brief description of
|
|
||||||
each), you can still defer loading with the ‘:defer’ keyword:
|
|
||||||
|
|
||||||
(use-package ace-jump-mode
|
|
||||||
:defer t
|
|
||||||
:init
|
|
||||||
(autoload 'ace-jump-mode "ace-jump-mode" nil t)
|
|
||||||
(bind-key "C-." 'ace-jump-mode))
|
|
||||||
|
|
||||||
This does exactly the same thing as the following:
|
|
||||||
|
|
||||||
(use-package ace-jump-mode
|
|
||||||
:bind ("C-." . ace-jump-mode))
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: magic magic-fallback, Next: no-require, Prev: mode interpreter, Up: Keywords
|
|
||||||
|
|
||||||
6.17 ‘:magic’, ‘:magic-fallback’
|
|
||||||
================================
|
|
||||||
|
|
||||||
Similar to ‘:mode’ and ‘:interpreter’, you can also use ‘:magic’ and
|
|
||||||
‘:magic-fallback’ to cause certain function to be run if the beginning
|
|
||||||
of a file matches a given regular expression. The difference between
|
|
||||||
the two is that ‘:magic-fallback’ has a lower priority than ‘:mode’.
|
|
||||||
For example:
|
|
||||||
|
|
||||||
(use-package pdf-tools
|
|
||||||
:load-path "site-lisp/pdf-tools/lisp"
|
|
||||||
:magic ("%PDF" . pdf-view-mode)
|
|
||||||
:config
|
|
||||||
(pdf-tools-install))
|
|
||||||
|
|
||||||
This registers an autoloaded command for ‘pdf-view-mode’, defers
|
|
||||||
loading of ‘pdf-tools’, and runs ‘pdf-view-mode’ if the beginning of a
|
|
||||||
buffer matches the string ‘"%PDF"’.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: no-require, Next: requires, Prev: magic magic-fallback, Up: Keywords
|
|
||||||
|
|
||||||
6.18 ‘:no-require’
|
|
||||||
==================
|
|
||||||
|
|
||||||
Normally, ‘use-package’ will load each package at compile time before
|
|
||||||
compiling the configuration, to ensure that any necessary symbols are in
|
|
||||||
scope to satisfy the byte-compiler. At times this can cause problems,
|
|
||||||
since a package may have special loading requirements, and all that you
|
|
||||||
want to use ‘use-package’ for is to add a configuration to the
|
|
||||||
‘eval-after-load’ hook. In such cases, use the ‘:no-require’ keyword:
|
|
||||||
|
|
||||||
(use-package foo
|
|
||||||
:no-require t
|
|
||||||
:config
|
|
||||||
(message "This is evaluated when `foo' is loaded"))
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: requires, Prev: no-require, Up: Keywords
|
|
||||||
|
|
||||||
6.19 ‘:requires’
|
|
||||||
================
|
|
||||||
|
|
||||||
While the ‘:after’ keyword delays loading until the dependencies are
|
|
||||||
loaded, the somewhat simpler ‘:requires’ keyword simply never loads the
|
|
||||||
package if the dependencies are not available at the time the
|
|
||||||
‘use-package’ declaration is encountered. By "available" in this
|
|
||||||
context it means that ‘foo’ is available of ‘(featurep 'foo)’ evaluates
|
|
||||||
to a non-nil value. For example:
|
|
||||||
|
|
||||||
(use-package abbrev
|
|
||||||
:requires foo)
|
|
||||||
|
|
||||||
This is the same as:
|
|
||||||
|
|
||||||
(use-package abbrev
|
|
||||||
:if (featurep 'foo))
|
|
||||||
|
|
||||||
As a convenience, a list of such packages may be specified:
|
|
||||||
|
|
||||||
(use-package abbrev
|
|
||||||
:requires (foo bar baz))
|
|
||||||
|
|
||||||
For more complex logic, such as that supported by ‘:after’, simply
|
|
||||||
use ‘:if’ and the appropriate Lisp expression.
|
|
||||||
|
|
||||||
|
|
||||||
File: use-package.info, Node: Debugging Tools, Prev: Keywords, Up: Top
|
|
||||||
|
|
||||||
7 Debugging Tools
|
|
||||||
*****************
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Tag Table:
|
|
||||||
Node: Top780
|
|
||||||
Node: Introduction2989
|
|
||||||
Node: Installation3500
|
|
||||||
Node: Installing from GNU ELPA3845
|
|
||||||
Node: Installing from the Git Repository4586
|
|
||||||
Node: Post-Installation Tasks6122
|
|
||||||
Node: Getting Started6810
|
|
||||||
Node: Basic Concepts6989
|
|
||||||
Node: Issues/Requests8153
|
|
||||||
Node: Keywords8290
|
|
||||||
Node: after9237
|
|
||||||
Node: bind-keymap bind-keymap*11249
|
|
||||||
Node: bind bind*12302
|
|
||||||
Node: Binding to local keymaps14377
|
|
||||||
Node: commands15524
|
|
||||||
Node: preface init config15666
|
|
||||||
Node: custom17765
|
|
||||||
Node: custom-face18205
|
|
||||||
Node: defer demand18525
|
|
||||||
Node: defines functions19337
|
|
||||||
Node: diminish delight20482
|
|
||||||
Node: disabled22425
|
|
||||||
Node: ensure pin22920
|
|
||||||
Node: hook25650
|
|
||||||
Node: if when unless27075
|
|
||||||
Node: load-path28021
|
|
||||||
Node: mode interpreter29167
|
|
||||||
Node: magic magic-fallback30478
|
|
||||||
Node: no-require31332
|
|
||||||
Node: requires32036
|
|
||||||
Node: Debugging Tools32923
|
|
||||||
|
|
||||||
End Tag Table
|
|
||||||
|
|
||||||
|
|
||||||
Local Variables:
|
|
||||||
coding: utf-8
|
|
||||||
End:
|
|
Loading…
Reference in New Issue