corgi-emacs / corgi

Unbundled Emacs configuration aimed at Clojure developers
180 stars 18 forks source link

Creating a Corgi github org #19

Open plexus opened 2 years ago

plexus commented 2 years ago

I'm starting to think it would make a lot of sense to move all Corgi stuff to its own dedicated Github organization. We already have several different repos, and I think the time is right to start splitting some of the packages into their own repo.

The situation today

Packages in this case come in two flavors, there are "true" emacs packages in the traditional sense that implement a specific feature or API, and there are what I've been calling "meta-packages", that consist of a bunch of use-package declarations and bits of glue code. The latter are really what make Corgi Corgi.

The distinction is important to me because I'm trying to apply a separation of Mechanism and Policy in Corgi. Most Emacs packages provide both Mechanism (commands) and Policy (key bindings, hooks). Big Spacemacs like configs intertwine mechanism and policy so tightly it's impossible to reuse any of it without buying in wholesale. With Corgi we want almost everything to be "plain" packages that people can use as they please, and a fairly thin layer of policy (choice of packages, key bindings, hooks and other bits of glue), that people can take or replace/tweak to their liking.

"True" packages (mechanisms), which I think would all make sense as separate repos.

Note that each of these could in theory be submitted to MELPA, but I have no intention of doing so. We use straight which is superior in every way and doesn't involve gatekeeping and nitpicking. But if people find them useful and want to make them more broadly available that way they are welcome to submit them, and we'll consider minor patches to appease MELPA's arbitrary policies.

Meta-packages (policy)

These are all "policy" packages, they are basically the boilerplate that goes into a typical emacs config. You can pull them in as packages, or just copy them wholesale into your own config and tweak them from there. I think keeping these together in corgi-packages makes sense.

It's still important to me that these are just packages, that it's packages all the way down. These policy packages are deliberately opinionated, we resist the urge to provide options or configuration for them, but we encourage people to modularize similar slices of their own configs, to encourage a marketplace of ideas.

plexus commented 2 years ago

Unfortunately the corgi username is taken, so we can't name the org that. Maybe corgi-emacs? Any other suggestions?

otfrom commented 2 years ago

corgi-emacs for the org name sounds good

jcmkk3 commented 2 years ago

This sounds like a good idea. I especially like the idea of splitting out corkey into its own package. I view that as one of the killer features of this emacs configuration. I also like the idea of removing the which-key dependency, as well. Maybe transient (now included in emacs 28) could be the basis for the keybinding display.

plexus commented 2 years ago

That's really good to hear :) I'm really happy with how corkey turned out! Is there anything in particular you like about it?

There's an issue with some notes (#13) about replacing which-key.

plexus commented 2 years ago

Corkey is now its own repo, and I wrote up what I think is a fairly complete README. I was surprised I hadn't done a better write-up before, besides a few paragraphs in the corgi manual. This will hopefully help clear up some confusion and help people appreciate how they can leverage the power of Corkey.

Since the key bindings themselves are policy not mechanism I've split them into a separate corgi-bindings package, which will likely remain under corgi-packages.

I've also moved corgi, corgi-packages, and walkclj to corgi-emacs, extracted clj-ns-name from plexmacs, added READMEs to walkclj and clj-ns-name, and added a .github/profile/README.md which shows on the corgi-emacs org page.

There's a bunch of churn going on right now, so expect fresh installs to be broken for the next couple of days. I can only spend a bit of time on this every day, but I think we should be in a more stable state again by the weekend.

Basically my plan is

plexus commented 2 years ago

I've migrated everything to corgi-emacs, and made sure the sample config works again. There are still a few packages I'd like to extract, but I'll do that in a second pass, I wanted to get to a stable point again first.

Left to extract

I would really appreciate it if folks could try out migrating their own config.

(use-package corgi-packages
  :straight (corgi-packages
             :type git
             :host github
             :repo "corgi-emacs/corgi-packages"))

When loading corgi-stateline, also enable it, since it's a mode now

(use-package corgi-stateline
  :config
  (global-corgi-stateline-mode))

Include corgi-bindings, the corgi-keys/corgi-signals files are in here now

(use-package corgi-bindings)

Remove the corgi-packages versions from straight/versions/default.el, to force it to upgrade.

# On Linux you can do this, -i doesn't work the same way on mac, in that case just do it manually
sed /corgi-packages/d -i straight/versions/default.el

What I would recommend after that is to remove straight/repos and to move straight/versions/corgi-versions/corgi.el out of the way. You may want to keep it somewhere for reference, in case you want to revert any package later on. I did some general version bumps so we might discover breakage.

Now start emacs and let it rebuild. I would recommend not shutting down your existing instance just yet, leave it running so you have a working editor to potentially troubleshoot and fix issues.

I would run this one separately in a terminal

emacs -nw --debug-init

That's going to be busy for a while downloading and rebuilding. You'll get a lot of warnings too, I've tried to clean up most of our warnings, and actually found a few bugs that way, but it's still showing many, most in other packages.

theophilusx commented 2 years ago

Just FYI I tried a quick fresh vanilla install, but it fails with a wrong type argument; sequencp normal error, which I'm guessing is related to bindings or corkey. Unfortunately, adding --debug-init does not generate a backtrace, so I've not yet narrowed it down.

This is with the sample config from a fresh clone of corgi-emacs/corgi

theophilusx commented 2 years ago

UPDATE: Looks like the issue is with corgi-stateline. Having a look now.

plexus commented 2 years ago

I just pushed a fix, can you try again?

plexus commented 2 years ago

The problem was with cl-case, interpreting this (normal ...) as a function call

(cl-case evil-state
  (normal ...)
  (visual ...)
  ...)

I've seen that happen before, that you're doing something in a macro, but sometimes it doesn't realize it's a macro. It happened in the past with parseclj/parseedn where people would report these bugs on specific versions of emacs, and I would rewrite that in simpler terms (as I did here, just used a cond).

I think it might have to do with the fact that I wasn't requiring cl-lib explicitly, and so the compiler didn't realize it's actually a macro?

theophilusx commented 2 years ago

Yes, just found it as well. You might be right re: require cl-lib. It does seem to work if you put it in a list i.e.

(cl-case evil-state
  ((normal) ...)
  ((visual) ...)
  ...)

but shouldn't be needed if it is working correctly as a macro.

Will pull the update and test now.

theophilusx commented 2 years ago

Yep, that seems to have fixed it. Successfully installed a fresh vanilla version - now off to update my version.

BTW I've found a few problems with the current completions setup (found before the changes). Will put together a PR with fixes for review. You may notice one of the minor 'errors'.

As an example, you may have noticed one. When you do M-x global-corgi-stateline-mode, it echos a message telling you that you can run the command with a shorter name. Unfortunately, that facility doesn't work with ivy and in a normal ivy install where you set M-x to consel-M-x, ivy disables the short command name feature to prevent user confusion.

plexus commented 2 years ago

Strangely I don't think I've ever seen that message... Maybe I didn't notice or maybe it's a setup difference?

theophilusx commented 2 years ago

It flashes past quickly and is followed by the message about the mode being enabled. However, you should be able to see it in the Messages buffer. I certainly see it with a vanilla install.