Skip to content

Commit

Permalink
Move use-package integration in separate folder
Browse files Browse the repository at this point in the history
  • Loading branch information
yyoncho committed Jul 3, 2021
1 parent 192cbd6 commit 690e25f
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions lsp-use-package.el → use-package/lsp-use-package.el
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
;;; lsp-use-package.el --- use-package integration -*- lexical-binding: t; -*-
;;; lsp-use-package.el --- Integration with `use-package' -*- lexical-binding: t; -*-

;; Copyright (C) 2021 Ivan Yonchovski

;; Author: Ivan Yonchovski <yyoncho@gmail.com>
;; Keywords: convenience

;; Package-Requires: ((use-package "2.4.1") (emacs "26.1") (lsp-mode "7.0"))
;; Version: 0.0.1

;; URL: https://github.com/emacs-lsp/lsp-mode

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
Expand All @@ -27,13 +32,14 @@

;;; Code:

(declare-function use-package-process-keywords "ext:use-package")
(declare-function use-package-concat "ext:use-package")
(declare-function use-package-non-nil-symbolp "ext:use-package")
(declare-function use-package-error "ext:use-package")
(declare-function use-package-as-one "ext:use-package")
(require 'use-package)

(defun use-package-handler/:ensure-servers (name _keyword arg rest state)
"The `:ensure-servers' handler.
NAME of the section.
ARG - the value in that section
STATE - current state of the `use-package' expansion.
REST - the remaining content."
(let ((body (use-package-process-keywords name rest state)))
(use-package-concat
(mapcar (lambda (var)
Expand All @@ -43,9 +49,9 @@

;;;###autoload
(defun use-package-normalize-ensure-servers (_name label arg &optional _recursed)
"Normalize the arguments to diminish down to a list of one of two forms:
SYMBOL
(SYMBOL . STRING)"
"Normalize the arguments to diminish down to a list of symbols.
LABEL - the label for the section.
ARG - keyword value to normalize."
(cond
((use-package-non-nil-symbolp arg)
(list arg))
Expand All @@ -57,6 +63,8 @@

;;;###autoload
(defun use-package-normalize/:ensure-servers (name keyword args)
"Normalize ARGS under KEYWORD section.
NAME is the name of the section."
(use-package-as-one (symbol-name keyword) args
(apply-partially #'use-package-normalize-ensure-servers name) t))

Expand Down

0 comments on commit 690e25f

Please sign in to comment.