]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/editors/emacs/emacs.factor
mason: made build targets into a table and added timestamp on report
[factor.git] / basis / editors / emacs / emacs.factor
index fa717a70fa03f39885da19c4c30c7b8f8bd004f0..803b7ce9eb1df7cf5bbe5b2acbd9c2dd9d4a8b5b 100644 (file)
@@ -1,24 +1,23 @@
-USING: definitions io.launcher kernel parser words sequences math
-math.parser namespaces editors make system combinators.short-circuit
-fry threads ;
+USING: combinators.short-circuit editors io.standard-paths
+kernel make math.parser namespaces sequences system vocabs ;
 IN: editors.emacs
 
+SINGLETON: emacs
+
 SYMBOL: emacsclient-path
+SYMBOL: emacsclient-args
 
-HOOK: default-emacsclient os ( -- path )
+HOOK: find-emacsclient os ( -- path )
 
-M: object default-emacsclient ( -- path ) "emacsclient" ;
+M: object find-emacsclient
+    "emacsclient" ?find-in-path ;
 
-: emacsclient ( file line -- )
+M: emacs editor-command
     [
-        { [ \ emacsclient-path get ] [ default-emacsclient ] } 0|| ,
-        "--no-wait" ,
+        emacsclient-path get [ find-emacsclient ] unless* ,
+        emacsclient-args get [ { "-a=emacs" "--no-wait" } ] unless* %
         number>string "+" prepend ,
         ,
-    ] { } make
-    os windows? [ run-detached drop ] [ try-process ] if ;
-
-: emacs ( word -- )
-    where first2 emacsclient ;
+    ] { } make ;
 
-[ emacsclient ] edit-hook set-global
+os windows? [ "editors.emacs.windows" require ] when
\ No newline at end of file