I wish to alter a package, test it and hopefully submit a pull request afterwards. How do I do it in a safe and efficient way? The question might feel too broad, I will accept the answer that covers the following issues:
I'd expect to install a separate branch of a package and be able to switch between it and stable branch on a whim, with recompilation performed automatically when it's necessary, but
package.el
doesn't seem to offer a straightforward way to do that. This answer on emacs-SE informs us that “If multiple copies of a package are installed, then the first one will be loaded” so I guess one could manually mess withload-path
but this doesn't feel robust. What is the standard way to select a specific version of package among those installed?Even if I manage to expose several branches to Emacs, for significant tweaks I need to make sure the unpatched branch is “unloaded” and its side-effects isolated. Does
unload-feature
handle this properly or maybe it has idiosyncrasies that every tester of multi-versioned packages should know about?How do I install and test the local version? The answer appears to be dependent on whether the package is simple (= one file) or multifile. EmacsWiki says about multifile packages: “MELPA builds packages for you”. I doubt that I have to (or should) talk to MELPA every time I change a
defun
form in a multifile package but the question remains. At least I need to tell package manager about local version, and if so, how do I do it?What names should I assign to local versions of packages? Suppose I want to work on multiple features or bugs simultaneously, which means having several branches. Emacs won't allow to name versions in a descriptive manner (along the lines of
20170117.666-somebugorfeature
). I guess I could rename the package itself, a suffix per branch, but again, like manually messing withload-path
in Q1, this is an ugly hack, so I won't try it with something I intend to send upstream unless it's a widely accepted practice.
The questions probably are naive, since I never wrote a patch neither applied one with git or a similar vcs. However, for plenty of Emacs users, patching an Emacs package might be their first ever (or maybe the only one) social programming endeavour, which is why, I believe, answers to this question would still be valuable.