Skip to content

Commit

Permalink
Move Lisp code to lisp/ directory
Browse files Browse the repository at this point in the history
  • Loading branch information
ubolonton committed Feb 24, 2020
1 parent 98b8939 commit 2c62f82
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
**/*.rs.bk
**/*.elc
grammars/
tree-sitter-dyn.*
lisp/tree-sitter-dyn.*
10 changes: 5 additions & 5 deletions Cask
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(package-file "tree-sitter.el")
(package-file "lisp/tree-sitter.el")

(files "*.el"
(files "lisp/*.el"
"README.md"
"tree-sitter-dyn.dylib"
"tree-sitter-dyn.so"
"tree-sitter-dyn.dll"
"lisp/tree-sitter-dyn.dylib"
"lisp/tree-sitter-dyn.so"
"lisp/tree-sitter-dyn.dll"
"Cargo.toml"
"Cargo.lock"
"src")
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ For consistency with Emacs's conventions, this binding has some differences comp
## Setup for Development
Clone this repo and add it to `load-path`.
Clone this repo and add its `lisp` directory to `load-path`.
If you want to hack on the high-level features (in Lisp) only:
- Evaluate this (once) to download the necessary binaries:
Expand Down
2 changes: 1 addition & 1 deletion bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ source "$here/env.bash"
cargo build --all $extra

MODULE_DIR="$PROJECT_ROOT/target/$TARGET"
cp -f "$MODULE_DIR/$MODULE_ORIGINAL" "./$MODULE_RENAMED"
cp -f "$MODULE_DIR/$MODULE_ORIGINAL" "./lisp/$MODULE_RENAMED"
)
2 changes: 1 addition & 1 deletion bin/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ cargo build --all $extra

Pop-Location

Copy-Item $module_dir\$module_name.dll $project_root\$module_renamed.dll
Copy-Item $module_dir\$module_name.dll $project_root\lisp\$module_renamed.dll
1 change: 0 additions & 1 deletion bin/env.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ export PROJECT_ROOT
export MODULE_ORIGINAL=${MODULE_ORIGINAL:-libtree_sitter_dyn.$ext}
export MODULE_NAME=${MODULE_NAME:-tree-sitter-dyn}
export MODULE_RENAMED=${MODULE_NAME}.$ext
export TEST_FILE=tree-sitter-tests.el
export EMACS=${EMACS:-emacs}
4 changes: 2 additions & 2 deletions bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ if [[ $* == "watch" ]]; then
)
else
$EMACS --batch \
--directory "$PROJECT_ROOT" \
--directory "$PROJECT_ROOT/lisp" \
-l ert \
-l "$TEST_FILE" \
-l tree-sitter-tests.el \
-f ert-run-tests-batch-and-exit
fi
4 changes: 2 additions & 2 deletions bin/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ if ($args[0] -eq "watch") {
# https://stackoverflow.com/questions/2095088/error-when-calling-3rd-party-executable-from-powershell-when-using-an-ide
$ErrorActionPreference = 'Continue'
emacs --batch `
--directory $project_root `
--directory "$project_root\lisp" `
-l ert `
-l tree-sitter-tests `
-l tree-sitter-tests.el `
-f ert-run-tests-batch-and-exit
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 7 additions & 3 deletions tree-sitter-langs.el → lisp/tree-sitter-langs.el
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@ If VERSION and OS are not spcified, use the defaults of
"List of language symbols and their corresponding grammar sources.")

(defconst tree-sitter-langs--grammars-dir
(file-name-as-directory
(concat (file-name-directory (locate-library "tree-sitter-langs"))
"grammars"))
(concat
(let ((this-dir (file-name-directory (locate-library "tree-sitter-langs"))))
(if (file-exists-p (concat this-dir "Cargo.toml"))
this-dir
(file-name-directory
(directory-file-name this-dir))))
"grammars")
"Directory to store grammar repos, for compilation.")

(defun tree-sitter-langs--source (lang-symbol)
Expand Down
6 changes: 4 additions & 2 deletions tree-sitter-tests.el → lisp/tree-sitter-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

(defun ts-test-full-path (relative-path)
"Return full path from project RELATIVE-PATH."
(concat (file-name-directory (locate-library "tree-sitter")) relative-path))
(concat (file-name-directory
(directory-file-name
(file-name-directory (locate-library "tree-sitter")))) relative-path))

(defun ts-test-tree-sexp (sexp)
"Check that the current syntax tree's sexp representation is SEXP."
Expand Down Expand Up @@ -130,7 +132,7 @@ tree is held (since nodes internally reference the tree)."
(garbage-collect)))

(ert-deftest conversion::position<->ts-point ()
(ts-test-with-temp-buffer "tree-sitter-tests.el"
(ts-test-with-temp-buffer "lisp/tree-sitter-tests.el"
(ert-info ("Testing buffer boundaries")
(let ((min (point-min))
(max (point-max)))
Expand Down
File renamed without changes.

0 comments on commit 2c62f82

Please sign in to comment.