emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/load-relative d8757b3c54 09/15: require-relative: allow


From: ELPA Syncer
Subject: [elpa] externals/load-relative d8757b3c54 09/15: require-relative: allow symbols as well as strings
Date: Tue, 14 Feb 2023 05:58:07 -0500 (EST)

branch: externals/load-relative
commit d8757b3c54ac7753987c5474725ff817ef3b5600
Author: Daniel Pittman <daniel@rimspace.net>
Commit: GitHub <noreply@github.com>

    require-relative: allow symbols as well as strings
    
    This updates `require-relative' to allow a symbol to be passed; it is
    simply converted to a string and used exactly as before.
    
    Theoretically it could be optimised to avoid `intern' on a symbol, but
    loading code is expensive enough I can't imagine it matters.
    
    This allows for the more natural, to me:
    
        `(require-relative 'usbhid-data)`
---
 load-relative.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/load-relative.el b/load-relative.el
index af9b711a3d..290166b0f3 100644
--- a/load-relative.el
+++ b/load-relative.el
@@ -278,9 +278,12 @@ 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
-                             (file-name-nondirectory relative-file)))))
+  (let* ((relative-file (if (symbolp relative-file)
+                            (symbol-name relative-file)
+                          relative-file))
+         (require-string-name
+          (concat opt-prefix (file-name-sans-extension
+                              (file-name-nondirectory relative-file)))))
     (require (intern require-string-name)
              (relative-expand-file-name relative-file opt-file))))
 



reply via email to

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