branch: externals/load-relative commit e46c6d74b89de972f309a40ab279f1192a1ae73b Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: rocky <ro...@gnu.org>
* load-relative.el (require-relative-list): Don't spuriously require `cl`. Use `eval-and-compile` to simplify the code. (autoload-relative): Use `mapc` since we don't care about the return value. --- load-relative.el | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/load-relative.el b/load-relative.el index 8d4a805164..4cb70e5165 100644 --- a/load-relative.el +++ b/load-relative.el @@ -6,7 +6,7 @@ ;; URL: http://github.com/rocky/emacs-load-relative ;; Compatibility: GNU Emacs 23.x -;; Copyright (C) 2015, 2016, 2017 Free Software Foundation, Inc +;; Copyright (C) 2015-2019 Free Software Foundation, Inc ;; This program is free software: you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -172,6 +172,7 @@ methods work we will use the file-name value find via (defun autoload-relative (function-or-list file &optional docstring interactive type symbol) + ;; FIXME: Docstring talks of FUNCTION but argname is `function-or-list'. "Autoload an Emacs Lisp file relative to Emacs Lisp code that is in the process of being loaded or eval'd. @@ -182,7 +183,7 @@ FILE is a string to pass to `load'. DOCSTRING is documentation for the function. -INTERACATIVE if non-nil says function can be called +INTERACTIVE if non-nil says function can be called interactively. TYPE indicates the type of the object: nil or omitted says @@ -197,10 +198,14 @@ defined (as given by `symbol-file' is used if other methods of finding __FILE__ don't work." (if (listp function-or-list) - (mapcar (lambda(function) - (autoload function-or-list - (relative-expand-file-name file symbol) - docstring interactive type)) + ;; FIXME: This looks broken: + ;; - Shouldn't it iterate on `function-or-list' instead of `file'? + ;; - Shouldn't the `autoload' take `function' rather than + ;; `function-or-list' as argument? + (mapc (lambda(_function) + (autoload function-or-list + (relative-expand-file-name file symbol) + docstring interactive type)) file) (autoload function-or-list (relative-expand-file-name file symbol) docstring interactive type)) @@ -283,11 +288,7 @@ buffer-setting or buffer changing operations." (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 - (eval-when-compile - (require 'cl - (dolist (rel-file ,list) - (require-relative rel-file (__FILE__) ,opt-prefix)))) + `(eval-and-compile (dolist (rel-file ,list) (require-relative rel-file (__FILE__) ,opt-prefix))))