Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
343 stars 230 forks source link

infoHelp not working in Emacs #1772

Closed d-torrance closed 3 years ago

d-torrance commented 3 years ago

Running Macaulay2 (from a PPA build of the release-1.17 branch) on Ubuntu 20.10 in Emacs 26.3:

i1 : infoHelp(rank, Matrix)
info: Terminal type 'dumb' is not smart enough to run Info

Doing the same thing from a terminal window opens info to the correct documentation page as expected.

mahrud commented 3 years ago

Also, I think the PPA versions don't install the emacs package at all.

d-torrance commented 3 years ago

Also, I think the PPA versions don't install the emacs package at all.

They're in the elpa-macaulay2 package, which should be installed automatically unless you don't install Recommends.

mahrud commented 3 years ago

Ah, I see, the problem is that they're being installed in site-lisp/elpa/macaulay2-... instead of site-lisp/Macaulay2, so setupEmacs() isn't putting the correct address in .emacs-Macaulay2.

mahrud commented 3 years ago

Also, why is it prefixed with ELPA and put in that directory at all? It's not a GNU ELPA package (the list is here, and ours isn't among them) at all.

Sorry about hijacking this issue, feel free to move it to a separate issue. I just remembered it when I saw this issue.

d-torrance commented 3 years ago

Ah, I see, the problem is that they're being installed in site-lisp/elpa/macaulay2-... instead of site-lisp/Macaulay2, so setupEmacs() isn't putting the correct address in .emacs-Macaulay2.

That isn't necessary for Emacs packages which are built using the dh_elpa debhelper addon. M2-mode works out of the box once elpa-macaulay2 is installed.

mahrud commented 3 years ago

That isn't necessary for Emacs packages which are built using the dh_elpa debhelper addon. M2-mode works out of the box once elpa-macaulay2 is installed.

I'm getting an error that "M2-init" isn't found, which makes emacs unusable.

d-torrance commented 3 years ago

Also, why is it prefixed with ELPA and put in that directory at all? It's not a GNU ELPA package (the list is here, and ours isn't among them) at all.

Sorry about hijacking this issue, feel free to move it to a separate issue. I just remembered it when I saw this issue.

It's a naming convention for Debian Emacs packages. I originally called the package emacs-macaulay2 until I was convinced to rename it -- see https://lists.debian.org/debian-science/2020/07/msg00038.html.

d-torrance commented 3 years ago

That isn't necessary for Emacs packages which are built using the dh_elpa debhelper addon. M2-mode works out of the box once elpa-macaulay2 is installed.

I'm getting an error that "M2-init" isn't found, which makes emacs unusable.

Hrm -- I'll play around with it in a chroot and see if I can reproduce the issue.

mahrud commented 3 years ago

Hrm -- I'll play around with it in a chroot and see if I can reproduce the issue.

Sorry, I should be clearer: it works fine in a fresh install of ubuntu/emacs/macaulay2, but if you're upgrading from a previous installation, then it doesn't work. Or if you run setupEmacs(), it puts the wrong load-path command there.

To be clear, I think the way your package is doing it is better, I'd be happy to get rid of setupEmacs altogether, but this might cause issues for people who switch to your build.

d-torrance commented 3 years ago

Hrm -- I'll play around with it in a chroot and see if I can reproduce the issue.

Sorry, I should be clearer: it works fine in a fresh install of ubuntu/emacs/macaulay2, but if you're upgrading from a previous installation, then it doesn't work. Or if you run setupEmacs(), it puts the wrong load-path command there.

To be clear, I think the way your package is doing it is better, I'd be happy to get rid of setupEmacs altogether, but this might cause issues for people who switch to your build.

Ok, gotcha. I can probably just patch setupEmacs to do the right thing or something. Thanks for catching this before 1.17 is packaged!

d-torrance commented 3 years ago

Ok, I think I reproduced the issue. In a fresh Ubuntu 20.04 chroot, I:

File is missing: Cannot open load file, No such file or directory, M2-init

To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the `--debug-init' option to view a complete error backtrace.


As long as `elpa-macaulay2` is present, then it shouldn't be a problem, as the correct directory will be in `load-path` thanks to `dh_elpa`.  But if it's absent, then we'll fail to load `M2-init`.

So a possible fix:  patch `setupEmacs()` to
* check if `elpa-macaulay2` package is installed.  If so, we're all set.  Maybe suggest they make `f12` global.
* If it's not, comment out `(load "M2-init")` in `.emacs-Macaulay2` (if it exists) and alert the user they should install `elpa-macaulay2`.

Thoughts?
DanGrayson commented 3 years ago

Running Macaulay2 (from a PPA build of the release-1.17 branch) on Ubuntu 20.10 in Emacs 26.3:

i1 : infoHelp(rank, Matrix)
info: Terminal type 'dumb' is not smart enough to run Info

Doing the same thing from a terminal window opens info to the correct documentation page as expected.

I don't see how this could be made to work.

mahrud commented 3 years ago
  • check if elpa-macaulay2 package is installed. If so, we're all set. Maybe suggest they make f12 global.
  • If it's not, comment out (load "M2-init") in .emacs-Macaulay2 (if it exists) and alert the user they should install elpa-macaulay2.

I'd rather the solution wasn't platform specific; e.g., users on macos or fedora can't install elpa-macaulay2. Is it acceptable to add a symlink from the previous location to the new location in elpa-macaulay2?

d-torrance commented 3 years ago

I'd rather the solution wasn't platform specific; e.g., users on macos or fedora can't install elpa-macaulay2. Is it acceptable to add a symlink from the previous location to the new location in elpa-macaulay2?

Oh, I'm just talking about a patch for the Debian package to fix the issue you ran into -- nothing upstream. Here's what I came up with: https://salsa.debian.org/science-team/macaulay2/-/blob/debian/development/debian/patches/use-dh-elpa.patch