In Elisp, all functions names normaly (but not necessarily) reside as an entry in a global environment (obarray). In Elisp functions can be redefined. Which means the function definition which has been evaled (or loaded) last will be the only one, which is known and used.
This way you can change functions in your init file, you just need to be sure your function definition is evaled after the function you want to change.
But beware! If the original function changes in behavior or parameters, yours is not changing automatic, and so dependend functions could fail or misbehave.
Replying to those comments below, on how to avoid failure of using source code.
- you should choose a function name which is unique to your own function to prevent this (i.e. prefix your function name)
- you could write a guard around your function, to prevent your function definition overwriting some existing function (this does not help if your function gets overwritten, see next point)
(unless (fboundp 's-join)
(defun s-join ()
...))
- you could use an
advice
at your function, and there check for characteristics of your function (i.e. parameters, or first sexp in body, etc.) IMO advices stay put even when the function gets redefined.
01-something.el
should provide feature01-something
, not (only)something
.