4

General question: two packages have the same name for a certain function. When both packages are installed, which one has the priority to execute that particular function.

Particular situation: I am talking about two packages goto-last-change and goto-chg. The function goto-last-change is present in both packages.

6

There are no namespaces in Emacs, all functions are global, therefore the function in the package that was last loaded will override the definition of the other package.

When package A is loaded and defines function foo, and then package B is loaded and also defines function foo, the foo function from package A is totally gone.

  • Two packages are both in.emacs.d\elpa directory. There is no mention of them in the .emacs file, but in .emacs.d\elpa directory, there are auto-loaded version of both (goto-chg-autoloads.el and goto-last-change-autoloads.el). – Name Jul 10 '15 at 2:50
  • 1
    In that case, when package.el loops over all the autoload files for installed packages, whichever autoload file it hits last will determine which package actually loads when the function is called. Doing (autoload 'foo "bar") (autoload 'foo "fuz") (foo) would only load "fuz". I don't know for sure but I would guess it loops over packages alphabetically. – Jordon Biondo Jul 10 '15 at 3:06
  • I am wondering if the developers of packages should care to not choose the names already chosen. Otherwise there would be many incompatibilities and problems between packages. – Name Jul 10 '15 at 14:04
  • From the looks of it goto-last-change is a very old package, and goto-chg might be a more modern version of the same functionality. I don't use either but I don't see a reason to have both installed at the same time. This is packages usually prefix all their symbols. – Jordon Biondo Jul 10 '15 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.