From 829e7c41d96231f7fccd9a1b2ca2cc0040a91e56 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 15 May 2009 16:06:48 -0500 Subject: [PATCH] call vim with run-detached instead of try-process. clean up vim code. --- basis/editors/gvim/gvim.factor | 5 ++++- basis/editors/macvim/macvim.factor | 8 +++----- basis/editors/vim/vim-docs.factor | 2 +- basis/editors/vim/vim.factor | 12 ++++++------ 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/basis/editors/gvim/gvim.factor b/basis/editors/gvim/gvim.factor index 15fd52f5ee..277cd734cc 100644 --- a/basis/editors/gvim/gvim.factor +++ b/basis/editors/gvim/gvim.factor @@ -11,7 +11,10 @@ SINGLETON: gvim HOOK: gvim-path io-backend ( -- path ) M: gvim vim-command ( file line -- string ) - [ gvim-path , "+" swap number>string append , , ] { } make ; + [ + gvim-path , + number>string "+" prepend , , + ] { } make ; gvim vim-editor set-global diff --git a/basis/editors/macvim/macvim.factor b/basis/editors/macvim/macvim.factor index b5f864dcd0..c178207e49 100644 --- a/basis/editors/macvim/macvim.factor +++ b/basis/editors/macvim/macvim.factor @@ -3,11 +3,9 @@ namespaces prettyprint editors make ; IN: editors.macvim -: macvim-location ( file line -- ) +: macvim ( file line -- ) drop [ "open" , "-a" , "MacVim", , ] { } make - try-process ; - -[ macvim-location ] edit-hook set-global - + run-detached drop ; +[ macvim ] edit-hook set-global diff --git a/basis/editors/vim/vim-docs.factor b/basis/editors/vim/vim-docs.factor index 7f527bf18f..1ec3a37061 100644 --- a/basis/editors/vim/vim-docs.factor +++ b/basis/editors/vim/vim-docs.factor @@ -3,7 +3,7 @@ USING: definitions editors help help.markup help.syntax io io.files IN: editors.vim ARTICLE: { "vim" "vim" } "Vim support" -"This module makes the " { $link edit } " word work with Vim by setting the " { $link edit-hook } " global variable to call " { $link vim-location } ". The " { $link vim-path } " variable contains the name of the vim executable. The default " { $link vim-path } " is " { $snippet "\"gvim\"" } "." +"This module makes the " { $link edit } " word work with Vim by setting the " { $link edit-hook } " global variable to call " { $link vim } ". The " { $link vim-path } " variable contains the name of the vim executable. The default " { $link vim-path } " is " { $snippet "\"gvim\"" } "." $nl "If you intend to use this module regularly, it helps to have it load during stage 2 bootstrap. On Windows, place the following example " { $snippet ".factor-boot-rc" } " in the directory returned by " { $link home } ":" { $code diff --git a/basis/editors/vim/vim.factor b/basis/editors/vim/vim.factor index f07f257888..88c8b8051e 100644 --- a/basis/editors/vim/vim.factor +++ b/basis/editors/vim/vim.factor @@ -4,7 +4,6 @@ make ; IN: editors.vim SYMBOL: vim-path - SYMBOL: vim-editor HOOK: vim-command vim-editor ( file line -- array ) @@ -12,12 +11,13 @@ SINGLETON: vim M: vim vim-command [ - vim-path get , swap , "+" swap number>string append , + vim-path get , + [ , ] [ number>string "+" prepend , ] bi* ] { } make ; -: vim-location ( file line -- ) - vim-command try-process ; +: vim ( file line -- ) + vim-command run-detached drop ; "vim" vim-path set-global -[ vim-location ] edit-hook set-global -vim vim-editor set-global +[ vim ] edit-hook set-global +\ vim vim-editor set-global