;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
-\f
+
;;; Commentary:
;; The `use-package' declaration macro allows you to isolate package
;; functionality!
;;
;; Please see README.md from the same repository for documentation.
-\f
+
;;; Code:
(require 'bind-key)
(cancel-timer use-package-idle-timer)
(setq use-package-idle-timer nil))))
+(eval-when-compile
+ (defvar package-pinned-packages)
+ (defvar package-archives))
+
(defun use-package-pin-package (package archive)
"Pin PACKAGE to ARCHIVE."
(unless (boundp 'package-pinned-packages)
(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 (message "Archive '%s' requested for package '%s' is not available." archive-name package)))
+ (error "Archive '%s' requested for package '%s' is not available."
+ archive-name package))
(package-initialize t)))
(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."
+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))
(keybindings-alist (use-package-plist-get args :bind t t))
(overriding-keybindings-alist (use-package-plist-get args :bind* t t))
(keymap-alist (use-package-plist-get args :bind-keymap t t))
- (overriding-keymap-alist (use-package-plist-get args :bind-keymap* t t))
+ (overriding-keymap-alist
+ (use-package-plist-get args :bind-keymap* t t))
(mode (use-package-plist-get args :mode t t))
(mode-alist
(if (stringp mode) (cons mode name) mode))
(if diminish-var
- (setq config-body
- `(progn
- ,config-body
- (ignore-errors
- ,@(cond
- ((stringp diminish-var)
- `((diminish (quote ,(intern (concat name-string "-mode")))
- ,diminish-var)))
- ((symbolp diminish-var)
- `((diminish (quote ,diminish-var))))
- ((and (consp diminish-var) (stringp (cdr diminish-var)))
- `((diminish (quote ,(car diminish-var)) ,(cdr diminish-var))))
- (t ; list of symbols or (symbol . "string") pairs
- (mapcar (lambda (var)
- (if (listp var)
- `(diminish (quote ,(car var)) ,(cdr var))
- `(diminish (quote ,var))))
- diminish-var)))))))
+ (setq
+ config-body
+ `(progn
+ ,config-body
+ (ignore-errors
+ ,@(cond
+ ((stringp diminish-var)
+ `((diminish (quote ,(intern (concat name-string "-mode")))
+ ,diminish-var)))
+ ((symbolp diminish-var)
+ `((diminish (quote ,diminish-var))))
+ ((and (consp diminish-var) (stringp (cdr diminish-var)))
+ `((diminish (quote ,(car diminish-var))
+ ,(cdr diminish-var))))
+ (t ; list of symbols or (symbol . "string") pairs
+ (mapcar (lambda (var)
+ (if (listp var)
+ `(diminish (quote ,(car var)) ,(cdr var))
+ `(diminish (quote ,var))))
+ diminish-var)))))))
(if (and commands (symbolp commands))
(setq commands (list commands)))
(setq init-body
`(progn
(require 'use-package)
- (use-package-init-on-idle (lambda () ,idle-body) ,idle-priority)
+ (use-package-init-on-idle (lambda () ,idle-body)
+ ,idle-priority)
,init-body)))
(let ((init-for-commands-or-keymaps
`(,(lambda ()
(if ,requires-test
(use-package-with-elapsed-timer
- ,(format "Configuring package %s" name-string)
+ ,(format "Configuring package %s"
+ name-string)
,config-body))))))
t))
`(if (and ,(or predicate t)
(keymap (symbol-value keymap-symbol)))
(progn
(if override
- `(eval `(bind-key* ,key ,keymap)) ; eval form is necessary to avoid compiler error
+ ;; eval form is necessary to avoid compiler error
+ `(eval `(bind-key* ,key ,keymap))
(bind-key key keymap))
(setq unread-command-events
(listify-key-sequence (this-command-keys-vector)))))
(font-lock-add-keywords 'emacs-lisp-mode use-package-font-lock-keywords)
(provide 'use-package)
+
;; Local Variables:
;; indent-tabs-mode: nil
;; End:
+
;;; use-package.el ends here