[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/load-relative a4e90b6 5/6: * load-relative.el (require-

From: Stefan Monnier
Subject: [elpa] externals/load-relative a4e90b6 5/6: * load-relative.el (require-relative-list): Don't spuriously require `cl`.
Date: Mon, 30 Nov 2020 18:33:52 -0500 (EST)

branch: externals/load-relative
commit a4e90b6c8fb8a8393182e83b306c3211a296757a
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * 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 a7aab4c..4397f82 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
+  ;; 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
 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))
     (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))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]