Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve package.el compatibility #543

Merged
merged 8 commits into from
Jun 24, 2018

Conversation

jabranham
Copy link
Contributor

I think the commit messages are self-explanatory, let me know if there are any questions.

Related to #2

@vspinu
Copy link
Member

vspinu commented May 14, 2018

Finally someone got down to doing the dirty work :) 🥇 I don't see any issues with the changes.

Have you tried it with local melpa install? All works as expected?

@jabranham
Copy link
Contributor Author

Have you tried it with local melpa install?

No, and I'm not really sure how to do so. If no one else is, I can read up on how to do this.

All works as expected?

As far as I can tell, there's no user-visible changes other than some nicer autoloading of features. Which people won't notice if they're not autoloading ess anyway.

@jabranham
Copy link
Contributor Author

Hrm... playing around with MELPA is giving me errors. I guess hold off on merging this until I figure out what it's doing.

@jabranham
Copy link
Contributor Author

I can get this to work correctly with MELPA if I change the melpa "recipe" file to:

(ess :repo "jabranham/ESS" :fetcher github :branch "improve-package.el-compatibility" :files
     ("*.el" "lisp/*.el" ("etc" "etc/*")
      "doc/*.texi" "doc/info/dir"))

so it looks like we might have to coordinate with them in order to change the :files part when/if this gets merged.

@jabranham
Copy link
Contributor Author

And as a bonus, package.el users do not need to (require 'ess-site) anymore. Everything is properly deferred and autoloaded so that after (package-initialize) is called (which I think Emacs does automatically now?) visiting an R file loads ESS automatically.

@vspinu
Copy link
Member

vspinu commented May 14, 2018

Are the errors due to ess-pkg.el? If so we can leave it empty till new recipe is merged into melpa.

@jabranham
Copy link
Contributor Author

No, they're because I removed ess-autoloads.el (which we're not supposed to have according to the Elisp manual). That file added the lisp/ subdirectory to load-path. Now that it's gone, lisp/ isn't getting added.

Changing the ess recipe to what I did above solves this by just bringing all the lisp/*.el files into the top-level. It's similar to what magit does (magit also has their el files in a lisp subdir).

@vspinu
Copy link
Member

vspinu commented May 14, 2018

That file added the lisp/ subdirectory to load-path.

I recall that that was a hack before package.el could deal with nested directories.

Changing the ess recipe to what I did above solves this

Ok. I will try to find time to check this locally tomorrow and will send a PR to melpa once it's merged.

@jabranham jabranham mentioned this pull request May 14, 2018
@lionel-
Copy link
Member

lionel- commented May 20, 2018

nice!

@jabranham
Copy link
Contributor Author

Any reason not to merge this? @vspinu

@vspinu
Copy link
Member

vspinu commented May 22, 2018

I couldn't find time to figure this out yet. I want to get into details of package.el on this occasion and check melpa locally. Sorry about the delay :(

@lionel-
Copy link
Member

lionel- commented May 22, 2018

I'll look into it as well to sort out the Makefile issues (cf the other PR). Hopefully there's a way of preventing compilation of some files.

@jabranham
Copy link
Contributor Author

@vspinu - no problem, and no rush really. Let me know if I can answer any questions!

@lionel- AFAIK there's no way except through no-byte-compile. I'll double-check MELPA though. Why wouldn't we want to byte compile all files, though?

@lionel-
Copy link
Member

lionel- commented May 22, 2018

Because some files depend on macros that only exist in recent Emacsen, e.g. flymake-log in ess-r-flymake.el. If you compile with an old Emacs and then run with a recent one (admittedly a non optimal situation but not an unrealistic one) you get really anoying errors when using ESS.

@jabranham
Copy link
Contributor Author

Ah, I hadn't thought of that, makes sense. And I see the other PR you referenced earlier. I should've checked that, sorry for making you repeat yourself.

As far as I know, there's not an easy solution (other than having the user re-compile, anyway). I'll think about it some more though....

FWIW I don't use the Makefile ESS provides. I just byte compile everything in lisp/, add it to load-path, and update the autoloads. This is more or less the way package.el handles things.

I wonder if ESS should move to suggesting installation via package.el for everyone, since that's the "official" way of providing Emacs extensions. But that's a bit off topic for now.

@jabranham jabranham mentioned this pull request May 22, 2018
@jabranham
Copy link
Contributor Author

OK to add (add-to-list 'load-path (file-name-as-directory (concat ess-lisp-directory "/obsolete"))) to ess-site in this PR so that we can obsolete things as discussed in #547 ?

@vspinu
Copy link
Member

vspinu commented May 24, 2018

Yes please. I am still struggling to find time for this, sorry. Will do my best to sink into by the end of the week.

@jabranham
Copy link
Contributor Author

No rush.

If it's helpful, here's how I've been working with melpa locally:

git clone git@github.com:melpa/melpa.git
cd melpa 
make recipes/ess

that creates packages/ess-<date>.<number>.tar, which you can install in a fresh Emacs using package-install-file (NB that this puts it into ~/.emacs.d/elpa/ess<blah>).

If you change recipes/ess to this:

(ess :repo "jabranham/ESS" 
  :fetcher github 
  :branch "improve-package.el-compatibility" 
  :files
     ("*.el" "lisp/*.el" ("etc" "etc/*") ("obsolete" "obsolete/*.el")
      "doc/*.texi" "doc/info/dir"))

then it will use this branch to build the recipe instead of master. You can then use it using package-install-file. You shouldn't need to (require 'ess-site) anymore, since package.el should set up the autoloads needed to activate ESS in appropriate situations.

Let me know if you run into any problems or have questions!

@jabranham
Copy link
Contributor Author

@vspinu have you had a chance to look at this?

@vspinu
Copy link
Member

vspinu commented Jun 9, 2018

Not yet. Sorry. I have had a bunch of rough weeks :/ Cannot do it this weekend but for sure on Monday or Tuesday.

@jabranham
Copy link
Contributor Author

jabranham commented Jun 9, 2018 via email

@jabranham jabranham force-pushed the improve-package.el-compatibility branch from fa8e5b0 to 2e0a61b Compare June 13, 2018 13:29
@jabranham
Copy link
Contributor Author

Just rebased off master and there is a failing test. It's to do with that font lock stuff I mentioned when adding this test yesterday. Weirdly, it only fails on emacs-git. I've no idea why.

@lionel- perhaps font lock info should be made optional in these tests?

@vspinu
Copy link
Member

vspinu commented Jun 13, 2018

Most people won't be able to simply remove (load "ess-site.el") after this. Manipulating any variable or alias (including plenty of recent obsoletes) which is not autoloaded will trigger an error.

The good thing is that most people will still have (load "ess-site") even when loading from MELPA. I propose that we keep all our obsoletes at the end of their files and alias them.

@jabranham
Copy link
Contributor Author

Manipulating any variable or alias (including plenty of recent obsoletes) which is not autoloaded will trigger an error.

What do you have in mind here? I'm assuming most people aren't doing much outside e.g. (setq ess-some-var some-val).

If they do something more complicated, they can always wrap in in with-eval-after-load.

@vspinu
Copy link
Member

vspinu commented Jun 13, 2018

I was changing ess-imenu-S-generic-expression. I bet there will be guys manipulating ess-r-customize-alist directly. But you are right, whoever does that should be able to figure with-eval-after-load.

@vspinu
Copy link
Member

vspinu commented Jun 13, 2018

I have looked at this and it works as expected in my tests. If there no further proposals I will PR to MELPA tomorrow with the following recipe:

(ess
 :repo "emacs-ess/ESS" 
 :fetcher github 
 :files ("*.el" "lisp/*.el"
         "doc/*.texi" "doc/info/dir"
         ("etc" "etc/*")
         ("obsolete" "obsolete/*.el")
         (:exclude "etc/other")))

@vspinu
Copy link
Member

vspinu commented Jun 14, 2018

@jabranham please don't rebase or add anything here. I have pulled your fork locally and already started building on top of it. Will merge once MELPA recipe is accepted.

@jabranham
Copy link
Contributor Author

Great, thanks!

I think we can close #2 after this gets merged?

@vspinu
Copy link
Member

vspinu commented Jun 16, 2018

There is a pretty long back log for MELPA submissions. It might take a week or two, especially given that our repo is not the cleanest one. They have tightened requirements quite a bit (compilation, checkdoc, package-lint). We are long way from a clean build, but I think 19.04 can be a doable target for an absolutely clean repo.

@jabranham
Copy link
Contributor Author

I'm guessing they'll be a bit more lenient with ESS since it's an established package. Hopefully we hear back sometime in the next day or two.

@vspinu vspinu force-pushed the improve-package.el-compatibility branch from 2e0a61b to 3ef8c5f Compare June 17, 2018 19:39
jabranham and others added 8 commits June 24, 2018 10:51
Naming a file this way goes against the Elisp manual, see:

(info "(elisp)Multi-file Packages")
If you want to know if something has been loaded, look at the features variable.
We can move obsolete files here and Emacs will automatically warn that
they are obsolete whenever they are loaded
@vspinu vspinu force-pushed the improve-package.el-compatibility branch from 3ef8c5f to 8708bad Compare June 24, 2018 08:53
@vspinu vspinu merged commit 8708bad into emacs-ess:master Jun 24, 2018
@jabranham jabranham deleted the improve-package.el-compatibility branch June 24, 2018 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants