[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)
- [elpa] master updated (1e533d2 -> 9afba2e), Rocky Bernstein, 2017/05/25
- [elpa] master 7d5bb44 01/17: Sync autotools version, and clean up, Rocky Bernstein, 2017/05/25
- [elpa] master e469f39 08/17: Another travis try, Rocky Bernstein, 2017/05/25
- [elpa] master a3bdef8 10/17: Another travis try, Rocky Bernstein, 2017/05/25
- [elpa] master b11fb74 14/17: Correct location of short filter, Rocky Bernstein, 2017/05/25
- [elpa] master c719e8d 07/17: Another travis try, Rocky Bernstein, 2017/05/25
- [elpa] master 918a452 05/17: load-history list might not have string car,
Rocky Bernstein <=
- [elpa] master 84f4a5e 03/17: * load-relative/test/test-file.el: Fix up copyright, Rocky Bernstein, 2017/05/25
- [elpa] master 839f651 02/17: Organization cleanup, Rocky Bernstein, 2017/05/25
- [elpa] master 4991912 13/17: Fix docstring quoting. New el-get method., Rocky Bernstein, 2017/05/25
- [elpa] master ec20ba0 15/17: Update README.md: fix small typos, Rocky Bernstein, 2017/05/25
- [elpa] master 8280df5 16/17: Merge pull request #7 from ohspite/patch-1, Rocky Bernstein, 2017/05/25
- [elpa] master 9514dcd 04/17: Merge branch 'master' of github.com:rocky/emacs-load-relative, Rocky Bernstein, 2017/05/25
- [elpa] master 9a4289a 06/17: Can't figure out how to MELPA load test-simple, Rocky Bernstein, 2017/05/25
- [elpa] master 0a40d7d 09/17: Another travis try, Rocky Bernstein, 2017/05/25
- [elpa] master a820b19 11/17: Fixes #6 - this time for sure!?, Rocky Bernstein, 2017/05/25
- [elpa] master 9afba2e 17/17: Merge commit '8280df5ce6db836559a5c2442b97a2f02b6f7a05', Rocky Bernstein, 2017/05/25