]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove several unnecessary calls to `ignore'
authorJohn Wiegley <johnw@newartisans.com>
Fri, 8 Dec 2017 06:40:48 +0000 (22:40 -0800)
committerJohn Wiegley <johnw@newartisans.com>
Fri, 8 Dec 2017 06:40:48 +0000 (22:40 -0800)
lisp/use-package/use-package-bind-key.el
lisp/use-package/use-package-chords.el
lisp/use-package/use-package-core.el
lisp/use-package/use-package-ensure.el
test/lisp/use-package/use-package-tests.el

index 6a8e3fbe8eb40201a351d11046ca88a92925d84f..b26c812bf5875ca840b2a3a78e4d0971625f7574 100644 (file)
@@ -128,9 +128,8 @@ deferred until the prefix key sequence is pressed."
     (name keyword args rest state &optional bind-macro)
   (use-package-concat
    (use-package-process-keywords name rest state)
-   `((ignore
-      (,(if bind-macro bind-macro 'bind-keys)
-       :package ,name ,@(use-package-normalize-commands args))))))
+   `((,(if bind-macro bind-macro 'bind-keys)
+      :package ,name ,@(use-package-normalize-commands args)))))
 
 (defun use-package-handler/:bind* (name keyword arg rest state)
   (use-package-handler/:bind name keyword arg rest state 'bind-keys*))
@@ -144,21 +143,19 @@ deferred until the prefix key sequence is pressed."
 
 ;;;###autoload
 (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-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)))))
+   (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)
index 8cdd30990cb8f3b902492aa4083998aa795e7b03..63a9737109f2a5fe829e9d8bfdb3cd0859cde4ce 100644 (file)
@@ -39,9 +39,8 @@
              (use-package-sort-keywords
               (use-package-plist-maybe-put rest :defer t))
              (use-package-plist-append state :commands commands))
-           `((ignore
-              ,(macroexpand
-                `(bind-chords :package ,name ,@arg)))))))
+           `(,(macroexpand
+               `(bind-chords :package ,name ,@arg))))))
     (use-package-handler/:preface name keyword chord-binder rest state)))
 
 (add-to-list 'use-package-keywords :chords t)
index 001ffde1534b7d061316ec7cc32ae595c7309a2e..9e32fb477d3907388a61cca834be3aa7a984b2a0 100644 (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
           (format "Loading package %s" name)
         `((if (not ,(use-package-load-name name t))
-              (ignore
-               (display-warning 'use-package
-                                (format "Cannot load %s" ',name)
-                                :error))
+              (display-warning 'use-package
+                               (format "Cannot load %s" ',name)
+                               :error)
             ,@body))))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -906,14 +905,13 @@ If RECURSED is non-nil, recurse into sublists."
   "Handle keywords which add regexp/mode pairs to an alist."
   (use-package-concat
    (use-package-process-keywords name rest state)
-   `((ignore
-      ,@(mapcar
-         #'(lambda (thing)
-             `(add-to-list
-               ',alist
-               ',(cons (use-package-normalize-regex (car thing))
-                       (cdr thing))))
-         (use-package-normalize-commands args))))))
+   (mapcar
+    #'(lambda (thing)
+        `(add-to-list
+          ',alist
+          ',(cons (use-package-normalize-regex (car thing))
+                  (cdr thing))))
+    (use-package-normalize-commands args))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
@@ -1101,7 +1099,7 @@ meaning:
                       (setq msg
                             (concat msg
                                     " (see the *use-package* buffer)"))))
-                (ignore (display-warning 'use-package msg :error)))))
+                (display-warning 'use-package msg :error))))
         ,@(let ((use-package--hush-function
                  (apply-partially #'use-package-hush context)))
             (funcall use-package--hush-function keyword
@@ -1175,21 +1173,20 @@ meaning:
   "Generate use-package custom keyword code."
   (use-package-concat
    (use-package-process-keywords name rest state)
-   `((ignore
-      ,@(cl-mapcan
-         #'(lambda (def)
-             (let ((syms (car def))
-                   (fun (cdr def)))
-               (when fun
-                 (mapcar
-                  #'(lambda (sym)
-                      `(add-hook
-                        (quote ,(intern
-                                 (concat (symbol-name sym)
-                                         use-package-hook-name-suffix)))
-                        (function ,fun)))
-                  (if (use-package-non-nil-symbolp syms) (list syms) syms)))))
-         (use-package-normalize-commands args))))))
+   (cl-mapcan
+    #'(lambda (def)
+        (let ((syms (car def))
+              (fun (cdr def)))
+          (when fun
+            (mapcar
+             #'(lambda (sym)
+                 `(add-hook
+                   (quote ,(intern
+                            (concat (symbol-name sym)
+                                    use-package-hook-name-suffix)))
+                   (function ,fun)))
+             (if (use-package-non-nil-symbolp syms) (list syms) syms)))))
+    (use-package-normalize-commands args))))
 
 ;;;; :commands
 
@@ -1494,11 +1491,10 @@ this file.  Usage:
         (condition-case-unless-debug err
             (use-package-core name args)
           (error
-           (ignore
-            (display-warning
-             'use-package
-             (format "Failed to parse package %s: %s"
-                     name (error-message-string err)) :error)))))
+           (display-warning
+            'use-package
+            (format "Failed to parse package %s: %s"
+                    name (error-message-string err)) :error))))
       (when use-package-compute-statistics
         `((use-package-statistics-gather :use-package ',name t)))))))
 
index 3ae8201dc240e031a45b624af04a2c5463379234..1a76b883e1c365122e42f68e1fe9389200590ba4 100644 (file)
@@ -177,11 +177,10 @@ manually updated package."
                   (package-install package))
                 t)
             (error
-             (ignore
-              (display-warning 'use-package
-                               (format "Failed to install %s: %s"
-                                       name (error-message-string err))
-                               :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)
index 0b40fb582ad673cf325a4ad45e4eae5d4231e581..5ba6db8a4b59a1926d91055bb809e13022beb2b1 100644 (file)
       (unless
           (fboundp 'key2)
         (autoload #'key2 "foo" nil t))
-      (ignore
-       (bind-keys :package foo
-                  ("C-k" . key1)
-                  ("C-u" . key2))))))
+      (bind-keys :package foo
+                 ("C-k" . key1)
+                 ("C-u" . key2)))))
 
 (ert-deftest use-package-test/:bind-2 ()
   (match-expansion
         (autoload #'key1 "foo" nil t))
       (unless (fboundp 'key2)
         (autoload #'key2 "foo" nil t))
-      (ignore
-       (bind-keys :package foo
-                  ("C-k" . key1)
-                  ("C-u" . key2))))))
+      (bind-keys :package foo
+                 ("C-k" . key1)
+                 ("C-u" . key2)))))
 
 (ert-deftest use-package-test/:bind-3 ()
   (match-expansion
       (unless
           (fboundp 'key2)
         (autoload #'key2 "foo" nil t))
-      (ignore
-       (bind-keys :package foo :map my-map
-                  ("C-k" . key1)
-                  ("C-u" . key2))))))
+      (bind-keys :package foo :map my-map
+                 ("C-k" . key1)
+                 ("C-u" . key2)))))
 
 (ert-deftest use-package-test/:bind-4 ()
   (should-error
    (match-expansion
     (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 ()
   (match-expansion
         (autoload #'key1 "foo" nil t))
       (unless (fboundp 'key2)
         (autoload #'key2 "foo" nil t))
-      (ignore
-       (bind-keys :package foo
-                  ("C-k" . key1)
-                  :map my-map
-                  ("C-u" . key2))))))
+      (bind-keys :package foo
+                 ("C-k" . key1)
+                 :map my-map
+                 ("C-u" . key2)))))
 
 (ert-deftest use-package-test/:bind-6 ()
   (match-expansion
         (autoload #'key2 "foo" nil t))
       (unless (fboundp 'key3)
         (autoload #'key3 "foo" nil t))
-      (ignore
-       (bind-keys :package foo
-                  ("C-k" . key1)
-                  :map my-map ("C-u" . key2)
-                  :map my-map2 ("C-u" . key3))))))
+      (bind-keys :package foo
+                 ("C-k" . key1)
+                 :map my-map ("C-u" . key2)
+                 :map my-map2 ("C-u" . key3)))))
 
 (ert-deftest use-package-test/:bind-7 ()
   (match-expansion
       (use-package-ensure-elpa 'foo '(t) 'nil)
       (unless (fboundp 'browse-at-remote)
         (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 ()
   (match-expansion
         (autoload #'foo "foo" nil t))
       (unless (fboundp 'bar)
         (autoload #'bar "foo" nil t))
-      (ignore
-       (bind-keys :package foo :map foo-map
-                  ("C-c r" . foo)
-                  ("C-c r" . bar))))))
+      (bind-keys :package foo :map foo-map
+                 ("C-c r" . foo)
+                 ("C-c r" . bar)))))
 
 (ert-deftest use-package-test/:bind*-1 ()
   (match-expansion
    `(progn
       (unless (fboundp 'key)
         (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 ()
   (match-expansion
    (use-package foo :bind-keymap ("C-k" . key))
-   `(ignore
-     (bind-key "C-k"
-               #'(lambda nil
-                   (interactive)
-                   (use-package-autoload-keymap 'key 'foo nil))))))
+   `(bind-key "C-k"
+              #'(lambda nil
+                  (interactive)
+                  (use-package-autoload-keymap 'key 'foo nil)))))
 
 (ert-deftest use-package-test/:bind-keymap*-1 ()
   (match-expansion
    (use-package foo :bind-keymap* ("C-k" . key))
-   `(ignore
-     (bind-key* "C-k"
-                #'(lambda ()
-                    (interactive)
-                    (use-package-autoload-keymap 'key 'foo t))))))
+   `(bind-key* "C-k"
+               #'(lambda ()
+                   (interactive)
+                   (use-package-autoload-keymap 'key 'foo t)))))
 
 (ert-deftest use-package-test/:interpreter-1 ()
   (match-expansion
    `(progn
       (unless (fboundp 'foo)
         (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 ()
   (match-expansion
    `(progn
       (unless (fboundp 'fun)
         (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 ()
   (flet ((norm (&rest args)
    `(progn
       (unless (fboundp 'foo)
         (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 ()
   (match-expansion
    `(progn
       (unless (fboundp 'fun)
         (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 ()
   (match-expansion
    `(progn
       (unless (fboundp 'foo)
         (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 ()
   (match-expansion
    `(progn
       (unless (fboundp 'fun)
         (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 ()
   (match-expansion
    `(progn
       (unless (fboundp 'foo)
         (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 ()
   (match-expansion
    `(progn
       (unless (fboundp 'fun)
         (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 ()
   (match-expansion
           (autoload #'fun "foo" nil t))
         (eval-when-compile
           (declare-function fun "foo"))
-        (ignore
-         (add-hook 'hook-hook #'fun))
-        (ignore
-         (bind-keys :package foo ("C-a" . key)))))))
+        (add-hook 'hook-hook #'fun)
+        (bind-keys :package foo ("C-a" . key))))))
 
 (ert-deftest use-package-test/:hook-2 ()
   (match-expansion
    `(progn
       (unless (fboundp 'fun)
         (autoload #'fun "foo" nil t))
-      (ignore
-       (add-hook 'hook-hook #'fun)))))
+      (add-hook 'hook-hook #'fun))))
 
 (ert-deftest use-package-test/:hook-3 ()
   (let ((use-package-hook-name-suffix nil))
      `(progn
         (unless (fboundp 'fun)
           (autoload #'fun "foo" nil t))
-        (ignore
-         (add-hook 'hook #'fun))))))
+        (add-hook 'hook #'fun)))))
 
 (ert-deftest use-package-test/:hook-4 ()
   (let ((use-package-hook-name-suffix "-special"))
      `(progn
         (unless (fboundp 'fun)
           (autoload #'fun "foo" nil t))
-        (ignore
-         (add-hook 'hook-special #'fun))))))
+        (add-hook 'hook-special #'fun)))))
 
 (ert-deftest use-package-test/:hook-5 ()
   (match-expansion
       (eval-after-load 'elisp-mode
         '(progn
            (require 'erefactor nil nil)
-           (ignore
-            (add-hook
-             'emacs-lisp-mode-hook
-             #'(lambda nil
-                 (bind-key "\ 3\16" erefactor-map emacs-lisp-mode-map)))))))))
+           (add-hook
+            'emacs-lisp-mode-hook
+            #'(lambda nil
+                (bind-key "\ 3\16" erefactor-map emacs-lisp-mode-map))))))))
 
 (ert-deftest use-package-test/:hook-6 ()
   (match-expansion
         '(progn
            (unless (fboundp 'function)
              (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 ()
   (match-expansion
       (eval-after-load 'elisp-mode
         '(progn
            (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 ()
   (flet ((norm (&rest args)
         #'(lambda (keyword err)
             (let ((msg (format "%s/%s: %s" 'foo keyword
                                (error-message-string err))))
-              (ignore
-               (display-warning 'use-package msg :error)))))
+              (display-warning 'use-package msg :error))))
       (condition-case-unless-debug err
           (require 'foo nil nil)
         (error
            (require 'counsel nil nil)
            (if (fboundp 'diminish)
                (diminish 'counsel-mode))
-           (ignore
-            (bind-keys :package counsel
-                       ("C-*" . counsel-org-agenda-headlines)
-                       ("M-x" . counsel-M-x))))))))
+           (bind-keys :package counsel
+                      ("C-*" . counsel-org-agenda-headlines)
+                      ("M-x" . counsel-M-x)))))))
 
 (ert-deftest use-package-test/:config-1 ()
   (match-expansion
         (autoload #'mu4e "mu4e" nil t))
       (eval-after-load 'mu4e
         '(progn (config) t))
-      (ignore
-       (bind-keys :package mu4e ("<f9>" . mu4e))))))
+      (bind-keys :package mu4e ("<f9>" . mu4e)))))
 
 (ert-deftest use-package-test/543 ()
   (match-expansion
       (unless
           (fboundp 'company-try-hard)
         (autoload #'company-try-hard "company-try-hard" nil t))
-      (ignore
-       (bind-keys :package company-try-hard
-                  ("C-c M-/" . company-try-hard)
-                  :map company-active-map
-                  ("C-c M-/" . company-try-hard))))))
+      (bind-keys :package company-try-hard
+                 ("C-c M-/" . company-try-hard)
+                 :map company-active-map
+                 ("C-c M-/" . company-try-hard)))))
 
 (ert-deftest use-package-test/558 ()
   (match-expansion
         '(progn
            (message "test. helm start")
            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 ()
   (match-expansion