(defun use-package-handler/:bind-keymap
(name keyword arg rest state &optional override)
- (let ((form
- (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)))) arg)))
- (use-package-concat
- (use-package-process-keywords name rest state)
- `((ignore ,@form)))))
+ (use-package-concat
+ (use-package-process-keywords name rest state)
+ `((ignore
+ ,@(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)))) arg)))))
(defun use-package-handler/:bind-keymap* (name keyword arg rest state)
(use-package-handler/:bind-keymap name keyword arg rest state t))
(cl-destructuring-bind (nargs . commands)
(use-package-normalize-commands args)
(use-package-concat
- (mapcar
- #'(lambda (thing)
- `(add-to-list
- ',alist
- ',(cons (use-package-normalize-regex (car thing))
- (cdr thing))))
- nargs)
(use-package-process-keywords name
(use-package-sort-keywords
(use-package-plist-append rest :commands commands))
- state))))
+ state)
+ `((ignore
+ ,@(mapcar
+ #'(lambda (thing)
+ `(add-to-list
+ ',alist
+ ',(cons (use-package-normalize-regex (car thing))
+ (cdr thing))))
+ nargs))))))
(defalias 'use-package-normalize/:interpreter 'use-package-normalize-mode)
(cl-destructuring-bind (nargs . commands)
(use-package-normalize-commands args)
(use-package-concat
- (cl-mapcan
- #'(lambda (def)
- (let ((syms (car def))
- (fun (cdr def)))
- (when fun
- (mapcar
- #'(lambda (sym)
- `(add-hook (quote ,(intern (format "%s-hook" sym)))
- (function ,fun)))
- (if (use-package-non-nil-symbolp syms) (list syms) syms)))))
- nargs)
(use-package-process-keywords name
(use-package-sort-keywords
(use-package-plist-append rest :commands commands))
- state))))
+ state)
+ `((ignore
+ ,@(cl-mapcan
+ #'(lambda (def)
+ (let ((syms (car def))
+ (fun (cdr def)))
+ (when fun
+ (mapcar
+ #'(lambda (sym)
+ `(add-hook (quote ,(intern (format "%s-hook" sym)))
+ (function ,fun)))
+ (if (use-package-non-nil-symbolp syms) (list syms) syms)))))
+ nargs))))))
;;;; :commands
(match-expansion
(use-package foo :interpreter "interp")
`(progn
- (add-to-list 'interpreter-mode-alist '("interp" . foo))
(unless (fboundp 'foo)
- (autoload #'foo "foo" nil t)))))
+ (autoload #'foo "foo" nil t))
+ (ignore
+ (add-to-list 'interpreter-mode-alist '("interp" . foo))))))
(ert-deftest use-package-test/:interpreter-2 ()
(match-expansion
(use-package foo :interpreter ("interp" . fun))
`(progn
- (add-to-list 'interpreter-mode-alist '("interp" . fun))
(unless (fboundp 'fun)
- (autoload #'fun "foo" nil t)))))
+ (autoload #'fun "foo" nil t))
+ (ignore
+ (add-to-list 'interpreter-mode-alist '("interp" . fun))))))
(ert-deftest use-package-test-normalize/:mode ()
(flet ((norm (&rest args)
(match-expansion
(use-package foo :mode "interp")
`(progn
- (add-to-list 'auto-mode-alist '("interp" . foo))
(unless (fboundp 'foo)
- (autoload #'foo "foo" nil t)))))
+ (autoload #'foo "foo" nil t))
+ (ignore
+ (add-to-list 'auto-mode-alist '("interp" . foo))))))
(ert-deftest use-package-test/:mode-2 ()
(match-expansion
(use-package foo :mode ("interp" . fun))
`(progn
- (add-to-list 'auto-mode-alist '("interp" . fun))
(unless (fboundp 'fun)
- (autoload #'fun "foo" nil t)))))
+ (autoload #'fun "foo" nil t))
+ (ignore
+ (add-to-list 'auto-mode-alist '("interp" . fun))))))
(ert-deftest use-package-test/:magic-1 ()
(match-expansion
(use-package foo :magic "interp")
`(progn
- (add-to-list 'magic-mode-alist '("interp" . foo))
(unless (fboundp 'foo)
- (autoload #'foo "foo" nil t)))))
+ (autoload #'foo "foo" nil t))
+ (ignore
+ (add-to-list 'magic-mode-alist '("interp" . foo))))))
(ert-deftest use-package-test/:magic-2 ()
(match-expansion
(use-package foo :magic ("interp" . fun))
`(progn
- (add-to-list 'magic-mode-alist '("interp" . fun))
(unless (fboundp 'fun)
- (autoload #'fun "foo" nil t)))))
+ (autoload #'fun "foo" nil t))
+ (ignore
+ (add-to-list 'magic-mode-alist '("interp" . fun))))))
(ert-deftest use-package-test/:magic-fallback-1 ()
(match-expansion
(use-package foo :magic-fallback "interp")
`(progn
- (add-to-list 'magic-fallback-mode-alist '("interp" . foo))
(unless (fboundp 'foo)
- (autoload #'foo "foo" nil t)))))
+ (autoload #'foo "foo" nil t))
+ (ignore
+ (add-to-list 'magic-fallback-mode-alist '("interp" . foo))))))
(ert-deftest use-package-test/:magic-fallback-2 ()
(match-expansion
(use-package foo :magic-fallback ("interp" . fun))
`(progn
- (add-to-list 'magic-fallback-mode-alist '("interp" . fun))
(unless (fboundp 'fun)
- (autoload #'fun "foo" nil t)))))
+ (autoload #'fun "foo" nil t))
+ (ignore
+ (add-to-list 'magic-fallback-mode-alist '("interp" . fun))))))
(ert-deftest use-package-test/:commands-1 ()
(match-expansion
(with-demoted-errors
"Cannot load foo: %S" nil
(load "foo" nil t))))
- (add-hook 'hook-hook #'fun)
(unless (fboundp 'fun)
(autoload #'fun "foo" nil t))
(eval-when-compile
(autoload #'key "foo" nil t))
(eval-when-compile
(declare-function key "foo"))
+ (ignore
+ (add-hook 'hook-hook #'fun))
(ignore
(bind-keys :package foo ("C-a" . key))))))))