[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/typst-ts-mode 998eed6f22 10/19: refacvtor: move variables
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/typst-ts-mode 998eed6f22 10/19: refacvtor: move variables to separate file |
Date: |
Thu, 24 Apr 2025 07:04:43 -0400 (EDT) |
branch: elpa/typst-ts-mode
commit 998eed6f22c600867b50dfe10ccf382dbbacccd4
Author: meowking <mr.meowking@posteo.com>
Commit: meowking <mr.meowking@posteo.com>
refacvtor: move variables to separate file
---
typst-ts-compile.el | 32 +----------
typst-ts-mode.el | 40 +-------------
typst-ts-variables.el | 147 +++++++++++++++++++++++++++++++++++++++++++++++++
typst-ts-watch-mode.el | 36 +-----------
4 files changed, 150 insertions(+), 105 deletions(-)
diff --git a/typst-ts-compile.el b/typst-ts-compile.el
index d397a7246b..cb030d61dc 100644
--- a/typst-ts-compile.el
+++ b/typst-ts-compile.el
@@ -19,37 +19,7 @@
;;; Code:
(require 'compile)
-
-(defgroup typst-ts-compile nil
- "Typst TS Compilation."
- :prefix "typst-ts-compile"
- :group 'typst-ts)
-
-(defcustom typst-ts-compile-executable-location "typst"
- "The location or name (if in variable `exec-path') for Typst executable."
- :type 'string)
-
-(defcustom typst-ts-compile-options ""
- "User defined compile options for `typst-ts-compile'.
-The compile options will be passed to the end of
-`<typst-executable> compile <current-file>' command."
- :type 'string)
-
-(defcustom typst-ts-output-directory ""
- "User defined output directory for `typst-ts-compile` and `typst-ts-watch`."
- :type 'string
- :group 'typst-ts)
-
-(defcustom typst-ts-compile-before-compilation-hook nil
- "Hook runs after compile."
- :type 'hook)
-
-(defcustom typst-ts-compile-after-compilation-hook nil
- "Hook runs after compile.
-Note the requirement of this hook is the same as
`compilation-finish-functions'.
-Also note that this hook runs with typst buffer(the buffer you are editing) as
-the current buffer."
- :type 'hook)
+(require 'typst-ts-variables)
(defun typst-ts-compile--compilation-finish-function (cur-buffer)
"Compilation finish function.
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 289ee8db7f..8508738451 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -43,45 +43,7 @@
(require 'typst-ts-lsp)
(require 'typst-ts-misc-commands)
(require 'typst-ts-transient)
-
-(defgroup typst-ts nil
- "Tree Sitter enabled Typst Writing."
- :prefix "typst-ts"
- :group 'text
- :group 'languages)
-
-
-(defcustom typst-ts-mode-grammar-location nil
- "Specify typst tree sitter grammar file location.
-This is used for grammar minimum version check. The modified time of the
-grammar file is used for comparing.
-This variable is used in `typst-ts-mode-check-grammar-version'."
- :type '(choice (string :tag "typst tree sitter grammar file location")
- (const :tag "Don't enable grammar version check" nil)))
-
-;; `git log -n1 --date=raw` or `git log -n1 --format="%at"`
-(defvar typst-ts-mode--grammar-minimum-version-timestamp 1713791627
- "Timestamp for the minimum supported typst tree sitter grammar version.")
-
-(defcustom typst-ts-mode-enable-raw-blocks-highlight nil
- "Whether to enable raw block highlighting.
-NOTE this option must be set before the first loading(opening typst file)"
- :type 'boolean)
-
-(defcustom typst-ts-mode-electric-return t
- "Whether `typst-ts-mode-return' auto inserts list items or not."
- :type 'boolean)
-
-;;
==============================================================================
-;; code from Auctex
-(defcustom typst-ts-mode-math-script-display '((raise -0.5) . (raise 0.5))
- "Display specification for subscript and superscript content.
-The car is used for subscript, the cdr is used for superscripts."
- :type '(cons (choice (sexp :tag "Subscript form")
- (const :tag "No lowering" nil))
- (choice (sexp :tag "Superscript form")
- (const :tag "No raising" nil)))
- :group 'typst-ts)
+(require 'typst-ts-variables)
;;
==============================================================================
diff --git a/typst-ts-variables.el b/typst-ts-variables.el
new file mode 100644
index 0000000000..dbc8d51ff1
--- /dev/null
+++ b/typst-ts-variables.el
@@ -0,0 +1,147 @@
+;;; typst-ts-variables.el --- typst-ts-mode variables -*- lexical-binding: t;
-*-
+;; Copyright (C) 2023-2024 The typst-ts-mode Project Contributors
+
+;; This file is NOT part of Emacs.
+;; 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
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Internal variables and customizable variables.
+
+;;; Code:
+
+(defgroup typst-ts nil
+ "Tree Sitter enabled Typst Writing."
+ :prefix "typst-ts"
+ :group 'text
+ :group 'languages)
+
+
+(defcustom typst-ts-mode-grammar-location nil
+ "Specify typst tree sitter grammar file location.
+This is used for grammar minimum version check. The modified time of the
+grammar file is used for comparing.
+This variable is used in `typst-ts-mode-check-grammar-version'."
+ :type '(choice (string :tag "typst tree sitter grammar file location")
+ (const :tag "Don't enable grammar version check" nil)))
+
+;; `git log -n1 --date=raw` or `git log -n1 --format="%at"`
+(defvar typst-ts-mode--grammar-minimum-version-timestamp 1713791627
+ "Timestamp for the minimum supported typst tree sitter grammar version.")
+
+(defcustom typst-ts-mode-enable-raw-blocks-highlight nil
+ "Whether to enable raw block highlighting.
+NOTE this option must be set before the first loading(opening typst file)"
+ :type 'boolean)
+
+(defcustom typst-ts-mode-electric-return t
+ "Whether `typst-ts-mode-return' auto inserts list items or not."
+ :type 'boolean)
+
+
+;; code from Auctex
+(defcustom typst-ts-mode-math-script-display '((raise -0.5) . (raise 0.5))
+ "Display specification for subscript and superscript content.
+The car is used for subscript, the cdr is used for superscripts."
+ :type '(cons (choice (sexp :tag "Subscript form")
+ (const :tag "No lowering" nil))
+ (choice (sexp :tag "Superscript form")
+ (const :tag "No raising" nil)))
+ :group 'typst-ts)
+
+
+;;; Compile
====================================================================
+
+(defgroup typst-ts-compile nil
+ "Typst TS Compilation."
+ :prefix "typst-ts-compile"
+ :group 'typst-ts)
+
+(defcustom typst-ts-compile-executable-location "typst"
+ "The location or name(if in variable `exec-path') for Typst executable."
+ :type 'string
+ :group 'typst-ts-compile)
+
+(defcustom typst-ts-compile-options ""
+ "User defined compile options for `typst-ts-compile'.
+The compile options will be passed to the end of
+`<typst-executable> compile <current-file>' command."
+ :type 'string
+ :group 'typst-ts)
+
+(defcustom typst-ts-output-directory ""
+ "User defined output directory for `typst-ts-compile` and `typst-ts-watch`."
+ :type 'string
+ :group 'typst-ts)
+
+(defcustom typst-ts-compile-before-compilation-hook nil
+ "Hook runs after compile."
+ :type 'hook
+ :group 'typst-ts)
+
+(defcustom typst-ts-compile-after-compilation-hook nil
+ "Hook runs after compile.
+Note the requirement of this hook is the same as
`compilation-finish-functions'.
+Also note that this hook runs with typst buffer(the buffer you are editing) as
+the current buffer."
+ :type 'hook
+ :group 'typst-ts)
+
+
+;;; Watch Mode
=================================================================
+
+(defcustom typst-ts-watch-options ""
+ "User defined compile options for `typst-ts-watch'.
+The compile options will be passed to the
+`<typst-executable> watch <current-file>' sub-command."
+ :type 'string
+ :group 'typst-ts-watch)
+
+(defcustom typst-ts-watch-process-name "*Typst-Watch*"
+ "Process name for `typst watch' sub-command."
+ :type 'string
+ :group 'typst-ts-watch)
+
+(defcustom typst-ts-watch-process-buffer-name "*Typst-Watch*"
+ "Process buffer name for `typst watch' sub-command."
+ :type 'string
+ :group 'typst-ts-watch)
+
+(defcustom typst-ts-watch-auto-display-compilation-error t
+ "Whether the typst watch process buffer should be displayed automatically.
+This means the buffer will be displayed when error occurs, hide when error
+is eliminated."
+ :type 'boolean
+ :group 'typst-ts-watch)
+
+(defcustom typst-ts-watch-display-buffer-parameters
+ '(display-buffer-at-bottom
+ (window-height . fit-window-to-buffer))
+ "Display buffer parameters.
+Note that since the major mode of typst watch buffer is derived from
compilation
+ mode. If you have a rule like `((derived-mode . compilation-mode) ...)' in
+your `display-buffer-alist', then this option will be covered by that rule."
+ :type 'symbol
+ :group 'typst-ts-watch)
+
+(defvar typst-ts-watch-before-watch-hook nil
+ "Hook runs before compile.")
+(defvar typst-ts-watch-after-watch-hook nil
+ "Hook runs after compile.")
+
+
+(provide 'typst-ts-variables)
+
+;;; typst-ts-variables.el ends here
+
diff --git a/typst-ts-watch-mode.el b/typst-ts-watch-mode.el
index 661340c560..4482d33133 100644
--- a/typst-ts-watch-mode.el
+++ b/typst-ts-watch-mode.el
@@ -22,6 +22,7 @@
;;; Code:
(require 'typst-ts-compile)
+(require 'typst-ts-variables)
(defgroup typst-ts-watch nil
"Typst TS Watch."
@@ -36,41 +37,6 @@
(typst-ts-watch-start)
(typst-ts-watch-stop)))
-(defcustom typst-ts-watch-options '()
- "User defined compile options for `typst-ts-watch'.
-The compile options will be passed to the
-`<typst-executable> watch <current-file>' sub-command."
- :type '(choice (repeat string)
- (const :tag "Empty list" nil)))
-
-(defcustom typst-ts-watch-process-name "*Typst-Watch*"
- "Process name for `typst watch' sub-command."
- :type 'string)
-
-(defcustom typst-ts-watch-process-buffer-name "*Typst-Watch*"
- "Process buffer name for `typst watch' sub-command."
- :type 'string)
-
-(defcustom typst-ts-watch-auto-display-compilation-error t
- "Whether the typst watch process buffer should be displayed automatically.
-This means the buffer will be displayed when error occurs, hide when error
-is eliminated."
- :type 'boolean)
-
-(defcustom typst-ts-watch-display-buffer-parameters
- '(display-buffer-at-bottom
- (window-height . fit-window-to-buffer))
- "Display buffer parameters.
-Note that since the major mode of typst watch buffer is derived from
-compilation mode.
-If you have a rule like `((derived-mode . `compilation-mode') ...)'
-in your `display-buffer-alist', then this option will be covered by that rule."
- :type 'symbol)
-
-(defvar typst-ts-watch-before-watch-hook nil
- "Hook runs before compile.")
-(defvar typst-ts-watch-after-watch-hook nil
- "Hook runs after compile.")
(defun typst-ts-watch--process-filter (proc output)
"Filter the `typst watch' process output.
- [nongnu] elpa/typst-ts-mode 44ed423508 09/19: fix: apply some suggestions from linters #42, (continued)
- [nongnu] elpa/typst-ts-mode 44ed423508 09/19: fix: apply some suggestions from linters #42, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode 7e5b1ef3bc 11/19: fix: .dir-locals.el add file header, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode 919b088997 13/19: chore, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode ebc84e4f65 14/19: chore: only use typst-ts as prefix #42, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode 929dfdda6a 01/19: fix: patch applied #41, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode 0b0d4bf211 05/19: fix: use start-process for watch mode #42, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode 13dff22973 02/19: fix: use start-process instead of async-shell-command #42, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode b1eb84cd2a 07/19: refactor: typst-ts-mode-return, also takes typst-ts-mode-electric-return in mind #42, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode 72d60432c7 03/19: fix: show the shell output #42, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode 2b14377e24 04/19: stub: comment out typst-ts-mode-return for now #42, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode 998eed6f22 10/19: refacvtor: move variables to separate file,
ELPA Syncer <=
- [nongnu] elpa/typst-ts-mode 2cca29e649 12/19: fix(typst-ts-watch): start-process issue, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode 5573845ee9 16/19: feat: grid cell movement now has keybinding #41, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode 1e11d3c74e 17/19: refactor: apply patch #42, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode 972dc69d6b 19/19: release: bump version number, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode 6fc7f2ece7 08/19: Merge branch 'develop' into 42-nongnu-patch, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode 380a0e566b 15/19: fix: issues found by melpazoid #42, ELPA Syncer, 2025/04/24
- [nongnu] elpa/typst-ts-mode d25e8c2883 18/19: Add .elpaignore file #42, ELPA Syncer, 2025/04/24