Why is this Emacs package versioned at 46.1? 26 is the highest possible major version today

There are many issues and questions here, so I'll be brief but try to cover them all.

  • emacs is just a meta-package that points at the latest version of emacs... in Ubuntu (currently emacs24). The "46.1" is just a package version, deliberately high to displace older emacs packages. See apt show emacs for a bit more info.

  • You're overriding that emacs package with a lower version number package. Ubuntu prioritises the package version installed by version number. The highest will be the one that gets installed (when installing or upgrading), hence yours is constantly guzzumped.

    You can see this in the apt-cache policy emacs output. The candidate is the higher version.

  • You can work around priorities with pinning, or fudging your version number (something higher than 46.1) but that does rather ignore the problem (and may leave a emacs24 package in place).

  • Your best option is removing the emacs package and just building and installing a emacs25 or emacs26 package instead. You could also build an emacs meta-package that depended on your version-in-name package, but that's just a vanity. I wouldn't do that unless you're planning on distributing.

  • Regarding Ubuntu doing stuff without "without asking", check to see if automatic updates are turned on. Getting the latest available to it is the default behaviour so I think this is more a case of "not understanding what Ubuntu does" rather than a ghost in the machine, or worse.

  • And as for "why version 24, not 25 or 26?", Ubuntu and Debian beneath it both aim for stable, tested software versions. 26 is still in development and 25 didn't come out until September 2016.

    Additionally, Ubuntu isn't a rolling-release so versions of Ubuntu with 24 will stay on version 24 for the lifespan of those Ubuntu releases (unless something really crazy happens). Security patches will be backported and applied if necessary but it'll still be 24.