Skip to content

Commit b1d1560

Browse files
authored
Add a few ‘eval-and-compile’ forms. (#1992)
Depending whether and how these files are byte-compiled, the definitions need to be available during compile time as well.
1 parent c7199f6 commit b1d1560

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

lsp-protocol.el

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@
3232
(require 'ht)
3333
(require 's)
3434

35-
(defun lsp-keyword->symbol (keyword)
36-
"Convert a KEYWORD to symbol."
37-
(intern (substring (symbol-name keyword) 1)))
35+
(eval-and-compile
36+
(defun lsp-keyword->symbol (keyword)
37+
"Convert a KEYWORD to symbol."
38+
(intern (substring (symbol-name keyword) 1)))
3839

39-
(defun lsp-keyword->string (keyword)
40-
"Convert a KEYWORD to string."
41-
(substring (symbol-name keyword) 1))
40+
(defun lsp-keyword->string (keyword)
41+
"Convert a KEYWORD to string."
42+
(substring (symbol-name keyword) 1))
4243

43-
(defvar lsp-use-plists nil)
44+
(defvar lsp-use-plists nil))
4445

4546
(defmacro lsp-interface (&rest interfaces)
4647
"Generate LSP bindings from INTERFACES triplet.

test/lsp-protocol-test.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
(require 'lsp-protocol)
2929
(require 'ert)
3030

31-
(lsp-interface (MyPosition (:line :character :camelCase) (:optional)))
31+
(eval-and-compile
32+
(lsp-interface (MyPosition (:line :character :camelCase) (:optional))))
3233

3334
(ert-deftest lsp-test-lsp-interface ()
3435
(let ((position (lsp-make-my-position :character 1 :line 2)))

0 commit comments

Comments
 (0)