branch: elpa-admin
commit 5bb59724bbeb7c1703debc3280fb0271b461f7c6
Author: rocky <[email protected]>
Commit: rocky <[email protected]>
load-relative.el: Add provide-me and make GPL v3.
README: expand and turn into red-cloth markup.
---
README | 58 ++++++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 46 insertions(+), 12 deletions(-)
diff --git a/README b/README
index 3ddcec8..fb75923 100644
--- a/README
+++ b/README
@@ -1,19 +1,53 @@
-Here we add two functions load-relative and __FILE__
+h2. Emacs relative-file _load_, _require_ *==__FILE__==* and a _provide-me_
macro.
-load-relative(symbol) loads an Emacs Lisp file relative to another
-(presumably currently running) Emacs Lisp file.
+Here we add functions: *load-relative*, *require-relative*,
+*require-relative-list*, *==__FILE__==*, and macro *provide-me*.
-Example:
+The latest version is at
"http://github.com/rocky/emacs-load-relative/"://github.com/rocky/emacs-load-relative/
-(provide 'foo-bar)
-(load-relative "baz" 'foo-bar)
+h3. *==__FILE__==*
-__FILE__(symbol) returns the file that symbol was defined it, however
-if you are currently running load, that file name is given instead.
-If symbol is not defined and you are not loading a file, then nil is
-returned.
+*==__FILE__==* returns the file name that that the calling program is
+running. If you are _eval_'ing a buffer then the file name of that
+buffer is used. The name was selected to be analogous to the name its use in C
or Ruby.
-The symbol parameter is an artifact in both load-relative and __FILE__
-that I would like to remove. Right now I don't see how to.
+h3. _load-relative_
+_load-relative_ loads an Emacs Lisp file relative to another (presumably
currently running) Emacs Lisp file. For example if you have files _foo.el_ and
_bar.el_ in the same directory, then to load Emacs Lisp file _bar.el_ from
inside Emacs lisp file _foo.el_:
+bc. (require 'load-relative)
+ (load-relative "baz")
+
+That _load-relative_ line could above have also been written as:
+
+bc. (load-relative "./baz")
+
+or:
+
+bc. (load-relative "baz.el") # if you want to exclude any byte-compiled files
+
+h3. require-relative, require-relative-list
+
+If instead of loading file _baz_, you want to _require_ it:
+
+bc. (require-relative "baz")
+
+or
+
+bc. (require-relative "./baz")
+
+The above not only does a _require_ on _'baz_, but makes sure you get
+that from the same file as you would have if you had issued _load_relative_.
+
+If you have a list of files you want to _require_, you can require
+them one shot using _require-relative-list_ like this:
+
+bc. (require-relative-list '("dbgr-init" "dbgr-fringe"))
+
+h3. provide-me
+
+Finally, macro _provide-me_ saves you the trouble of adding a symbol
+after _provide_, by using the file basename (without directory or file
+extension) as the name of the thing you want to provide. Using this
+forces the _provide_ names to be the same as the filename, but I
+consider that a good thing.