FUEL: Interface with tools.scaffold.
parent
4543590ca9
commit
4bb5ad1925
|
@ -26,7 +26,7 @@ HELP: scaffold-undocumented
|
|||
HELP: scaffold-vocab
|
||||
{ $values
|
||||
{ "vocab-root" "a vocabulary root string" } { "string" string } }
|
||||
{ $description "Creates a direcory in the given root for a new vocabulary and adds a main .factor file, a tests file, and an authors.txt file." } ;
|
||||
{ $description "Creates a directory in the given root for a new vocabulary and adds a main .factor file, a tests file, and an authors.txt file." } ;
|
||||
|
||||
HELP: using
|
||||
{ $description "Stores the vocabularies that are pulled into the documentation file from looking up the stack effect types." } ;
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
USING: accessors arrays assocs classes.tuple combinators
|
||||
compiler.units continuations debugger definitions help help.crossref
|
||||
help.markup help.topics io io.pathnames io.streams.string kernel lexer
|
||||
make math math.order memoize namespaces parser quotations prettyprint
|
||||
make math math.order memoize namespaces parser prettyprint quotations
|
||||
sequences sets sorting source-files strings summary tools.crossref
|
||||
tools.vocabs tools.vocabs.browser vectors vocabs vocabs.parser
|
||||
vocabs.loader words ;
|
||||
tools.scaffold tools.vocabs tools.vocabs.browser vectors vocabs
|
||||
vocabs.loader vocabs.parser words ;
|
||||
|
||||
IN: fuel
|
||||
|
||||
|
@ -368,6 +368,16 @@ MEMO: (fuel-get-vocabs/tag) ( tag -- element )
|
|||
: fuel-get-vocabs/tag ( tag -- )
|
||||
(fuel-get-vocabs/tag) fuel-eval-set-result ;
|
||||
|
||||
! Scaffold support
|
||||
|
||||
: fuel-scaffold-vocab ( root name devname -- )
|
||||
developer-name set
|
||||
[ scaffold-vocab ] 2keep [ (normalize-path) ] dip dup
|
||||
append-path append-path ".factor" append fuel-eval-set-result ;
|
||||
|
||||
: fuel-scaffold-help ( name -- )
|
||||
dup require dup scaffold-help vocab-docs-path
|
||||
(normalize-path) fuel-eval-set-result ;
|
||||
|
||||
! -run=fuel support
|
||||
|
||||
|
|
|
@ -43,6 +43,26 @@ beast.
|
|||
Many aspects of the environment can be customized:
|
||||
M-x customize-group fuel will show you how many.
|
||||
|
||||
*** Faster listener startup
|
||||
|
||||
On startup, run-factor loads the fuel vocabulary, which can take a
|
||||
while. If you want to speedup the load process, type 'save' in the
|
||||
listener prompt just after invoking run-factor. This will save a
|
||||
factor image (overwriting the current one) with all the needed
|
||||
vocabs.
|
||||
|
||||
*** Vocabulary creation
|
||||
|
||||
FUEL offers a basic interface with Factor's scaffolding utilities.
|
||||
To create a new vocabulary directory and associated files:
|
||||
|
||||
M-x fuel-scaffold-vocab
|
||||
|
||||
and when in a vocab file, to create a docs file with boilerplate
|
||||
for each word:
|
||||
|
||||
M-x fuel-scaffold-help
|
||||
|
||||
* Quick key reference
|
||||
|
||||
(Triple chords ending in a single letter <x> accept also C-<x> (e.g.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; fu.el --- Startup file for FUEL
|
||||
|
||||
;; Copyright (C) 2008 Jose Antonio Ortega Ruiz
|
||||
;; Copyright (C) 2008, 2009 Jose Antonio Ortega Ruiz
|
||||
;; See http://factorcode.org/license.txt for BSD license.
|
||||
|
||||
;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
|
||||
|
@ -24,6 +24,11 @@
|
|||
"Minor mode showing in the minibuffer a synopsis of Factor word at point."
|
||||
t)
|
||||
|
||||
(autoload 'fuel-scaffold-vocab "fuel-scaffold.el"
|
||||
"Create a new Factor vocabulary." t)
|
||||
|
||||
(autoload 'fuel-scaffold-help "fuel-scaffold.el"
|
||||
"Create a Factor vocabulary help file." t)
|
||||
|
||||
|
||||
;;; fu.el ends here
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
;;; fuel-scaffold.el -- interaction with tools.scaffold
|
||||
|
||||
;; Copyright (C) 2009 Jose Antonio Ortega Ruiz
|
||||
;; See http://factorcode.org/license.txt for BSD license.
|
||||
|
||||
;; Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
|
||||
;; Keywords: languages, fuel, factor
|
||||
;; Start date: Sun Jan 11, 2009 18:40
|
||||
|
||||
;;; Comentary:
|
||||
|
||||
;; Utilities for creating new vocabulary files and other boilerplate.
|
||||
;; Mainly, an interface to Factor's tools.scaffold.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'fuel-eval)
|
||||
(require 'fuel-edit)
|
||||
(require 'fuel-syntax)
|
||||
(require 'fuel-base)
|
||||
|
||||
|
||||
;;; Customisation:
|
||||
|
||||
(defgroup fuel-scaffold nil
|
||||
"Options for FUEL's scaffolding."
|
||||
:group 'fuel)
|
||||
|
||||
(defcustom fuel-scaffold-developer-name user-full-name
|
||||
"The name to be inserted as yours in scaffold templates."
|
||||
:type 'string
|
||||
:group 'fuel-scaffold)
|
||||
|
||||
|
||||
;;; Auxiliary functions:
|
||||
|
||||
(defun fuel-scaffold--vocab-roots ()
|
||||
(let ((cmd '(:fuel* (vocab-roots get :get) "fuel")))
|
||||
(fuel-eval--retort-result (fuel-eval--send/wait cmd))))
|
||||
|
||||
|
||||
;;; User interface:
|
||||
|
||||
(defun fuel-scaffold-vocab ()
|
||||
"Creates a directory in the given root for a new vocabulary and
|
||||
adds source, tests and authors.txt files.
|
||||
|
||||
You can configure `fuel-scaffold-developer-name' (set by default to
|
||||
`user-full-name') for the name to be inserted in the generated files."
|
||||
(interactive)
|
||||
(let* ((name (read-string "Vocab name: "))
|
||||
(root (completing-read "Vocab root: "
|
||||
(fuel-scaffold--vocab-roots)
|
||||
nil t "resource:"))
|
||||
(cmd `(:fuel* ((,root ,name ,fuel-scaffold-developer-name)
|
||||
(fuel-scaffold-vocab)) "fuel"))
|
||||
(ret (fuel-eval--send/wait cmd))
|
||||
(file (fuel-eval--retort-result ret)))
|
||||
(unless file
|
||||
(error "Error creating vocab (%s)" (car (fuel-eval--retort-error ret))))
|
||||
(find-file file)
|
||||
(goto-char (point-max))))
|
||||
|
||||
(defun fuel-scaffold-help (&optional arg)
|
||||
"Creates, if it does not already exist, a help file with
|
||||
scaffolded help for each word in the current vocabulary.
|
||||
|
||||
With prefix argument, ask for the vocabulary name."
|
||||
(interactive "P")
|
||||
(let* ((vocab (or (and (not arg) (fuel-syntax--current-vocab))
|
||||
(fuel-edit--read-vocabulary-name nil)))
|
||||
(cmd `(:fuel* (,vocab fuel-scaffold-help) "fuel"))
|
||||
(ret (fuel-eval--send/wait cmd))
|
||||
(file (fuel-eval--retort-result ret)))
|
||||
(unless file
|
||||
(error "Error creating help file" (car (fuel-eval--retort-error ret))))
|
||||
(find-file file)))
|
||||
|
||||
|
||||
(provide 'fuel-scaffold)
|
||||
;;; fuel-scaffold.el ends here
|
Loading…
Reference in New Issue