Remove several unnecessary calls to `ignore'

This commit is contained in:
John Wiegley 2017-12-07 22:40:48 -08:00
parent ae0d243681
commit 0068501aa0
5 changed files with 108 additions and 149 deletions

View file

@ -128,9 +128,8 @@ deferred until the prefix key sequence is pressed."
(name keyword args rest state &optional bind-macro) (name keyword args rest state &optional bind-macro)
(use-package-concat (use-package-concat
(use-package-process-keywords name rest state) (use-package-process-keywords name rest state)
`((ignore `((,(if bind-macro bind-macro 'bind-keys)
(,(if bind-macro bind-macro 'bind-keys) :package ,name ,@(use-package-normalize-commands args)))))
:package ,name ,@(use-package-normalize-commands args))))))
(defun use-package-handler/:bind* (name keyword arg rest state) (defun use-package-handler/:bind* (name keyword arg rest state)
(use-package-handler/:bind name keyword arg rest state 'bind-keys*)) (use-package-handler/:bind name keyword arg rest state 'bind-keys*))
@ -144,21 +143,19 @@ deferred until the prefix key sequence is pressed."
;;;###autoload ;;;###autoload
(defun use-package-handler/:bind-keymap (defun use-package-handler/:bind-keymap
(name keyword arg rest state &optional override) (name keyword args rest state &optional override)
(use-package-concat (use-package-concat
(use-package-process-keywords name rest state) (use-package-process-keywords name rest state)
`((ignore (mapcar
,@(mapcar #'(lambda (binding)
#'(lambda (binding) `(,(if override 'bind-key* 'bind-key)
`(,(if override ,(car binding)
'bind-key* #'(lambda ()
'bind-key) (interactive)
,(car binding) (use-package-autoload-keymap
#'(lambda () ',(cdr binding) ',(use-package-as-symbol name)
(interactive) ,override))))
(use-package-autoload-keymap args)))
',(cdr binding) ',(use-package-as-symbol name)
,override)))) arg)))))
;;;###autoload ;;;###autoload
(defun use-package-handler/:bind-keymap* (name keyword arg rest state) (defun use-package-handler/:bind-keymap* (name keyword arg rest state)

View file

@ -39,9 +39,8 @@
(use-package-sort-keywords (use-package-sort-keywords
(use-package-plist-maybe-put rest :defer t)) (use-package-plist-maybe-put rest :defer t))
(use-package-plist-append state :commands commands)) (use-package-plist-append state :commands commands))
`((ignore `(,(macroexpand
,(macroexpand `(bind-chords :package ,name ,@arg))))))
`(bind-chords :package ,name ,@arg)))))))
(use-package-handler/:preface name keyword chord-binder rest state))) (use-package-handler/:preface name keyword chord-binder rest state)))
(add-to-list 'use-package-keywords :chords t) (add-to-list 'use-package-keywords :chords t)

View file

@ -414,10 +414,9 @@ The BODY is a list of forms, so `((foo))' if only `foo' is being called."
(use-package-with-elapsed-timer (use-package-with-elapsed-timer
(format "Loading package %s" name) (format "Loading package %s" name)
`((if (not ,(use-package-load-name name t)) `((if (not ,(use-package-load-name name t))
(ignore (display-warning 'use-package
(display-warning 'use-package (format "Cannot load %s" ',name)
(format "Cannot load %s" ',name) :error)
:error))
,@body)))))) ,@body))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -906,14 +905,13 @@ If RECURSED is non-nil, recurse into sublists."
"Handle keywords which add regexp/mode pairs to an alist." "Handle keywords which add regexp/mode pairs to an alist."
(use-package-concat (use-package-concat
(use-package-process-keywords name rest state) (use-package-process-keywords name rest state)
`((ignore (mapcar
,@(mapcar #'(lambda (thing)
#'(lambda (thing) `(add-to-list
`(add-to-list ',alist
',alist ',(cons (use-package-normalize-regex (car thing))
',(cons (use-package-normalize-regex (car thing)) (cdr thing))))
(cdr thing)))) (use-package-normalize-commands args))))
(use-package-normalize-commands args))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
@ -1101,7 +1099,7 @@ meaning:
(setq msg (setq msg
(concat msg (concat msg
" (see the *use-package* buffer)")))) " (see the *use-package* buffer)"))))
(ignore (display-warning 'use-package msg :error))))) (display-warning 'use-package msg :error))))
,@(let ((use-package--hush-function ,@(let ((use-package--hush-function
(apply-partially #'use-package-hush context))) (apply-partially #'use-package-hush context)))
(funcall use-package--hush-function keyword (funcall use-package--hush-function keyword
@ -1175,21 +1173,20 @@ meaning:
"Generate use-package custom keyword code." "Generate use-package custom keyword code."
(use-package-concat (use-package-concat
(use-package-process-keywords name rest state) (use-package-process-keywords name rest state)
`((ignore (cl-mapcan
,@(cl-mapcan #'(lambda (def)
#'(lambda (def) (let ((syms (car def))
(let ((syms (car def)) (fun (cdr def)))
(fun (cdr def))) (when fun
(when fun (mapcar
(mapcar #'(lambda (sym)
#'(lambda (sym) `(add-hook
`(add-hook (quote ,(intern
(quote ,(intern (concat (symbol-name sym)
(concat (symbol-name sym) use-package-hook-name-suffix)))
use-package-hook-name-suffix))) (function ,fun)))
(function ,fun))) (if (use-package-non-nil-symbolp syms) (list syms) syms)))))
(if (use-package-non-nil-symbolp syms) (list syms) syms))))) (use-package-normalize-commands args))))
(use-package-normalize-commands args))))))
;;;; :commands ;;;; :commands
@ -1494,11 +1491,10 @@ this file. Usage:
(condition-case-unless-debug err (condition-case-unless-debug err
(use-package-core name args) (use-package-core name args)
(error (error
(ignore (display-warning
(display-warning 'use-package
'use-package (format "Failed to parse package %s: %s"
(format "Failed to parse package %s: %s" name (error-message-string err)) :error))))
name (error-message-string err)) :error)))))
(when use-package-compute-statistics (when use-package-compute-statistics
`((use-package-statistics-gather :use-package ',name t))))))) `((use-package-statistics-gather :use-package ',name t)))))))

View file

@ -177,11 +177,10 @@ manually updated package."
(package-install package)) (package-install package))
t) t)
(error (error
(ignore (display-warning 'use-package
(display-warning 'use-package (format "Failed to install %s: %s"
(format "Failed to install %s: %s" name (error-message-string err))
name (error-message-string err)) :error))))))))
:error)))))))))
;;;###autoload ;;;###autoload
(defun use-package-handler/:ensure (name keyword ensure rest state) (defun use-package-handler/:ensure (name keyword ensure rest state)

View file

@ -594,10 +594,9 @@
(unless (unless
(fboundp 'key2) (fboundp 'key2)
(autoload #'key2 "foo" nil t)) (autoload #'key2 "foo" nil t))
(ignore (bind-keys :package foo
(bind-keys :package foo ("C-k" . key1)
("C-k" . key1) ("C-u" . key2)))))
("C-u" . key2))))))
(ert-deftest use-package-test/:bind-2 () (ert-deftest use-package-test/:bind-2 ()
(match-expansion (match-expansion
@ -607,10 +606,9 @@
(autoload #'key1 "foo" nil t)) (autoload #'key1 "foo" nil t))
(unless (fboundp 'key2) (unless (fboundp 'key2)
(autoload #'key2 "foo" nil t)) (autoload #'key2 "foo" nil t))
(ignore (bind-keys :package foo
(bind-keys :package foo ("C-k" . key1)
("C-k" . key1) ("C-u" . key2)))))
("C-u" . key2))))))
(ert-deftest use-package-test/:bind-3 () (ert-deftest use-package-test/:bind-3 ()
(match-expansion (match-expansion
@ -622,17 +620,15 @@
(unless (unless
(fboundp 'key2) (fboundp 'key2)
(autoload #'key2 "foo" nil t)) (autoload #'key2 "foo" nil t))
(ignore (bind-keys :package foo :map my-map
(bind-keys :package foo :map my-map ("C-k" . key1)
("C-k" . key1) ("C-u" . key2)))))
("C-u" . key2))))))
(ert-deftest use-package-test/:bind-4 () (ert-deftest use-package-test/:bind-4 ()
(should-error (should-error
(match-expansion (match-expansion
(use-package foo :bind :map my-map ("C-k" . key1) ("C-u" . key2)) (use-package foo :bind :map my-map ("C-k" . key1) ("C-u" . key2))
`(ignore `(bind-keys :package foo))))
(bind-keys :package foo)))))
(ert-deftest use-package-test/:bind-5 () (ert-deftest use-package-test/:bind-5 ()
(match-expansion (match-expansion
@ -642,11 +638,10 @@
(autoload #'key1 "foo" nil t)) (autoload #'key1 "foo" nil t))
(unless (fboundp 'key2) (unless (fboundp 'key2)
(autoload #'key2 "foo" nil t)) (autoload #'key2 "foo" nil t))
(ignore (bind-keys :package foo
(bind-keys :package foo ("C-k" . key1)
("C-k" . key1) :map my-map
:map my-map ("C-u" . key2)))))
("C-u" . key2))))))
(ert-deftest use-package-test/:bind-6 () (ert-deftest use-package-test/:bind-6 ()
(match-expansion (match-expansion
@ -662,11 +657,10 @@
(autoload #'key2 "foo" nil t)) (autoload #'key2 "foo" nil t))
(unless (fboundp 'key3) (unless (fboundp 'key3)
(autoload #'key3 "foo" nil t)) (autoload #'key3 "foo" nil t))
(ignore (bind-keys :package foo
(bind-keys :package foo ("C-k" . key1)
("C-k" . key1) :map my-map ("C-u" . key2)
:map my-map ("C-u" . key2) :map my-map2 ("C-u" . key3)))))
:map my-map2 ("C-u" . key3))))))
(ert-deftest use-package-test/:bind-7 () (ert-deftest use-package-test/:bind-7 ()
(match-expansion (match-expansion
@ -677,8 +671,7 @@
(use-package-ensure-elpa 'foo '(t) 'nil) (use-package-ensure-elpa 'foo '(t) 'nil)
(unless (fboundp 'browse-at-remote) (unless (fboundp 'browse-at-remote)
(autoload #'browse-at-remote "foo" nil t)) (autoload #'browse-at-remote "foo" nil t))
(ignore (bind-keys :package foo ("C-c r" . browse-at-remote)))))
(bind-keys :package foo ("C-c r" . browse-at-remote))))))
(ert-deftest use-package-test/:bind-8 () (ert-deftest use-package-test/:bind-8 ()
(match-expansion (match-expansion
@ -693,10 +686,9 @@
(autoload #'foo "foo" nil t)) (autoload #'foo "foo" nil t))
(unless (fboundp 'bar) (unless (fboundp 'bar)
(autoload #'bar "foo" nil t)) (autoload #'bar "foo" nil t))
(ignore (bind-keys :package foo :map foo-map
(bind-keys :package foo :map foo-map ("C-c r" . foo)
("C-c r" . foo) ("C-c r" . bar)))))
("C-c r" . bar))))))
(ert-deftest use-package-test/:bind*-1 () (ert-deftest use-package-test/:bind*-1 ()
(match-expansion (match-expansion
@ -704,26 +696,23 @@
`(progn `(progn
(unless (fboundp 'key) (unless (fboundp 'key)
(autoload #'key "foo" nil t)) (autoload #'key "foo" nil t))
(ignore (bind-keys* :package foo ("C-k" . key)))))
(bind-keys* :package foo ("C-k" . key))))))
(ert-deftest use-package-test/:bind-keymap-1 () (ert-deftest use-package-test/:bind-keymap-1 ()
(match-expansion (match-expansion
(use-package foo :bind-keymap ("C-k" . key)) (use-package foo :bind-keymap ("C-k" . key))
`(ignore `(bind-key "C-k"
(bind-key "C-k" #'(lambda nil
#'(lambda nil (interactive)
(interactive) (use-package-autoload-keymap 'key 'foo nil)))))
(use-package-autoload-keymap 'key 'foo nil))))))
(ert-deftest use-package-test/:bind-keymap*-1 () (ert-deftest use-package-test/:bind-keymap*-1 ()
(match-expansion (match-expansion
(use-package foo :bind-keymap* ("C-k" . key)) (use-package foo :bind-keymap* ("C-k" . key))
`(ignore `(bind-key* "C-k"
(bind-key* "C-k" #'(lambda ()
#'(lambda () (interactive)
(interactive) (use-package-autoload-keymap 'key 'foo t)))))
(use-package-autoload-keymap 'key 'foo t))))))
(ert-deftest use-package-test/:interpreter-1 () (ert-deftest use-package-test/:interpreter-1 ()
(match-expansion (match-expansion
@ -731,8 +720,7 @@
`(progn `(progn
(unless (fboundp 'foo) (unless (fboundp 'foo)
(autoload #'foo "foo" nil t)) (autoload #'foo "foo" nil t))
(ignore (add-to-list 'interpreter-mode-alist '("interp" . foo)))))
(add-to-list 'interpreter-mode-alist '("interp" . foo))))))
(ert-deftest use-package-test/:interpreter-2 () (ert-deftest use-package-test/:interpreter-2 ()
(match-expansion (match-expansion
@ -740,8 +728,7 @@
`(progn `(progn
(unless (fboundp 'fun) (unless (fboundp 'fun)
(autoload #'fun "foo" nil t)) (autoload #'fun "foo" nil t))
(ignore (add-to-list 'interpreter-mode-alist '("interp" . fun)))))
(add-to-list 'interpreter-mode-alist '("interp" . fun))))))
(ert-deftest use-package-test-normalize/:mode () (ert-deftest use-package-test-normalize/:mode ()
(flet ((norm (&rest args) (flet ((norm (&rest args)
@ -764,8 +751,7 @@
`(progn `(progn
(unless (fboundp 'foo) (unless (fboundp 'foo)
(autoload #'foo "foo" nil t)) (autoload #'foo "foo" nil t))
(ignore (add-to-list 'auto-mode-alist '("interp" . foo)))))
(add-to-list 'auto-mode-alist '("interp" . foo))))))
(ert-deftest use-package-test/:mode-2 () (ert-deftest use-package-test/:mode-2 ()
(match-expansion (match-expansion
@ -773,8 +759,7 @@
`(progn `(progn
(unless (fboundp 'fun) (unless (fboundp 'fun)
(autoload #'fun "foo" nil t)) (autoload #'fun "foo" nil t))
(ignore (add-to-list 'auto-mode-alist '("interp" . fun)))))
(add-to-list 'auto-mode-alist '("interp" . fun))))))
(ert-deftest use-package-test/:magic-1 () (ert-deftest use-package-test/:magic-1 ()
(match-expansion (match-expansion
@ -782,8 +767,7 @@
`(progn `(progn
(unless (fboundp 'foo) (unless (fboundp 'foo)
(autoload #'foo "foo" nil t)) (autoload #'foo "foo" nil t))
(ignore (add-to-list 'magic-mode-alist '("interp" . foo)))))
(add-to-list 'magic-mode-alist '("interp" . foo))))))
(ert-deftest use-package-test/:magic-2 () (ert-deftest use-package-test/:magic-2 ()
(match-expansion (match-expansion
@ -791,8 +775,7 @@
`(progn `(progn
(unless (fboundp 'fun) (unless (fboundp 'fun)
(autoload #'fun "foo" nil t)) (autoload #'fun "foo" nil t))
(ignore (add-to-list 'magic-mode-alist '("interp" . fun)))))
(add-to-list 'magic-mode-alist '("interp" . fun))))))
(ert-deftest use-package-test/:magic-fallback-1 () (ert-deftest use-package-test/:magic-fallback-1 ()
(match-expansion (match-expansion
@ -800,8 +783,7 @@
`(progn `(progn
(unless (fboundp 'foo) (unless (fboundp 'foo)
(autoload #'foo "foo" nil t)) (autoload #'foo "foo" nil t))
(ignore (add-to-list 'magic-fallback-mode-alist '("interp" . foo)))))
(add-to-list 'magic-fallback-mode-alist '("interp" . foo))))))
(ert-deftest use-package-test/:magic-fallback-2 () (ert-deftest use-package-test/:magic-fallback-2 ()
(match-expansion (match-expansion
@ -809,8 +791,7 @@
`(progn `(progn
(unless (fboundp 'fun) (unless (fboundp 'fun)
(autoload #'fun "foo" nil t)) (autoload #'fun "foo" nil t))
(ignore (add-to-list 'magic-fallback-mode-alist '("interp" . fun)))))
(add-to-list 'magic-fallback-mode-alist '("interp" . fun))))))
(ert-deftest use-package-test/:commands-1 () (ert-deftest use-package-test/:commands-1 ()
(match-expansion (match-expansion
@ -1039,10 +1020,8 @@
(autoload #'fun "foo" nil t)) (autoload #'fun "foo" nil t))
(eval-when-compile (eval-when-compile
(declare-function fun "foo")) (declare-function fun "foo"))
(ignore (add-hook 'hook-hook #'fun)
(add-hook 'hook-hook #'fun)) (bind-keys :package foo ("C-a" . key))))))
(ignore
(bind-keys :package foo ("C-a" . key)))))))
(ert-deftest use-package-test/:hook-2 () (ert-deftest use-package-test/:hook-2 ()
(match-expansion (match-expansion
@ -1051,8 +1030,7 @@
`(progn `(progn
(unless (fboundp 'fun) (unless (fboundp 'fun)
(autoload #'fun "foo" nil t)) (autoload #'fun "foo" nil t))
(ignore (add-hook 'hook-hook #'fun))))
(add-hook 'hook-hook #'fun)))))
(ert-deftest use-package-test/:hook-3 () (ert-deftest use-package-test/:hook-3 ()
(let ((use-package-hook-name-suffix nil)) (let ((use-package-hook-name-suffix nil))
@ -1062,8 +1040,7 @@
`(progn `(progn
(unless (fboundp 'fun) (unless (fboundp 'fun)
(autoload #'fun "foo" nil t)) (autoload #'fun "foo" nil t))
(ignore (add-hook 'hook #'fun)))))
(add-hook 'hook #'fun))))))
(ert-deftest use-package-test/:hook-4 () (ert-deftest use-package-test/:hook-4 ()
(let ((use-package-hook-name-suffix "-special")) (let ((use-package-hook-name-suffix "-special"))
@ -1073,8 +1050,7 @@
`(progn `(progn
(unless (fboundp 'fun) (unless (fboundp 'fun)
(autoload #'fun "foo" nil t)) (autoload #'fun "foo" nil t))
(ignore (add-hook 'hook-special #'fun)))))
(add-hook 'hook-special #'fun))))))
(ert-deftest use-package-test/:hook-5 () (ert-deftest use-package-test/:hook-5 ()
(match-expansion (match-expansion
@ -1091,11 +1067,10 @@
(eval-after-load 'elisp-mode (eval-after-load 'elisp-mode
'(progn '(progn
(require 'erefactor nil nil) (require 'erefactor nil nil)
(ignore (add-hook
(add-hook 'emacs-lisp-mode-hook
'emacs-lisp-mode-hook #'(lambda nil
#'(lambda nil (bind-key "" erefactor-map emacs-lisp-mode-map))))))))
(bind-key "" erefactor-map emacs-lisp-mode-map)))))))))
(ert-deftest use-package-test/:hook-6 () (ert-deftest use-package-test/:hook-6 ()
(match-expansion (match-expansion
@ -1110,8 +1085,7 @@
'(progn '(progn
(unless (fboundp 'function) (unless (fboundp 'function)
(autoload #'function "erefactor" nil t)) (autoload #'function "erefactor" nil t))
(ignore (add-hook 'emacs-lisp-mode-hook #'function))))))
(add-hook 'emacs-lisp-mode-hook #'function)))))))
(ert-deftest use-package-test/:hook-7 () (ert-deftest use-package-test/:hook-7 ()
(match-expansion (match-expansion
@ -1125,8 +1099,7 @@
(eval-after-load 'elisp-mode (eval-after-load 'elisp-mode
'(progn '(progn
(require 'erefactor nil nil) (require 'erefactor nil nil)
(ignore (add-hook 'emacs-lisp-mode-hook #'(lambda nil (function))))))))
(add-hook 'emacs-lisp-mode-hook #'(lambda nil (function)))))))))
(ert-deftest use-package-test-normalize/:custom () (ert-deftest use-package-test-normalize/:custom ()
(flet ((norm (&rest args) (flet ((norm (&rest args)
@ -1182,8 +1155,7 @@
#'(lambda (keyword err) #'(lambda (keyword err)
(let ((msg (format "%s/%s: %s" 'foo keyword (let ((msg (format "%s/%s: %s" 'foo keyword
(error-message-string err)))) (error-message-string err))))
(ignore (display-warning 'use-package msg :error))))
(display-warning 'use-package msg :error)))))
(condition-case-unless-debug err (condition-case-unless-debug err
(require 'foo nil nil) (require 'foo nil nil)
(error (error
@ -1433,10 +1405,9 @@
(require 'counsel nil nil) (require 'counsel nil nil)
(if (fboundp 'diminish) (if (fboundp 'diminish)
(diminish 'counsel-mode)) (diminish 'counsel-mode))
(ignore (bind-keys :package counsel
(bind-keys :package counsel ("C-*" . counsel-org-agenda-headlines)
("C-*" . counsel-org-agenda-headlines) ("M-x" . counsel-M-x)))))))
("M-x" . counsel-M-x))))))))
(ert-deftest use-package-test/:config-1 () (ert-deftest use-package-test/:config-1 ()
(match-expansion (match-expansion
@ -1680,8 +1651,7 @@
(autoload #'mu4e "mu4e" nil t)) (autoload #'mu4e "mu4e" nil t))
(eval-after-load 'mu4e (eval-after-load 'mu4e
'(progn (config) t)) '(progn (config) t))
(ignore (bind-keys :package mu4e ("<f9>" . mu4e)))))
(bind-keys :package mu4e ("<f9>" . mu4e))))))
(ert-deftest use-package-test/543 () (ert-deftest use-package-test/543 ()
(match-expansion (match-expansion
@ -1719,11 +1689,10 @@
(unless (unless
(fboundp 'company-try-hard) (fboundp 'company-try-hard)
(autoload #'company-try-hard "company-try-hard" nil t)) (autoload #'company-try-hard "company-try-hard" nil t))
(ignore (bind-keys :package company-try-hard
(bind-keys :package company-try-hard ("C-c M-/" . company-try-hard)
("C-c M-/" . company-try-hard) :map company-active-map
:map company-active-map ("C-c M-/" . company-try-hard)))))
("C-c M-/" . company-try-hard))))))
(ert-deftest use-package-test/558 () (ert-deftest use-package-test/558 ()
(match-expansion (match-expansion
@ -1798,8 +1767,7 @@
'(progn '(progn
(message "test. helm start") (message "test. helm start")
t)) t))
(ignore (bind-keys :package helm ("C-c d" . helm-mini)))))
(bind-keys :package helm ("C-c d" . helm-mini))))))
(ert-deftest bind-key/:prefix-map () (ert-deftest bind-key/:prefix-map ()
(match-expansion (match-expansion