From 0919a5132415358bb24994898c9622e9743c964f Mon Sep 17 00:00:00 2001 From: Expez Date: Wed, 27 Mar 2013 10:00:27 +0100 Subject: [PATCH 1/5] Remove trailing whitespace. --- load-relative.el | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/load-relative.el b/load-relative.el index ad15d51..03a6d9b 100644 --- a/load-relative.el +++ b/load-relative.el @@ -51,7 +51,7 @@ methods work we will use the file-name value find via ;; suitable if __FILE__ were called from inside a function. - (cond + (cond ;; lread.c's readevalloop sets (car current-load-list) ;; via macro LOADHIST_ATTACH of lisp.h. At least in Emacs ;; 23.0.91 and this code goes back to '93. @@ -60,26 +60,26 @@ methods work we will use the file-name value find via ;; load-like things. 'relative-file-expand' tests in ;; test/test-load.el indicates we should put this ahead of ;; $#. - (load-file-name) + (load-file-name) ;; Pick up "name of this file as a string" which is set on ;; reading and persists. In contrast, load-file-name is set only ;; inside eval. As such, it won't work when not in the middle of ;; loading. - ;; (#$) + ;; (#$) ;; eval-like things - ((buffer-file-name)) + ((buffer-file-name)) ;; When byte compiling. FIXME: use a more thorough precondition like ;; byte-compile-file is somehwere in the backtrace or that - ;; bytecomp-filename comes from that routine? + ;; bytecomp-filename comes from that routine? ((boundp 'bytecomp-filename) bytecomp-filename) (t (symbol-file symbol)) ;; last resort )) -(defun autoload-relative (function-or-list +(defun autoload-relative (function-or-list file &optional docstring interactive type symbol) "autoload an Emacs Lisp file relative to Emacs Lisp code that is in @@ -90,7 +90,7 @@ Define FUNCTION to autoload from FILE. FUNCTION is a symbol. FILE is a string to pass to `load'. -DOCSTRING is documentation for the function. +DOCSTRING is documentation for the function. INTERACATIVE if non-nil says function can be called interactively. @@ -108,7 +108,7 @@ finding __FILE__ don't work." (if (listp function-or-list) (mapcar (lambda(function) - (autoload function-or-list + (autoload function-or-list (relative-expand-file-name file symbol) docstring interactive type)) file) @@ -148,21 +148,21 @@ buffer-setting or buffer changing operations." (defun require-relative (relative-file &optional opt-file opt-prefix) "Run `require' on an Emacs Lisp file relative to the Emacs Lisp code that is in the process of being loaded or eval'd. The symbol used in require -is the base file name (without directory or file extension) treated as a +is the base file name (without directory or file extension) treated as a symbol. WARNING: it is best to to run this function before any buffer-setting or buffer changing operations." - (let ((require-string-name - (concat opt-prefix (file-name-sans-extension + (let ((require-string-name + (concat opt-prefix (file-name-sans-extension (file-name-nondirectory relative-file))))) - (require (intern require-string-name) + (require (intern require-string-name) (relative-expand-file-name relative-file opt-file)))) (defmacro require-relative-list (list &optional opt-prefix) "Run `require-relative' on each name in LIST which should be a list of strings, each string being the relative name of file you want to run." - `(progn + `(progn (eval-when-compile (require 'cl (dolist (rel-file ,list) From 1183fd0080259b42f6461a480870b22a3a01dc7b Mon Sep 17 00:00:00 2001 From: Expez Date: Wed, 27 Mar 2013 10:02:07 +0100 Subject: [PATCH 2/5] Change to proper version header format. --- load-relative.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load-relative.el b/load-relative.el index 03a6d9b..98766d6 100644 --- a/load-relative.el +++ b/load-relative.el @@ -1,7 +1,7 @@ ;;; load-relative.el --- relative file load (within a multi-file Emacs package) ;; Author: Rocky Bernstein -;; Version: 0.02 +;; Version: 0.2.0 ;; Keywords: internal ;; URL: http://github.com/rocky/emacs-load-relative ;; Compatibility: GNU Emacs 23.x From 9b1eb88e649597ce7ef24c71444ed740c3590149 Mon Sep 17 00:00:00 2001 From: Expez Date: Wed, 27 Mar 2013 10:15:13 +0100 Subject: [PATCH 3/5] Add marker for code. --- load-relative.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/load-relative.el b/load-relative.el index 98766d6..fa4c757 100644 --- a/load-relative.el +++ b/load-relative.el @@ -22,6 +22,8 @@ ;; along with this program. If not, see ;; . +;;; Code: + (defun __FILE__ (&optional symbol) "Return the string name of file/buffer that is currently begin executed. From d5afdd4b4715a619c128bd0f4b42482227fc0cc6 Mon Sep 17 00:00:00 2001 From: Expez Date: Wed, 27 Mar 2013 10:24:20 +0100 Subject: [PATCH 4/5] Add autoload directives. --- load-relative.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/load-relative.el b/load-relative.el index fa4c757..d4513f8 100644 --- a/load-relative.el +++ b/load-relative.el @@ -24,6 +24,7 @@ ;;; Code: +;;;###autoload (defun __FILE__ (&optional symbol) "Return the string name of file/buffer that is currently begin executed. @@ -84,7 +85,7 @@ methods work we will use the file-name value find via (defun autoload-relative (function-or-list file &optional docstring interactive type symbol) - "autoload an Emacs Lisp file relative to Emacs Lisp code that is in + "Autoload an Emacs Lisp file relative to Emacs Lisp code that is in the process of being loaded or eval'd. @@ -118,6 +119,7 @@ finding __FILE__ don't work." docstring interactive type)) ) +;;;###autoload (defun load-relative (file-or-list &optional symbol) "Load an Emacs Lisp file relative to Emacs Lisp code that is in the process of being loaded or eval'd. @@ -147,6 +149,7 @@ buffer-setting or buffer changing operations." (setq prefix (file-name-directory file)) (expand-file-name (concat prefix relative-file)))) +;;;###autoload (defun require-relative (relative-file &optional opt-file opt-prefix) "Run `require' on an Emacs Lisp file relative to the Emacs Lisp code that is in the process of being loaded or eval'd. The symbol used in require @@ -161,6 +164,7 @@ buffer-setting or buffer changing operations." (require (intern require-string-name) (relative-expand-file-name relative-file opt-file)))) +;;;###autoload (defmacro require-relative-list (list &optional opt-prefix) "Run `require-relative' on each name in LIST which should be a list of strings, each string being the relative name of file you want to run." @@ -172,6 +176,7 @@ strings, each string being the relative name of file you want to run." (dolist (rel-file ,list) (require-relative rel-file (__FILE__) ,opt-prefix)))) +;;;###autoload (defmacro provide-me ( &optional prefix ) "Call `provide' with the feature's symbol name made from source-code's file basename sans extension. For example if you From 9654e7142f302b907344fa0cfc986ce044da7d9c Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 30 Mar 2013 11:51:06 -0400 Subject: [PATCH 5/5] Give thanks to Lars Anderson --- Makefile.am | 2 +- THANKS | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 THANKS diff --git a/Makefile.am b/Makefile.am index 3a4931a..e9e44ec 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ lisp_files := $(wildcard *.el) lisp_LISP = $(lisp_files) -EXTRA_DIST = $(lisp_files) $(test_files) README.textile COPYING +EXTRA_DIST = $(lisp_files) $(test_files) README.textile THANKS COPYING #: Run all tests check: $(test-files) diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..7408d2a --- /dev/null +++ b/THANKS @@ -0,0 +1 @@ +Lars Anderson - Melapa packaging, among other things