Subject: bug#32266: Cannot add directory names ending in .el with normal-top-level-add-subdirs-to-load-path

From: Håkon Hægland <[email-masked]>
Date: Wed, 25 Jul 2018 09:12:08 +0200

I am trying to use the package "f" which has prerequisites the packages
"s" and  "dash". I wanted to load "f.el" with "use-package", so I downloaded
the four packages with git into a custom folder:

~/.emacs.d/installed-from-github/

I recognized that after cloning with git the folder names of the first
three packages became dash.el, s.el, and f.el. Note that each folder
name contains a dot. But according to the documentation of
normal-top-level-add-subdirs-to-load-path it should work for
these type of directory names. Also refer to the source of
normal-top-level-add-subdirs-to-load-path at

http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/startup.el#n445

However, when I try to run emacs with the
following init file:

(setq debug-on-error t)
(let ((default-directory  "~/.emacs.d/installed-from-github/"))
  (normal-top-level-add-subdirs-to-load-path))
(message "%S" load-path)
(require 'use-package)
(use-package dash
  :demand)
(use-package s
  :demand)
(use-package f
  :demand)

I get the following error:

Error (use-package): Cannot load dash

and when I inspect the *Messages* buffer I can see that load-path does
not contain any of "/home/hakon/.emacs.d/installed-from-github/dash.el",
"/home/hakon/.emacs.d/installed-from-github/s.el", or
"/home/hakon/.emacs.d/installed-from-github/f.el".

Also, when I look at line #474 of the source

http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/startup.el#n474

I see the following predicate for including a directory:

(not (string-match "\\.elc?\\'" file))

I wonder if this can be a bug? At least I think it should be documented in
the
doc string of the function that it will not include directories ending
with .el or .elc and the reason why.

-------------------------

In GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-04-28 built on hakon-Vostro-5568
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04 LTS

Configured using:
 'configure CFLAGS=-no-pie --with-xft --prefix=/opt/emacs-25.3'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_MONETARY: nb_NO.UTF-8
  value of $LC_NUMERIC: nb_NO.UTF-8
  value of $LC_TIME: nb_NO.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

----------------------

Best regards
Håkon Hægland