]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/editors/emacs/emacs.factor
mason: update table style
[factor.git] / basis / editors / emacs / emacs.factor
old mode 100755 (executable)
new mode 100644 (file)
index 1d9f72f..803b7ce
@@ -1,17 +1,23 @@
-USING: definitions io.launcher kernel parser words sequences math
-math.parser namespaces editors make ;
+USING: combinators.short-circuit editors io.standard-paths
+kernel make math.parser namespaces sequences system vocabs ;
 IN: editors.emacs
 
-: emacsclient ( file line -- )
-    [
-        "emacsclient" ,
-        "--no-wait" ,
-        "+" swap number>string append ,
-        ,
-    ] { } make try-process ;
+SINGLETON: emacs
+
+SYMBOL: emacsclient-path
+SYMBOL: emacsclient-args
 
-: emacs ( word -- )
-    where first2 emacsclient ;
+HOOK: find-emacsclient os ( -- path )
 
-[ emacsclient ] edit-hook set-global
+M: object find-emacsclient
+    "emacsclient" ?find-in-path ;
+
+M: emacs editor-command
+    [
+        emacsclient-path get [ find-emacsclient ] unless* ,
+        emacsclient-args get [ { "-a=emacs" "--no-wait" } ] unless* %
+        number>string "+" prepend ,
+        ,
+    ] { } make ;
 
+os windows? [ "editors.emacs.windows" require ] when
\ No newline at end of file