editors: unify "edit" across vocabs and words, add edit words for docs, tests, platforms, authors, tags, and summary files. Fixes #177.

db4
John Benediktsson 2011-10-18 16:11:24 -07:00
parent 300a0256c8
commit 315767d6f3
1 changed files with 33 additions and 12 deletions

View File

@ -1,10 +1,11 @@
! Copyright (C) 2005, 2009 Slava Pestov. ! Copyright (C) 2005, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: parser lexer kernel namespaces sequences definitions USING: accessors assocs continuations debugger definitions
io.files io.backend io.pathnames io summary continuations help.topics io io.backend io.files io.pathnames kernel lexer
tools.crossref vocabs.hierarchy prettyprint source-files namespaces parser prettyprint sequences source-files
source-files.errors assocs vocabs.loader splitting source-files.errors splitting strings summary tools.crossref
accessors debugger help.topics ; vocabs vocabs.files vocabs.hierarchy vocabs.loader
vocabs.metadata ;
FROM: vocabs => vocab-name >vocab-link ; FROM: vocabs => vocab-name >vocab-link ;
IN: editors IN: editors
@ -38,14 +39,15 @@ M: cannot-find-source error.
definition>> pprint-short definition>> pprint-short
"''" print ; "''" print ;
: edit ( defspec -- ) GENERIC: edit ( object -- )
dup where
[ first2 edit-location ]
[ dup word-link? [ name>> edit ] [ cannot-find-source ] if ]
?if ;
: edit-vocab ( name -- ) M: object edit
>vocab-link edit ; dup where [ first2 edit-location ] [ cannot-find-source ] ?if ;
M: link edit name>> edit ;
M: string edit
dup vocab [ edit ] [ cannot-find-source ] ?if ;
: edit-error ( error -- ) : edit-error ( error -- )
[ error-file ] [ error-line ] bi [ error-file ] [ error-line ] bi
@ -69,3 +71,22 @@ M: cannot-find-source error.
[ "Fixing " write pprint " and all usages..." print nl ] [ "Fixing " write pprint " and all usages..." print nl ]
[ [ smart-usage ] keep prefix ] bi [ [ smart-usage ] keep prefix ] bi
edit-each ; edit-each ;
: edit-docs ( vocab -- )
vocab-docs-path 1 edit-location ;
: edit-tests ( vocab -- )
vocab-tests-file 1 edit-location ;
: edit-platforms ( vocab -- )
dup vocab-platforms-path vocab-append-path 1 edit-location ;
: edit-authors ( vocab -- )
dup vocab-authors-path vocab-append-path 1 edit-location ;
: edit-tags ( vocab -- )
dup vocab-tags-path vocab-append-path 1 edit-location ;
: edit-summary ( vocab -- )
dup vocab-summary-path vocab-append-path 1 edit-location ;