branch: elpa/flymake-collection
commit 2caa1099d1e0608a0797a823172043b4b1eacb14
Author: Mohsin Kaleem <mohk...@kisara.moe>
Commit: Mohsin Kaleem <mohk...@kisara.moe>

    Merge use-package integration into flymake-rest-hook
    
    No need for a separate file for this XD.
---
 flymake-rest-hook-use-package.el | 51 ----------------------------------------
 flymake-rest-hook.el             | 31 +++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 52 deletions(-)

diff --git a/flymake-rest-hook-use-package.el b/flymake-rest-hook-use-package.el
deleted file mode 100644
index abf5feead7..0000000000
--- a/flymake-rest-hook-use-package.el
+++ /dev/null
@@ -1,51 +0,0 @@
-;;; flymake-rest-use-package.el --- use-package extensions for flymake-rest 
-*- lexical-binding: t -*-
-
-;; Copyright (c) 2021 Mohsin Kaleem
-
-;; Permission is hereby granted, free of charge, to any person obtaining a copy
-;; of this software and associated documentation files (the "Software"), to 
deal
-;; in the Software without restriction, including without limitation the rights
-;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-;; copies of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be included in 
all
-;; copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
-;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
-;; SOFTWARE.
-
-;;; Commentary
-;; This file defines a use-package extension for pushing entries onto
-;; `flymake-rest-config'.
-
-;;; Code:
-
-(require 'use-package-core)
-
-(defvar flymake-rest-config) ;; In 
[[file:flymake-rest-hook.el][flymake-rest-hook.el]].
-
-;; Add to use-package-keywords, just after :custom.
-(unless (member :flymake-hook use-package-keywords)
-  (let ((tail (nthcdr (cl-position :custom use-package-keywords)
-                      use-package-keywords)))
-    (setcdr tail (cons :flymake-hook (cdr tail)))))
-
-(defun use-package-normalize/:flymake-hook (_name _keyword args)
-  args)
-
-(defun use-package-handler/:flymake-hook (name-symbol _ hooks rest state)
-  (let ((body (use-package-process-keywords name-symbol rest state)))
-    (use-package-concat
-     (cl-loop for it in hooks
-              collect `(push (quote ,it) flymake-rest-config))
-     body)))
-
-(provide 'flymake-rest-hook-use-package)
-
-;;; flymake-rest-hook-use-package.el ends here
diff --git a/flymake-rest-hook.el b/flymake-rest-hook.el
index fa6aa243f9..c52f8b7b03 100644
--- a/flymake-rest-hook.el
+++ b/flymake-rest-hook.el
@@ -101,7 +101,8 @@
 
 (defcustom flymake-rest-hook-ignore-modes nil
   "List of modes in which `flymake-rest-hook' is inhibited."
-  :type '(list symbol))
+  :type '(list symbol)
+  :group 'flymake-rest)
 
 (defun flymake-rest-hook-set-backends ()
   "Setup `flymake-diagnostic-functions' using `flymake-rest-config'."
@@ -122,6 +123,34 @@
   "Tear down flymake-hook."
   (remove-hook 'after-change-major-mode-hook #'flymake-rest-hook-set-backends))
 
+
+;;; `use-package' integration
+
+;;;###autoload
+(with-eval-after-load 'use-package-core
+  (defvar flymake-rest-config)
+
+  (declare-function use-package-concat "use-package-core")
+  (declare-function use-package-process-keywords "use-package-core")
+  (defvar use-package-keywords)
+  (defvar use-package-deferring-keywords)
+
+  ;; Add to use-package-keywords, just after :custom.
+  (unless (member :flymake-hook use-package-keywords)
+    (let ((tail (nthcdr (cl-position :custom use-package-keywords)
+                        use-package-keywords)))
+      (setcdr tail (cons :flymake-hook (cdr tail)))))
+
+  (defun use-package-normalize/:flymake-hook (_name _keyword args)
+    args)
+
+  (defun use-package-handler/:flymake-hook (name-symbol _ hooks rest state)
+    (let ((body (use-package-process-keywords name-symbol rest state)))
+      (use-package-concat
+       (cl-loop for it in hooks
+                collect `(push (quote ,it) flymake-rest-config))
+       body))))
+
 (provide 'flymake-rest-hook)
 
 ;;; flymake-rest-hook.el ends here

Reply via email to