Subject: bug#41379: 27.0.91; load-history gets bad entries when loading $HOME/.emacs.d/elpa autoload files

From: David Hull <[email-masked]>
Date: Mon, 18 May 2020 13:20:51 -0700

It seems that Emacs 20.0.91 gets bad entries in the load-history
variable when loading autoloads at startup from the
$HOME/.emacs.d/elpa directory.  I cannot reproduce the problem when I
start emacs as `emacs-q`, however the problem does occur with a minimal
startup environment.

    cat /dev/null >$HOME/.emacs
    rm -rf ~HOME/.emacs.d
    emacs

Now, if I show the variable load-history it has a `nil` entry:

    (("/Users/david/Downloads/Emacs.app/Contents/Resources/lisp/thingatpt.elc"
      (provide . thingatpt)
      (t . forward-thing)
      [ elided lots of lines here ]
      (autoload . cl-tree-equal)
      (provide . cl-loaddefs))
     nil
     ("/Users/david/Downloads/Emacs.app/Contents/Resources/lisp/subdirs.el")
     ("/Users/david/Downloads/Emacs.app/Contents/Resources/site-lisp/subdirs.el")
      [ elided the rest of the load-history value here ]
      )

With real autoload files, I usually end up with `((require . info))`
or `((require . finder-inf))` instead of `nil` in load-history, but
still missing the filename as the car of the list, for example:

     [...]
      (t . help-bookmark-jump)
      (defun . help-bookmark-jump)
      (provide . help-mode))
     ((require . info))
     ("/Users/david/Downloads/Emacs.app/Contents/Resources/lisp/info.elc" Info-history Info-history-forward Info-history-list Info-history-skip-intermediate-nodes Info-enable-active-nodes
      (defface . info-node)
      (defface . info-title-1)
     [...]

In GNU Emacs 27.0.91 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G4032))
 of 2020-05-18 built on Air.lan
Windowing system distributor 'Apple', version 10.3.1671
System Description:  Mac OS X 10.14.6

Recent messages:
Loading cus-start...done
Loading tooltip...done
Loading /Users/david/Downloads/Emacs.app/Contents/Resources/lisp/leim/leim-list.el (source)...done
Finding pointers to doc strings...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading loadup.el (source)...done
Type C-x 1 to delete the help window, C-M-v to scroll help.
Mark saved where search started
Mark set
Quit
Quit
Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES
THREADS PDUMPER

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Help

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs text-property-search time-date subr-x
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils misearch multi-isearch cl-extra seq byte-opt gv bytecomp
byte-compile cconv pp cl-print thingatpt help-fns radix-tree help-mode
easymenu cl-loaddefs cl-lib tooltip cus-start eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads kqueue cocoa ns
multi-tty make-network-process emacs)

Memory information:
((conses 16 276201 20318)
 (symbols 48 20810 1)
 (strings 32 57642 2002)
 (string-bytes 1 2401036)
 (vectors 16 51209)
 (vector-slots 8 1407957 64410)
 (floats 8 200 40)
 (intervals 56 235 6)
 (buffers 1000 13))