]> gitweb.factorcode.org Git - factor.git/commitdiff
editors.aquamacs: use find-native-bundle.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 8 Sep 2022 20:46:42 +0000 (13:46 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 14 Sep 2022 21:38:23 +0000 (14:38 -0700)
This allows Aquamacs.app to be installed in other locations besides /Applications.

basis/editors/aquamacs/aquamacs.factor

index b058d762a1666f0f575eaedeac0d5d2a46c2338a..fb21090071f3ec6f3edada9312d20e5eb6205f55 100644 (file)
@@ -4,24 +4,29 @@
 ! Description: Another fine Factor file!
 ! Copyright (C) 2017 Dave Carlton.
 ! See http://factorcode.org/license.txt for BSD license.
-
-USING: combinators.short-circuit editors io.standard-paths
-kernel make math.parser namespaces sequences system ;
+USING: editors io.pathnames io.standard-paths kernel make
+math.parser namespaces sequences system ;
 IN: editors.aquamacs
 
 SINGLETON: aquamacs
-aquamacs editor-class set-global
 
-HOOK: find-aquamacs os ( -- path )
+editor-class [ aquamacs ] initialize
 
-M: object find-aquamacs ( -- path )
-    "aquamacs" ?find-in-path ;
+HOOK: find-aquamacs-path os ( -- path )
 
-M: aquamacs editor-command ( file line -- command )
-    drop
-    [
-        "/Applications/Aquamacs.app/Contents/MacOS/bin/aquamacs" ,
-        ,
-    ] { } make
-    ;
+M: object find-aquamacs-path f ;
+
+M: macosx find-aquamacs-path
+    "org.gnu.Aquamacs" find-native-bundle [
+        "Contents/MacOS/bin/aquamacs" append-path
+    ] [
+        f
+    ] if* ;
 
+: aquamacs-path ( -- path )
+    \ aquamacs-path get [
+        find-aquamacs-path [ "aquamacs" ?find-in-path ] unless*
+    ] unless* ;
+
+M: aquamacs editor-command ( file line -- command )
+    [ aquamacs-path , drop , ] { } make ;