From 4aea71ec31d29f6d9845f7911570bc0bb85daf78 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Mon, 25 Apr 2022 19:14:15 +0100 Subject: [PATCH] Modifications to work with dh_elpa. 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 | 17 ++++++++--------- .../packages/Macaulay2Doc/ov_getting_started.m2 | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/M2/Macaulay2/m2/files.m2 b/M2/Macaulay2/m2/files.m2 index 9e36e0a..6b92f95 100644 --- a/M2/Macaulay2/m2/files.m2 +++ b/M2/Macaulay2/m2/files.m2 @@ -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)"; diff --git a/M2/Macaulay2/packages/Macaulay2Doc/ov_getting_started.m2 b/M2/Macaulay2/packages/Macaulay2Doc/ov_getting_started.m2 index fb6307a..62508a2 100644 --- a/M2/Macaulay2/packages/Macaulay2Doc/ov_getting_started.m2 +++ b/M2/Macaulay2/packages/Macaulay2Doc/ov_getting_started.m2 @@ -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 deomonstrations below.", PARA{}, -- 2.30.2