From: nomennescio Date: Tue, 12 Jul 2022 20:52:20 +0000 (+0200) Subject: Split off windows specifics. Find path in registry first. X-Git-Tag: 0.99~1036 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=d5a2d1cf1b98b9ded7fa7330cdc0e58dd01551c1 Split off windows specifics. Find path in registry first. --- diff --git a/basis/editors/emacs/emacs.factor b/basis/editors/emacs/emacs.factor index f1b12b6211..9ce457a43a 100644 --- a/basis/editors/emacs/emacs.factor +++ b/basis/editors/emacs/emacs.factor @@ -1,5 +1,5 @@ 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 @@ -14,13 +14,6 @@ HOOK: find-emacsclient os ( -- path ) 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* , @@ -28,3 +21,5 @@ M: emacs editor-command number>string "+" prepend , , ] { } make ; + +os windows? [ "editors.emacs.windows" require ] when \ No newline at end of file diff --git a/basis/editors/emacs/windows/windows.factor b/basis/editors/emacs/windows/windows.factor new file mode 100644 index 0000000000..d32a5201ca --- /dev/null +++ b/basis/editors/emacs/windows/windows.factor @@ -0,0 +1,17 @@ +! 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