Skip to content

Commit ee9a294

Browse files
committed
Add setupEmacs(String) for specifying path to Emacs binary
1 parent e639c19 commit ee9a294

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

M2/Macaulay2/m2/files.m2

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,8 @@ runAndEcho = s -> (
447447
printerr("running: ", cmd);
448448
run cmd)
449449

450-
makeEmacsPackage = () -> (
451-
if run "command -v emacs > /dev/null" != 0 then (
450+
makeEmacsPackage = emacs -> (
451+
if run("command -v " | emacs | " > /dev/null") != 0 then (
452452
printerr "warning: emacs not found; cannot install package";
453453
return);
454454
rootdir := temporaryFileName() | "/";
@@ -470,7 +470,7 @@ makeEmacsPackage = () -> (
470470
pkgfile << "(define-package \"M2\" \"" << version#"VERSION";
471471
pkgfile << "\" \"Macaulay2 major modes\")" << endl << close;
472472
runAndEcho("cd", rootdir, "&&", "tar", "-cf", tarfile, pkgname);
473-
runAndEcho("emacs", "--batch",
473+
runAndEcho(emacs, "--batch",
474474
"--eval", "'(package-install-file \"" | rootdir | tarfile | "\")'");)
475475

476476
stripdir := dir -> if dir === "/" then dir else replace("/$","",dir)
@@ -508,7 +508,13 @@ prelim := () -> (
508508
promptUser = true;
509509
if prefixDirectory === null then error "can't determine Macaulay 2 prefix (prefixDirectory not set)";
510510
)
511-
installMethod(setupEmacs, () -> ( prelim(); mungeEmacs(); makeEmacsPackage() ))
511+
512+
setupEmacs String := emacs -> (
513+
prelim();
514+
mungeEmacs();
515+
makeEmacsPackage emacs)
516+
installMethod(setupEmacs, () -> setupEmacs "emacs")
517+
512518
installMethod(setup, () -> (
513519
prelim();
514520
dotprofileFix = concatenate(shHeader, apply(shellfixes, (var,dir,rest) -> fix(var,dir,rest,bashtempl)));

M2/Macaulay2/packages/Macaulay2Doc/functions/setup-doc.m2

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,12 @@ Node
4848
Key
4949
setupEmacs
5050
1:setupEmacs
51+
(setupEmacs, String)
5152
Usage
5253
setupEmacs()
54+
setupEmacs s
55+
Inputs
56+
s:String -- defaults to "emacs" when absent
5357
Consequences
5458
Item
5559
The initialization file for Emacs (@TT ".emacs"@ in your home directory) will have lines
@@ -61,6 +65,10 @@ Node
6165
it will not be modified. The lines added are bracketed by comment lines containing
6266
the phrases @TT "Macaulay 2 start"@ and @TT "Macaulay 2 end"@.
6367

68+
Emacs will be run in batch mode to install the Macaulay2 major mode
69+
package. If @CODE "emacs"@ is not available on the @CODE "PATH"@, then
70+
you may specify the path to the Emacs binary using @VAR "s"@.
71+
6472
The function @TO setup@ does all this and more.
6573
SeeAlso
6674
setup

0 commit comments

Comments
 (0)