[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/csharp-mode 299d3f1 450/459: Don't require tree-sitter
From: |
ELPA Syncer |
Subject: |
[elpa] externals/csharp-mode 299d3f1 450/459: Don't require tree-sitter |
Date: |
Sun, 22 Aug 2021 14:00:20 -0400 (EDT) |
branch: externals/csharp-mode
commit 299d3f1ff834b8795f8efef195da5d880e7fa3ca
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Theodor Thornhill <theo@thornhill.no>
Don't require tree-sitter
Now we need to install the dependencies manually. This is to be able to
include
this mode into elpa.
---
.gitignore | 4 ++++
csharp-mode.el | 30 ++++++++++--------------------
csharp-tree-sitter.el | 22 +++++++++++++++++-----
3 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/.gitignore b/.gitignore
index f3d8a8a..55c2d12 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,10 @@ tramp
/eshell/history
/eshell/lastdir
+# GNU ELPA generated files
+/csharp-mode-autoloads.el
+/csharp-mode-pkg.el
+
# elpa packages
/elpa/
diff --git a/csharp-mode.el b/csharp-mode.el
index 6329290..f30c16c 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -8,7 +8,7 @@
;; Version : 0.11.0
;; Keywords : c# languages oop mode
;; X-URL : https://github.com/emacs-csharp/csharp-mode
-;; Package-Requires: ((emacs "26.1") (tree-sitter "0.15.1")
(tree-sitter-indent "0.1") (tree-sitter-langs "0.10.0"))
+;; Package-Requires: ((emacs "26.1"))
;; 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
@@ -27,8 +27,6 @@
;;; Code:
-(when (version< emacs-version "25.1")
- (require 'cl))
(require 'cc-mode)
(require 'cc-langs)
@@ -69,11 +67,11 @@
(c-add-language 'csharp-mode 'java-mode))
(c-lang-defconst c-make-mode-syntax-table
- csharp `(lambda ()
- (let ((table (make-syntax-table)))
- (c-populate-syntax-table table)
- (modify-syntax-entry ?@ "_" table)
- table)))
+ csharp (lambda ()
+ (let ((table (make-syntax-table)))
+ (c-populate-syntax-table table)
+ (modify-syntax-entry ?@ "_" table)
+ table)))
(c-lang-defconst c-identifier-syntax-modifications
csharp (append '((?@ . "w"))
@@ -348,8 +346,7 @@ Should be one of the font lock faces, such as
Needs to be set before `csharp-mode' is loaded, because of
compilation and evaluation time conflicts."
- :type 'symbol
- :group 'csharp)
+ :type 'symbol)
(defcustom csharp-font-lock-extra-types
(list csharp--regex-type-name)
@@ -402,7 +399,7 @@ compilation and evaluation time conflicts."
;;; Adding syntax constructs
(advice-add 'c-looking-at-inexpr-block
- :around 'csharp-looking-at-inexpr-block)
+ :around #'csharp-looking-at-inexpr-block)
(defun csharp-looking-at-inexpr-block (orig-fun &rest args)
(let ((res (csharp-at-lambda-header)))
@@ -422,7 +419,7 @@ compilation and evaluation time conflicts."
(cons 'inexpr (point))))))
(advice-add 'c-guess-basic-syntax
- :around 'csharp-guess-basic-syntax)
+ :around #'csharp-guess-basic-syntax)
(defun csharp-guess-basic-syntax (orig-fun &rest args)
(cond
@@ -546,12 +543,6 @@ compilation and evaluation time conflicts."
;; Custom variables
;;;###autoload
-(defcustom csharp-mode-hook nil
- "*Hook called by `csharp-mode'."
- :type 'hook
- :group 'csharp)
-
-;;;###autoload
(define-derived-mode csharp-mode prog-mode "C#"
"Major mode for editing Csharp code.
@@ -561,9 +552,8 @@ Key bindings:
(c-initialize-cc-mode t)
(c-init-language-vars csharp-mode)
(c-common-init 'csharp-mode)
- (easy-menu-add csharp-mode-menu)
(setq-local c-doc-comment-style '((csharp-mode . codedoc)))
- (c-run-mode-hooks 'c-mode-common-hook 'csharp-mode-hook))
+ (run-mode-hooks 'c-mode-common-hook))
(provide 'csharp-mode)
diff --git a/csharp-tree-sitter.el b/csharp-tree-sitter.el
index 7fac9c4..3979f09 100644
--- a/csharp-tree-sitter.el
+++ b/csharp-tree-sitter.el
@@ -29,10 +29,22 @@
(require 'cl-extra)
(require 'seq)
-(require 'tree-sitter)
-(require 'tree-sitter-hl)
-(require 'tree-sitter-indent)
-(require 'tree-sitter-langs)
+(when t
+ ;; In order for the package to be usable and installable (and hence
+ ;; compilable) without tree-sitter, wrap the `require's within a dummy `when'
+ ;; so they're only executed when loading this file but not when compiling it.
+ (require 'tree-sitter)
+ (require 'tree-sitter-hl)
+ (require 'tree-sitter-indent)
+ (require 'tree-sitter-langs))
+;; Vars and functions defined by the above packages:
+(defvar tree-sitter-major-mode-language-alist) ;From `tree-sitter-langs'.
+(declare-function tree-sitter-indent-mode "ext:tree-sitter-indent")
+(declare-function tree-sitter-indent-line "ext:tree-sitter-indent")
+(declare-function tree-sitter-hl-mode "ext:tree-sitter-hl")
+(declare-function tsc-node-end-position "ext:tree-sitter")
+(declare-function tsc-node-start-position "ext:tree-sitter")
+(declare-function tree-sitter-node-at-point "ext:tree-sitter")
(require 'csharp-compilation)
@@ -41,7 +53,7 @@
;;; Tree-sitter
-(setq csharp-mode-tree-sitter-patterns
+(defconst csharp-mode-tree-sitter-patterns
[ ;; Various constructs
(comment) @comment
(modifier) @keyword
- [elpa] externals/csharp-mode 6566964 440/459: Merge pull request #231 from emacs-csharp/bugfix/tree-sitter-crashes, (continued)
- [elpa] externals/csharp-mode 6566964 440/459: Merge pull request #231 from emacs-csharp/bugfix/tree-sitter-crashes, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 1c2b9cb 442/459: Add more nodes to beginning/end-of-defun, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode d942b27 441/459: Add tree-sitter based utility methods. (#232), ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f977800 443/459: Add indentation settings for lambda functions (#229), ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 40c183e 452/459: Adjust wording in readme, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 2641599 454/459: Fix spectacular mis-edit of readme, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 26f1f8c 457/459: Add switch_expression, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 69fe52b 453/459: Version bump, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 0edf059 445/459: Fix ci (#234), ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode dd30649 459/459: Bump version, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 299d3f1 450/459: Don't require tree-sitter,
ELPA Syncer <=
- [elpa] externals/csharp-mode 27cd2e8 456/459: Align argument to siblings, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 573f23c 458/459: Assign copyright over to the FSF, ELPA Syncer, 2021/08/22