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

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

[elpa] master 918a452 05/17: load-history list might not have string car


From: Rocky Bernstein
Subject: [elpa] master 918a452 05/17: load-history list might not have string car
Date: Thu, 25 May 2017 02:05:02 -0400 (EDT)

branch: master
commit 918a452dac1d2a5d7646c86af7178536f0e55f22
Author: rocky <address@hidden>
Commit: rocky <address@hidden>

    load-history list might not have string car
    
    Fixes #6
---
 .gitignore        |  1 +
 load-relative.el  | 14 +++++++++++---
 test/test-load.el | 15 +++++++++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index 61da6af..98b3aa5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
 /*~
 /Makefile
 /Makefile.in
+/README
 /aclocal.m4
 /autom4te.cache
 /config.log
diff --git a/load-relative.el b/load-relative.el
index a57748a..8eb3578 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 Free Software Foundation, Inc
+;; Copyright (C) 2015, 2016 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
@@ -139,12 +139,12 @@ methods work we will use the file-name value find via
    ;; 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.
-   ((stringp (car-safe current-load-list)) (car current-load-list))
+   ((load-relative:file-from-load-history current-load-list))
 
    ;; 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
@@ -297,6 +297,14 @@ same as writing (provide 'bar-foo)
   `(provide (intern (concat ,prefix (file-name-sans-extension
                                      (file-name-nondirectory (__FILE__)))))))
 
+(defun load-relative:file-from-load-history (history-list)
+  "Pick out the first string in `history-list"
+  (cond
+   ((null history-list) nil)
+   ((stringp (car history-list)) (car history-list))
+   (t (load-relative:file-from-load-history (cdr history-list)))
+  ))
+
 (provide-me)
 
 ;;; load-relative.el ends here
diff --git a/test/test-load.el b/test/test-load.el
index af47412..55849fc 100644
--- a/test/test-load.el
+++ b/test/test-load.el
@@ -94,4 +94,19 @@
 (provide-me "my-")
 (assert-t (featurep 'my-test-load) "provide-me - prefix")
 
+(assert-nil (load-relative:file-from-load-history nil)
+           "null load-history")
+
+(assert-equal
+ "/tmp/realgud/common/track-mode.el"
+ (load-relative:file-from-load-history
+  '((require . load-relative) (require . shell) (require . cl)
+    "/tmp/realgud/common/track-mode.el"))
+ "load-history list with require's")
+
+(assert-equal
+ "/tmp/foo.bar"
+ (load-relative:file-from-load-history '("/tmp/foo.bar"))
+ "load-history with single filename")
+
 (end-tests)



reply via email to

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