From a273e3b39d05a4ceb7366e38665f3ac4b43264a6 Mon Sep 17 00:00:00 2001 From: slackline Date: Sun, 1 Oct 2023 07:16:34 +0100 Subject: [PATCH 1/5] Correcting typo in instructions for making tree-sitter support The instructions had `./src/scanner.cc` on the second line (i.e. an extra `c` in the file extension) which I have corrected. At the same time I've... + Moved the instructions from a list to code blocks and changed to sub-headings. + Moved comment in brackets about `/path/to/tree-sitter-langs` to the start of the section and included a link to the package. + Changed instruction for installation to be added to `init.el` rather than `.emacs` as this is the more common location (often `init.el` is nested within a `.emacs` directory). + Added instructions for installing and configuring with `use-package`. --- README.md | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 665724f..6dce9b4 100644 --- a/README.md +++ b/README.md @@ -5,34 +5,49 @@ # tree-sitter-ess-r -R with tree-sitter support. +[R](https://r-project.org) with [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) support. ## Installation -Clone this repository, or install from MELPA. Add the following to your `.emacs`: +Clone this repository, or install from MELPA. Add the following to your `init.el`: ``` elisp (require 'tree-sitter-ess-r) (add-hook 'ess-r-mode-hook 'tree-sitter-ess-r-mode-activate) ``` +If you use `use-package` you can install and configure with : + +``` elisp +(use-package tree-sitter-ess-r + :ensure t + :after (ess) + :hook (ess-r-mode . tree-sitter-ess-r-mode-activate)) +``` + or call interactively `M-x tree-sitter-ess-r-using-r-faces` -## Make tree-sitter to support r +## Make tree-sitter to support R -Linux +`/path/to/tree-sitter-langs/` is the path of your +[tree-sitter-langs](https://github.com/emacs-tree-sitter/tree-sitter-langs) package. -1. git clone https://github.com/r-lib/tree-sitter-r.git -2. gcc ./src/parser.c ./src/scanner.cc -lstdc++ -fPIC -I./ -I./src/ -I./src/tree_sitter --shared -o r.so -3. cp ./r.so /path/to/tree-sitter-langs/langs/bin (/path/to/tree-sitter-langs/ is path of your tree-sitter-langs package) -4. mkdir /path/to/tree-sitter-langs/queries/r -5. cp ./queries/* /path/to/tree-sitter-langs/queries/r +### Linux +``` bash +git clone https://github.com/r-lib/tree-sitter-r.git && cd tree-sitter-r +gcc ./src/parser.c ./src/scanner.c -lstdc++ -fPIC -I./ -I./src/ -I./src/tree_sitter --shared -o r.so +cp ./r.so /path/to/tree-sitter-langs/langs/bin +mkdir /path/to/tree-sitter-langs/queries/r +cp ./queries/* /path/to/tree-sitter-langs/queries/r +``` -Windows (MINGW64) +### Windows (MINGW64) -1. git clone https://github.com/r-lib/tree-sitter-r.git -2. gcc ./src/parser.c ./src/scanner.cc -lstdc++ -fPIC -I./ -I./src/ -I./src/tree_sitter --shared -o r.dll -3. cp ./r.dll /path/to/tree-sitter-langs/langs/bin (/path/to/tree-sitter-langs/ is path of your tree-sitter-langs package) -4. mkdir /path/to/tree-sitter-langs/queries/r -5. cp ./queries/* /path/to/tree-sitter-langs/queries/r +``` bash +git clone https://github.com/r-lib/tree-sitter-r.git +gcc ./src/parser.c ./src/scanner.c -lstdc++ -fPIC -I./ -I./src/ -I./src/tree_sitter --shared -o r.dll +cp ./r.dll /path/to/tree-sitter-langs/langs/bin (/path/to/tree-sitter-langs/ is path of your tree-sitter-langs package) +mkdir /path/to/tree-sitter-langs/queries/r +cp ./queries/* /path/to/tree-sitter-langs/queries/r +``` From e92d3123af06f721647dc49b7ce9bfb3f3b231b7 Mon Sep 17 00:00:00 2001 From: slackline Date: Sun, 1 Oct 2023 07:26:47 +0100 Subject: [PATCH 2/5] Fix workflow status badge --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6dce9b4..eecd5e1 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ [![MELPA](https://melpa.org/packages/tree-sitter-ess-r-badge.svg)](https://melpa.org/#/tree-sitter-ess-r) [![MELPA Stable](https://stable.melpa.org/packages/tree-sitter-ess-r-badge.svg)](https://stable.melpa.org/#/tree-sitter-ess-r) -[![Build Status](https://github.com/ShuguangSun/tree-sitter-ess-r/workflows/CI/badge.svg)](https://github.com/ShuguangSun/tree-sitter-ess-r/actions) +[![Build Status](https://github.com/ShuguangSun/tree-sitter-ess-r/actions/workflows/ci.yml/badge.svg)](https://github.com/ShuguangSun/tree-sitter-ess-r/actions) [![License](http://img.shields.io/:license-gpl3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0.html) + # tree-sitter-ess-r [R](https://r-project.org) with [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) support. From 4502a0a3f8f8146a9feb127cff5ada6c33542661 Mon Sep 17 00:00:00 2001 From: slackline Date: Sun, 1 Oct 2023 07:35:03 +0100 Subject: [PATCH 3/5] Additional instructions on adding tree-sitter-lang support --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index eecd5e1..2777354 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,11 @@ or call interactively `M-x tree-sitter-ess-r-using-r-faces` ## Make tree-sitter to support R -`/path/to/tree-sitter-langs/` is the path of your +You can install the [tree-sitter-langs](https://github.com/emacs-tree-sitter/tree-sitter-langs) which includes support +for R along with a number of other languages. Alternatively if you want to only add support for `tree-sitter-ess-r` to +your existing Tree-sitter languages you can install manually. + +In the following `/path/to/tree-sitter-langs/` is the path of your [tree-sitter-langs](https://github.com/emacs-tree-sitter/tree-sitter-langs) package. ### Linux From 92d337967b05a4c4f3a84d7edb368dc98952fee0 Mon Sep 17 00:00:00 2001 From: slackline Date: Sun, 1 Oct 2023 16:48:15 +0100 Subject: [PATCH 4/5] Removes text from Windows code section --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2777354..d6ecfd5 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ cp ./queries/* /path/to/tree-sitter-langs/queries/r ``` bash git clone https://github.com/r-lib/tree-sitter-r.git gcc ./src/parser.c ./src/scanner.c -lstdc++ -fPIC -I./ -I./src/ -I./src/tree_sitter --shared -o r.dll -cp ./r.dll /path/to/tree-sitter-langs/langs/bin (/path/to/tree-sitter-langs/ is path of your tree-sitter-langs package) +cp ./r.dll /path/to/tree-sitter-langs/langs/bin mkdir /path/to/tree-sitter-langs/queries/r cp ./queries/* /path/to/tree-sitter-langs/queries/r ``` From d456d2ae564cd08f69a0eb85d7547840021129f5 Mon Sep 17 00:00:00 2001 From: slackline Date: Sun, 8 Oct 2023 08:21:17 +0100 Subject: [PATCH 5/5] Adding Emacs 29.1 to workflows Closes #8 Adds Emacs 29.1 to the `emacs_version` matrix of workflows so that tests are carried out against the newer version of Emacs. --- .github/workflows/ci.yml | 1 + .github/workflows/eldev_lint.yml | 1 + .github/workflows/spell_check_wucuo.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db52f3c..43c0ed8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,7 @@ jobs: matrix: emacs_version: - 27.2 + - 29.1 steps: - name: Setup GNU Emacs diff --git a/.github/workflows/eldev_lint.yml b/.github/workflows/eldev_lint.yml index fb3aaf8..91fabb7 100644 --- a/.github/workflows/eldev_lint.yml +++ b/.github/workflows/eldev_lint.yml @@ -20,6 +20,7 @@ jobs: matrix: emacs_version: - 27.2 + - 29.1 steps: - name: Setup GNU Emacs diff --git a/.github/workflows/spell_check_wucuo.yml b/.github/workflows/spell_check_wucuo.yml index 451af94..a492713 100644 --- a/.github/workflows/spell_check_wucuo.yml +++ b/.github/workflows/spell_check_wucuo.yml @@ -16,6 +16,7 @@ jobs: matrix: emacs_version: - 27.2 + - 29.1 steps: - uses: purcell/setup-emacs@master