GNU bug report logs - #16406
load prefers directories rather than searching load-path

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Fri, 10 Jan 2014 05:25:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 24.3

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: npostavs <at> users.sourceforge.net
To: Glenn Morris <rgm <at> gnu.org>
Cc: 16406 <at> debbugs.gnu.org
Subject: bug#16406: load prefers directories rather than searching load-path
Date: Sun, 21 Aug 2016 12:35:22 -0400
[Message part 1 (text/plain, inline)]
tags 16406 patch
quit

Glenn Morris <rgm <at> gnu.org> writes:

> Package: emacs
> Version: 24.3
>
> From the Emacs source directory, wanting to load the standard info.el library:
>
> ./src/emacs -Q -l info
>
>   Cannot open load file: is a directory, /tmp/emacs/trunk/info
>
> It seems dumb for load prefer a directory.

Seems simple enough to fix, here is a patch (this also covers #17848
"add suffix search to -l even when directory part in argument"):

[v1-0001-Improvements-to-load-argument-handling.patch (text/plain, inline)]
From 38faf8846f7738b533aa29622fd7f78a8c6c81cd Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Sun, 21 Aug 2016 10:51:38 -0400
Subject: [PATCH v1] Improvements to --load argument handling

* lisp/startup.el (command-line-1): Search for files with load-suffixes
in default dir (Bug #17484).  Only pass normal files that were found,
since `load' doesn't handle directories (Bug #16406).
---
 lisp/startup.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/startup.el b/lisp/startup.el
index fcdc376..9134604 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -2392,8 +2392,9 @@ command-line-1
                                    (or argval (pop command-line-args-left))))
                             ;; Take file from default dir if it exists there;
                             ;; otherwise let `load' search for it.
-                            (file-ex (expand-file-name file)))
-                       (when (file-exists-p file-ex)
+                            (file-ex (locate-file file (list default-directory)
+                                                  load-suffixes)))
+                       (when (and file-ex (file-regular-p file-ex))
                          (setq file file-ex))
                        (load file nil t)))
 
-- 
2.9.2


This bug report was last modified 8 years and 173 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.