Getting Emacs ada-mode working

This is probably because Gentoo is not supported, so Alire cannot know if the external dependency is installed or not. You should answer Yes to the question, since re2c is indeed available and should work.

I guess this is the issue for supporting Gentoo: gentoo portage · Issue #23 · alire-project/alire · GitHub

1 Like

I’ve managed to build an AppImage of the ada-mode executables. All the ada-mode executables are inside the AppImage, so using it a an usual executable AppImage doesn’t make much sense.

The AppImage acts as ada_mode_wisi_lalr_parse, but all the executables are inside and can be extracted and directly used, since they are mostly statically linked.

There’s probably a better way to bundle this, so that it is more plug-and-play, but I guess it’s already an improvement for people not building their own copy of the executables.

More details in GitHub - mgrojo/emacs-ada-mode-binaries: AppImages of the Emacs ada-mode executables

By the way, the install command builds some of the Ada files again, I don’t know why. Consequently, I’m not entirely sure if all the files are being compiled in the release profile.

1 Like

This is probably because Gentoo is not supported, so Alire cannot know if the external dependency is installed or not.

Ah, indeed, that would explain it. :slight_smile:

You should answer Yes to the question, since re2c is indeed available and should work.

It did! Thanks. :slight_smile: Nice. i’ll update the Gentoo wiki Ada page accordingly.

I guess this is the issue for supporting Gentoo: gentoo portage · Issue #23 · alire-project/alire · GitHub

i’ve just subscribed to that issue; if i might be able to help with adding/testing Gentoo support, please let me know.

Oh also, a significant contributor to the overall amount of time taken by the installation process was the deep/full cloning of repositories. Are there any design-level issues that require Alire to use deep clones? Could a setting be added to only clone to a certain depth, both globally and locally-overridable? i couldn’t seem to find such a setting in the docs, nor in the output of alr settings [--global] --list

Are you using Alire 2.0? I’d say it does shallow cloning.

Edit: indeed, it passes --depth 1, see "un-git" the releases deployed from git repos · Issue #1455 · alire-project/alire · GitHub

Sorry i’ve taken so long to get back to you on this! i have had a lot on my plate, and i do actually have adhd, but, still …

So. i’m definitely using alr 2.0, and alr is definitely being used by the ada-mode build.sh script. But when i do a fresh install of ada-mode (via ELPA) and then do ./build.sh, i get output like:

Cloning into '/home/alexis/.config/emacs/elpa/ada-mode-8.1.0/alr-iran.tmp'...
[...]
Receiving objects: 100% (48758/48758), 240.39 MiB | 1.59 MiB/s, done.

which seems oddly large for a --depth=1 clone. i tried to manually clone the ada-mode git repo (cgit interface to it), but with --depth=1 added, following the “anonymous clone” instructions on this page, so that i could compare it to the output of build.sh, but that resulted in:

$ git clone --depth=1 https://git.savannah.nongnu.org/git/ada-mode.git
Cloning into 'ada-mode'...
warning: You appear to have cloned an empty repository.

And indeed, the cloned directory is empty.

The --depth=1 appears to result in a useless clone in this case - because there’s no master branch??

Leave out the --depth=1 & re-clone. Now you have the repo, you can git switch org.emacs.ada-mode to get the contents you’re after.

It’s a monorepo, with many branches, see git_checkout.sh for the designed worktree setup.

What I’ve done is

  • make a parent directory, e.g.ada-mode.
  • in ada-mode, clone the repo into org.emacs.ada-mode.
  • in org.emacs.ada-mode, git switch org.emacs.ada-mode, then git_checkout.sh. This results in a load of parallel directories, org.emacs.gpr-mode etc.

The reason the download is so large is that it contains some branches for Stephe’s work-in-progress and some very large historical objects, and hasn’t been garbage-collected for a long time. While I was trying to find why we were having so much trouble using ada-mode, I managed to get the repo down to under 30 MB!

I’ve saved that as a private repo on Github; private because I’m far from expert at elisp and I wouldn’t want to be the only maintainer (I’m at the same stage of life as Stephe), and Github because I find it much more friendly than savannah.gnu.org. I’d be happy to make it public, for informational use.

1 Like

Oh, sorry, i wasn’t clear.

The reason i was specifically trying to manually clone with --depth=1 was to check whether it resulted in the same (large) download done when alr cloned the repo as part of the build.sh script; and the reason i was doing that was because that large download had made me assume that alr didn’t use --depth=1 by default.

But the rest of your message explains what was going on: alr was almost certainly using --depth=1 when cloning, but the repo in its entirety involves a large download for even a shallow clone. So that’s that mystery solved. :slightly_smiling_face: Thanks!

On the topic of Elisp, i wouldn’t claim to be an expert, but i have created a number of Elisp packages, the most recent of which is Ebuku (which i still actively use and maintain). As i already have too many things on my plate, i’m in no position to become a maintainer, but i might be able to help with some ELisp-related issues …

Pity, but Emacs 29.3 locks up in a 100% loop on loading an ada source file.

I started it in lisp debug mode with minimal X. Then it loads the file at least , but inserting a skel. wants to start the wisi parser and locks up.

Also I noticed lots of full-stops in the loaded adb file, when I looked afterwards. Like it was done in the first step of some scan for reformatting…
j.

Welcome to the forum!

Pity, but Emacs 29.3 locks up in a 100% loop on loading an ada source file.

i’ve spent some time wrangling ada-mode in an attempt to get it working, as i describe starting in this comment in another thread:

Interesting: trying to open the body file in Emacs causes Emacs to pause seemingly indefinitely, with the following message in the echo area, until i C-g.

waiting for wisi parser Ada start in buffer less_trivial_trie.adb

After the C-g, i can switch to that buffer without issues.

As i’m on Emacs 29.3 myself, with tree-sitter support having been added to Emacs in 29.1 (released 30 July 2023), i tried ada-ts-mode, and had a much better experience than i did with ada-mode:

[W]hat i did just now was install ada-ts-mode via Emacs’ package manager, without uninstalling ada-mode. It installed without issues. i then opened less_trivial_trie.adb - in doing so, i was informed that there was no tree-sitter grammar installed, and would i like to install one from <url>? i answered yes, it installed without issues, and the file was syntax-highlighted. :slight_smile: A very quick and painless process …

Looking at the source of ada-ts-mode.el, it doesn’t depend on ada-mode. It does, however, basically make itself the provider of ada-mode.

All in all, i’d say ada-ts-mode feels very promising indeed

One issue with ada-ts-mode at this point is its lack of indentation support, although that’s something the mode’s author is working on. However, one can nevertheless use the Ada Language Server for indentation; refer to this issue in the ada-ts-mode repo, in which the ada-ts-mode dev helped me get that set up.

Given the preceding, i’d say that, unless one can’t move to Emacs 29.1 or later for some reason, people should definitely give ada-ts-mode a go.

For all those lusting after new ada-mode for emacs this is what worked
for me on debian trixie on an x86_64 box and I guess it will work on
other distributions with emacs version ±29. :

binaries from here:

then (as per readme):
chmod +x emacs_ada_mode-8.1.0-x86_64.AppImage
./emacs_ada_mode-8.1.0-x86_64.AppImage --appimage-extract
mv squashfs-root/usr/bin/* ~/.local/bin
mv squashfs-root/usr/lib/* ~/.local/lib

.el files and manual from here:

and here:

and here:

Happy hacking.
j.

1 Like

I found a real Ada-mode torture file. Old Ada-95 stuff with lots of nesting and difficult constructions.
So I got lots of “I don’t love you”'s in the message buffer. And even data loss because of my impatience with the beast while re-tabbing.

These settings in .emacs took care of the issues:
under:
(custom-set-variables
'(jit-lock-defer-time 1.5)
'(wisi-incremental-parse-enable t)
'(wisi-process-time-out 10.0))

Do read the write-up in the manual on slow machines.
j.

1 Like

A couple of weeks ago, I started with https://github.com/sebastianpoeplau/ada-light-mode/blob/dbba0a397905ecc39fc78d7d2df043cda902de3b/ada-light-mode.el, stripped out the parts I didn’t need, & have been happy with it. In particular, I was happy to forgo the language server problems. (However, I’m new to Ada & write only very basic Ada code at this time. The solution might not work for more experienced Ada programmers.)