From f93602c02915dc97014f77ffbdef778376002996 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 21 Dec 2021 15:27:18 -0600 Subject: [PATCH] syntax: Add REUSE: word to easily USE: but reload. My use case is specifically for load-all with editors. The last editor on macOS is Xcode and I use vscode, and once you have ``USE: editors.visual-studio-code`` then the next time it's a no-op. ``REUSE: editors.visual-studio-code`` is the same thing but with two extra characters, as opposed to ``"editors.visual-studio-code" reload`` which requires a lot more typing. We could have ``EDIT:``, ``EDIT-DOCS:``, ``EDIT-TESTS:`` etc if this REUSE: word is successful. --- core/bootstrap/syntax.factor | 1 + core/syntax/syntax.factor | 6 ++++-- misc/fuel/factor-mode.el | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/bootstrap/syntax.factor b/core/bootstrap/syntax.factor index 60d573b43a..302bf7a0ca 100644 --- a/core/bootstrap/syntax.factor +++ b/core/bootstrap/syntax.factor @@ -51,6 +51,7 @@ IN: bootstrap.syntax "T{" "UNION:" "INTERSECTION:" + "REUSE:" "USE:" "UNUSE:" "USING:" diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor index 7a181425b2..ee56d0ac9d 100644 --- a/core/syntax/syntax.factor +++ b/core/syntax/syntax.factor @@ -10,8 +10,8 @@ generic.math generic.parser generic.standard hash-sets hashtables hashtables.identity io.pathnames kernel lexer locals.errors locals.parser macros math memoize namespaces parser quotations sbufs sequences slots source-files splitting -strings strings.parser vectors vocabs.parser words words.alias -words.constant words.symbol ; +strings strings.parser vectors vocabs.loader vocabs.parser words +words.alias words.constant words.symbol ; IN: bootstrap.syntax ! These words are defined as a top-level form, instead of with @@ -47,6 +47,8 @@ IN: bootstrap.syntax "PRIVATE>" [ end-private ] define-core-syntax + "REUSE:" [ scan-token reload ] define-core-syntax + "USE:" [ scan-token use-vocab ] define-core-syntax "UNUSE:" [ scan-token unuse-vocab ] define-core-syntax diff --git a/misc/fuel/factor-mode.el b/misc/fuel/factor-mode.el index 4b135788f0..c2d64ff2f5 100644 --- a/misc/fuel/factor-mode.el +++ b/misc/fuel/factor-mode.el @@ -355,7 +355,7 @@ these lines in your .emacs: "RENAME:" "SINGLETON:" "SLOT:" "SPECIALIZED-ARRAY:" "TYPEDEF:" - "USE:"))) + "REUSE:" "USE:"))) (defconst factor-begin-of-def-regex (format "^USING: \\|\\(%s\\)\\|\\(^%s .*\\)" -- 2.34.1