USING: combinators.short-circuit editors io.standard-paths
-kernel make math.parser namespaces sequences system ;
+kernel make math.parser namespaces sequences system vocabs ;
IN: editors.emacs
SINGLETON: emacs
M: object find-emacsclient
"emacsclient" ?find-in-path ;
-M: windows find-emacsclient
- {
- [ { "Emacs" } "emacsclientw.exe" find-in-applications ]
- [ { "Emacs" } "emacsclient.exe" find-in-applications ]
- [ "emacsclient.exe" ]
- } 0|| ;
-
M: emacs editor-command
[
emacsclient-path get [ find-emacsclient ] unless* ,
number>string "+" prepend ,
,
] { } make ;
+
+os windows? [ "editors.emacs.windows" require ] when
\ No newline at end of file
--- /dev/null
+! Copyright (C) 2022 nomennescio
+! See http://factorcode.org/license.txt for BSD license.
+USING: combinators.short-circuit continuations editors editors.emacs
+io.pathnames io.standard-paths kernel make math.parser
+namespaces sequences system windows.advapi32 windows.registry ;
+IN: editors.emacs.windows
+
+CONSTANT: registry-path-to-emacs "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\emacs.exe"
+
+M: windows find-emacsclient
+ {
+ [ [ HKEY_LOCAL_MACHINE registry-path-to-emacs "" query-registry
+ parent-directory "emacsclientw.exe" append-path ] [ drop f ] recover ]
+ [ { "Emacs" } "emacsclientw.exe" find-in-applications ]
+ [ { "Emacs" } "emacsclient.exe" find-in-applications ]
+ [ "emacsclient.exe" ]
+ } 0|| ;
\ No newline at end of file