]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/editors/emacs/emacs.factor
mason: show git SHA1 and timestamp of last completed build
[factor.git] / basis / editors / emacs / emacs.factor
index a3598aea23d71a245f2e27611c57122fe9bf93aa..803b7ce9eb1df7cf5bbe5b2acbd9c2dd9d4a8b5b 100644 (file)
@@ -1,30 +1,23 @@
-USING: definitions io.launcher kernel parser words sequences math
-math.parser namespaces editors make system combinators.short-circuit
-fry threads vocabs.loader ;
+USING: combinators.short-circuit editors io.standard-paths
+kernel make math.parser namespaces sequences system vocabs ;
 IN: editors.emacs
 
-SINGLETON: emacsclient
-emacsclient editor-class set-global
+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 ;
 
-M: emacsclient editor-command ( file line -- command )
+M: emacs editor-command
     [
-        {
-            [ emacsclient-path get-global ]
-            [ default-emacsclient dup emacsclient-path set-global ]
-        } 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 ;
+    ] { } make ;
 
-: emacs ( word -- )
-    where first2 emacsclient ;
-
-os windows? [ "editors.emacs.windows" require ] when
+os windows? [ "editors.emacs.windows" require ] when
\ No newline at end of file