emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/csharp-mode 2595b90 449/459: Revert "Tweak mode to not


From: ELPA Syncer
Subject: [elpa] externals/csharp-mode 2595b90 449/459: Revert "Tweak mode to not require tree-sitter packages"
Date: Sun, 22 Aug 2021 14:00:20 -0400 (EDT)

branch: externals/csharp-mode
commit 2595b901387e3f7eb5e8359ced65e6275f95e082
Author: Theodor Thornhill <theo@thornhill.no>
Commit: Theodor Thornhill <theo@thornhill.no>

    Revert "Tweak mode to not require tree-sitter packages"
    
    This reverts commit 6988939c724d8109c51e78e5106fd0cd83de6fbe.
---
 .gitignore            |  4 ----
 csharp-mode.el        | 30 ++++++++++++++++++++----------
 csharp-tree-sitter.el | 22 +++++-----------------
 3 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/.gitignore b/.gitignore
index 55c2d12..f3d8a8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,10 +22,6 @@ 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 f30c16c..6329290 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"))
+;; Package-Requires: ((emacs "26.1") (tree-sitter "0.15.1") 
(tree-sitter-indent "0.1") (tree-sitter-langs "0.10.0"))
 
 ;; 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,6 +27,8 @@
 ;;; Code:
 
 
+(when (version< emacs-version "25.1")
+  (require 'cl))
 (require 'cc-mode)
 (require 'cc-langs)
 
@@ -67,11 +69,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"))
@@ -346,7 +348,8 @@ 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)
+  :type 'symbol
+  :group 'csharp)
 
 (defcustom csharp-font-lock-extra-types
   (list csharp--regex-type-name)
@@ -399,7 +402,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)))
@@ -419,7 +422,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
@@ -543,6 +546,12 @@ 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.
 
@@ -552,8 +561,9 @@ 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)))
-  (run-mode-hooks 'c-mode-common-hook))
+  (c-run-mode-hooks 'c-mode-common-hook 'csharp-mode-hook))
 
 (provide 'csharp-mode)
 
diff --git a/csharp-tree-sitter.el b/csharp-tree-sitter.el
index 3979f09..7fac9c4 100644
--- a/csharp-tree-sitter.el
+++ b/csharp-tree-sitter.el
@@ -29,22 +29,10 @@
 (require 'cl-extra)
 (require 'seq)
 
-(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 'tree-sitter)
+(require 'tree-sitter-hl)
+(require 'tree-sitter-indent)
+(require 'tree-sitter-langs)
 
 (require 'csharp-compilation)
 
@@ -53,7 +41,7 @@
 
 ;;; Tree-sitter
 
-(defconst csharp-mode-tree-sitter-patterns
+(setq csharp-mode-tree-sitter-patterns
   [ ;; Various constructs
    (comment) @comment
    (modifier) @keyword



reply via email to

[Prev in Thread] Current Thread [Next in Thread]