rust-lang / rust-mode

Emacs configuration for Rust
Apache License 2.0
1.1k stars 176 forks source link

Towards making rustic use rust-mode #405

Closed tarsius closed 2 years ago

tarsius commented 3 years ago

rustic was created as a fork of rust-mode, and as a consequence the former contains a fork of the Rust major-mode itself.

rustic takes a batteries-included approach, while rust-mode for the most part sticks to just the major-mode parts (basically font-lock and some movement commands).

IMO there is value in both approaches and it is nice that users can pick a package according to their preference. But this schism also causes some problems.

  1. rustic comes with a fork of the major-mode from rust-mode and changes to the former have not been back-ported. Many new features have been added to rustic without there being a clear separation between the major-mode and the extra-functionality parts, making it increasingly hard to do the back-porting. This is only getting worse over time.

    I have been tackling this issue by moving the non-major-mode parts out of both rust-mode.el and rustic.el, and performing other rearrangements, so that the two variants of the major-mode can be once more be compared and even be merged.

  2. rust-mode also contains some functionality that goes beyond just the major-mode parts, but the implementations are rather rudimentary. These features have been improved in rustic and it might be worth thinking about completely removing some of them from rust-mode.

    This is related to (1) and the cleanup I have done to tackle that will help here as well, but this does not have to happen at the same time.

At this time I am opening two pull-request to address (1).

On top of the latter I have created a few more commits that split the remaining differences into easily digestible chunks. You can see the result here:

Most of the commits are prefixed with [IGNORE FOR NOW] but you might still want to take a look, if only to get an idea of what the remaining differences are.

The last commit consists of actual differences in how the two major-modes do font-locking. I think these changes from rustic should be backported to rust-mode.el and I think @brotzeit as their primary author should do it. I have no opinion on whether that should be done using one big "Backport font-lock changes from rustic" commit or the changes should be backported one-by-one.

After that, some more differences have to be taken care of and I can do most of that work. Once that is done we can remove the major-mode parts from rustic.el and essentially replace them with

(require 'rust-mode)

I first brought this up in https://github.com/brotzeit/rustic/issues/92.

brotzeit commented 3 years ago

I think you know that I'm probably the only one replying here ;)

Give me some time to take a look at the pull requests at both repos. BTW if you want write access for rust-mode/rustic just say something.

brotzeit commented 3 years ago

These features have been improved in rustic and it might be worth thinking about completely removing some of them from rust-mode.

I'm actually hesitant to remove features that rust-mode users are used to. Some rustic features might be not as stable as the rust-mode equivalents. Although I'm sure the rust-mode features also have some quirks, users know them and I want to be careful to not remove features and force users to use rustic.

I would now start by merging https://github.com/brotzeit/rustic/pull/246 and harmonize the common parts between the packages. Maybe it's better to delete it from rustic in one big pull request and make an announcement on reddit so users are not confused and prepared that things are different by now.

tarsius commented 3 years ago

BTW if you want write access for rust-mode/rustic just say something.

For small things that would be useful. So, yes please.

tarsius commented 3 years ago

BTW if you want write access for rust-mode/rustic just say something.

For small things that would be useful. So, yes please.

Friendly ping! :grin:

brotzeit commented 2 years ago

Sorry for the delay. I tend to not get things done in summer(too hot for me). So here is the pr ready for review https://github.com/brotzeit/rustic/pull/290

brotzeit commented 2 years ago

The remaining cleanup tasks will be tracked separately. Thanks again.

tarsius commented 2 years ago

Thanks for doing it now! A few weeks earlier I was actually starting to worry this was never going to happen, but better late than never!

brotzeit commented 2 years ago

FYI I didn't get anything done, not just this task...