Modifications to work with dh_elpa.
authorDoug Torrance <dtorrance@debian.org>
Sat, 31 Dec 2022 15:43:00 +0000 (15:43 +0000)
committerDoug Torrance <dtorrance@debian.org>
Sat, 31 Dec 2022 15:43:00 +0000 (15:43 +0000)
Forwarded: not-needed
Last-Update: 2022-02-08

* Strip down setupEmacs() function.  We only set f12 as a global key
  to start Macaulay2 inside Emacs.  This also strips (load "M2-init")
  from a user's existing .emacs-Macaulay2 file, which would cause
  errors if they haven't installed elpa-macaulay2.  We also warn the
  user if elpa-macaulay2 isn't installed.
* Fix path to M2-emacs-help.txt in documentation.

Gbp-Pq: Name use-dh-elpa.patch

M2/Macaulay2/m2/files.m2
M2/Macaulay2/packages/Macaulay2Doc/ov_getting_started.m2

index 93258afdb7964714f840124cc52cdf6c73d8c3ec..3487e767a594d987853a1163e487f1ca3746d3b1 100644 (file)
@@ -387,12 +387,6 @@ emacsenvtempl := ///
 ///
 
 dotemacsFix0 = ///
-;; this version will give an error if M2-init.el is not found:
-(load "M2-init")
-
-;; this version will not give an error if M2-init.el is not found:
-;(load "M2-init" t)
-
 ; You may comment out the following line with an initial semicolon if you 
 ; want to use your f12 key for something else.  However, this action
 ; will be undone the next time you run setup() or setupEmacs().
@@ -474,10 +468,15 @@ local dotemacsFix
 setupEmacs = method()
 setup = method()
 mungeEmacs = () -> (
-     dotemacsFix = concatenate(emacsHeader, apply(emacsfixes, (var,dir,templ) -> fix(var,dir,"",templ)), dotemacsFix0);
+     dotemacsFix = concatenate(emacsHeader, dotemacsFix0);
      supplantStringFile(dotemacsFix,"~/"|M2emacs,false);
-     mungeFile("~/"|".emacs", ";; Macaulay 2 start", ";; Macaulay 2 end", M2emacsRead )
-     )
+     ret := mungeFile("~/"|".emacs", ";; Macaulay 2 start", ";; Macaulay 2 end", M2emacsRead );
+     if run("dpkg -s elpa-macaulay2 2> /dev/null | " |
+         "grep -q \"^Status:.* installed\"") != 0 then
+         stderr << "--warning: you must run \"apt install elpa-macaulay2\" "
+              << "as root in order to use" << endl
+              <<  "  Macaulay2 with Emacs." << endl;
+     ret)
 prelim := () -> (
      promptUser = true;
      if prefixDirectory === null then error "can't determine Macaulay 2 prefix (prefixDirectory not set)";
index 609e292a3cc245ce892f23a50ab435eda9cf4bf8..7fa16074d20db659921d0a93f0b6433a24c31924 100644 (file)
@@ -926,7 +926,7 @@ document {
      It also provides for dynamic completion of symbols in the language.",
      PARA{},
      "There is an ASCII version of this section of the documentation distributed
-     in the file ", TT (Layout#1#"emacs" | "M2-emacs-help.txt"), ". It might be useful for you to visit
+     in the file ", TT "/usr/share/doc/elpa-macaulay2/M2-emacs-help.txt.gz", ". It might be useful for you to visit
      that file with emacs now, thereby avoiding having to cut and paste bits of
      text into emacs buffers for the demonstrations below.",
      PARA{},