Subject: bug#25360: File mode specification errors during building

From: [email-masked] (Phillip Lord)
Date: Fri, 13 Jan 2017 14:08:55 +0000

Eli Zaretskii <[email-masked]> writes:

>> From: [email-masked] (Phillip Lord)
>> Cc: [email-masked],  [email-masked]
>> Date: Tue, 10 Jan 2017 18:40:28 +0000
>> 
>> One error is caused when bootstrap-emacs loads CTLau.html, when it's
>> running this code in leim.
>> 
>> misc_convert = $(AM_V_GEN)${RUN_EMACS} \
>>   -l titdic-cnv -f batch-miscdic-convert -dir ${leimdir}/quail
>> 
>> ## CTLau.el, CTLau-b5.el.
>> ${leimdir}/quail/CT%.el: ${srcdir}/MISC-DIC/CT%.html
>> 	${misc_convert} $<
>> 
>> As far as I can tell it is happening because emacs tries to put
>> CTLau.html into html-mode. AFAICT, batch-miscdic-convert uses no
>> features of html-mode.
>
> Ok, and how does image-type-auto-detected-p enter this picture?
>
>> Still, I'll plug at it a little more.
>
> Thanks.

So, the cause of the problem is this. bootstrap-emacs (nor emacs) does
not actually load loaddefs.el; it's just dumped with the binary. I was
recording autoloads until loaddefs.el was generated, but actually, I
need to record them till loaddefs.el is used, that is when emacs is
dumped.

The attached patch seems to address. Can you confirm, then I will apply
to master.

>From 74539c444487094e45a0dd1b4cdb4553eb9cdfe1 Mon Sep 17 00:00:00 2001
From: Phillip Lord <[email-masked]>
Date: Fri, 13 Jan 2017 13:57:51 +0000
Subject: [PATCH] Record autoloads till emacs dump

* admin/ldefs-clean.el (ldefs-clean-up): Record autoloads till emacs dump
* lisp/ldefs-boot-auto.el (batch-byte-compile): Update

Previously, autoloads were collected till loaddefs.el was generated as
part of the build. However, bootstrap-emacs does not load
loaddefs (rather it is dumped), hence we must record autoloads until the
full emacs binary is dumped.
---
 admin/ldefs-clean.el    |  3 ++-
 lisp/ldefs-boot-auto.el | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/admin/ldefs-clean.el b/admin/ldefs-clean.el
index 6eabe57..808b537 100644
--- a/admin/ldefs-clean.el
+++ b/admin/ldefs-clean.el
@@ -39,7 +39,8 @@ ldefs-clean-up
   (goto-char (point-max))
   ;; We only need the autoloads up till loaddefs.el is
   ;; generated. After this, ldefs-boot.el is not needed
-  (search-backward "  GEN      loaddefs.el")
+  (search-backward "-l loadup dump")
+  (beginning-of-line)
   (delete-region (point) (point-max))
   (keep-lines "(autoload" (point-min) (point-max))
   (sort-lines nil (point-min) (point-max))
diff --git a/lisp/ldefs-boot-auto.el b/lisp/ldefs-boot-auto.el
index 914fec8..020c670 100644
--- a/lisp/ldefs-boot-auto.el
+++ b/lisp/ldefs-boot-auto.el
@@ -6,6 +6,8 @@
 (autoload 'add-change-log-entry "add-log" nil nil nil)
 (autoload 'add-log-current-defun "add-log" nil nil nil)
 (autoload 'batch-byte-compile "bytecomp" nil nil nil)
+(autoload 'batch-update-autoloads "autoload" nil nil nil)
+(autoload 'bounds-of-thing-at-point "thingatpt" nil nil nil)
 (autoload 'browse-url "browse-url" nil nil nil)
 (autoload 'buffer-face-mode "face-remap" nil nil nil)
 (autoload 'byte-compile "bytecomp" nil nil nil)
@@ -24,11 +26,16 @@
 (autoload 'compilation-mode "compile" nil nil nil)
 (autoload 'compilation-shell-minor-mode "compile" nil nil nil)
 (autoload 'compilation-start "compile" nil nil nil)
+(autoload 'completing-read-multiple "crm" nil nil nil)
+(autoload 'conf-mode "conf-mode" nil nil nil)
+(autoload 'create-glyph "disp-table" nil nil nil)
 (autoload 'create-image "image" nil nil nil)
+(autoload 'cursor-sensor-mode "cursor-sensor" nil nil nil)
 (autoload 'custom-save-all "cus-edit" nil nil nil)
 (autoload 'customize-face "cus-edit" nil nil nil)
 (autoload 'customize-group "cus-edit" nil nil nil)
 (autoload 'customize-option "cus-edit" nil nil nil)
+(autoload 'customize-push-and-save "cus-edit" nil nil nil)
 (autoload 'customize-set-variable "cus-edit" nil nil nil)
 (autoload 'debug "debug" nil nil nil)
 (autoload 'define-ccl-program "ccl" nil nil t)
@@ -36,6 +43,8 @@
 (autoload 'define-minor-mode "easy-mmode" nil nil t)
 (autoload 'delete-extract-rectangle "rect" nil nil nil)
 (autoload 'describe-char "descr-text" nil nil nil)
+(autoload 'describe-coding-system "mule-diag" nil nil nil)
+(autoload 'describe-display-table "disp-table" nil nil nil)
 (autoload 'describe-function "help-fns" nil nil nil)
 (autoload 'describe-function-1 "help-fns" nil nil nil)
 (autoload 'describe-package "package" nil nil nil)
@@ -43,11 +52,21 @@
 (autoload 'desktop-save "desktop" nil nil nil)
 (autoload 'diff-mode "diff-mode" nil nil nil)
 (autoload 'dired "dired" nil nil nil)
+(autoload 'dired-copy-file "dired-aux" nil nil nil)
+(autoload 'dired-goto-subdir "dired-aux" nil nil nil)
+(autoload 'dired-hide-subdir "dired-aux" nil nil nil)
+(autoload 'dired-insert-subdir "dired-aux" nil nil nil)
+(autoload 'dired-kill-subdir "dired-aux" nil nil nil)
+(autoload 'dired-mark-subdir-files "dired-aux" nil nil nil)
 (autoload 'dired-mode "dired" nil nil nil)
 (autoload 'dired-noselect "dired" nil nil nil)
+(autoload 'dired-query "dired-aux" nil nil nil)
+(autoload 'dired-rename-file "dired-aux" nil nil nil)
 (autoload 'display-call-tree "bytecomp" nil nil nil)
+(autoload 'display-table-slot "disp-table" nil nil nil)
 (autoload 'display-warning "warnings" nil nil nil)
 (autoload 'easy-menu-create-menu "easymenu" nil nil nil)
+(autoload 'edebug-basic-spec "edebug" nil nil nil)
 (autoload 'ediff-patch-file "ediff" nil nil nil)
 (autoload 'edit-kbd-macro "edmacro" nil nil nil)
 (autoload 'extract-rectangle "rect" nil nil nil)
@@ -67,8 +86,10 @@
 (autoload 'help-with-tutorial "tutorial" nil nil nil)
 (autoload 'help-xref-button "help-mode" nil nil nil)
 (autoload 'hi-lock-face-buffer "hi-lock" nil nil nil)
+(autoload 'html-mode "sgml-mode" nil nil nil)
 (autoload 'image-type-available-p "image" nil nil nil)
 (autoload 'info "info" nil nil nil)
+(autoload 'info-complete-symbol "info-look" nil nil nil)
 (autoload 'info-emacs-manual "info" nil nil nil)
 (autoload 'insert-image "image" nil nil nil)
 (autoload 'insert-rectangle "rect" nil nil nil)
@@ -83,21 +104,27 @@
 (autoload 'multi-isearch-buffers-regexp "misearch" nil nil nil)
 (autoload 'multi-isearch-files "misearch" nil nil nil)
 (autoload 'multi-isearch-files-regexp "misearch" nil nil nil)
+(autoload 'nxml-mode "nxml-mode" nil nil nil)
 (autoload 'open-network-stream "network-stream" nil nil nil)
 (autoload 'package-initialize "package" nil nil nil)
 (autoload 'parse-time-string "parse-time" nil nil nil)
 (autoload 'pp "pp" nil nil nil)
 (autoload 'pp-buffer "pp" nil nil nil)
+(autoload 'print-buffer "lpr" nil nil nil)
+(autoload 'quail-defrule-internal "quail" nil nil nil)
 (autoload 'read-kbd-macro "edmacro" nil nil nil)
 (autoload 'regexp-opt "regexp-opt" nil nil nil)
 (autoload 'rx "rx" nil nil t)
 (autoload 'seconds-to-string "time-date" nil nil nil)
 (autoload 'seconds-to-time "time-date" nil nil nil)
+(autoload 'server-save-buffers-kill-terminal "server" nil nil nil)
 (autoload 'server-start "server" nil nil nil)
 (autoload 'set-nested-alist "mule-util" nil nil nil)
+(autoload 'skeleton-insert "skeleton" nil nil nil)
 (autoload 'smerge-mode "smerge-mode" nil nil nil)
 (autoload 'smerge-start-session "smerge-mode" nil nil nil)
 (autoload 'standard-display-8bit "disp-table" nil nil nil)
+(autoload 'standard-display-default "disp-table" nil nil nil)
 (autoload 'tags-query-replace "etags" nil nil nil)
 (autoload 'tags-search "etags" nil nil nil)
 (autoload 'text-scale-increase "face-remap" nil nil nil)
@@ -106,6 +133,12 @@
 (autoload 'timezone-make-date-arpa-standard "timezone" nil nil nil)
 (autoload 'tmm-menubar "tmm" nil nil nil)
 (autoload 'truncate-string-to-width "mule-util" nil nil nil)
+(autoload 'ucs-normalize-HFS-NFC-region "ucs-normalize" nil nil nil)
+(autoload 'ucs-normalize-HFS-NFD-region "ucs-normalize" nil nil nil)
+(autoload 'ucs-normalize-NFC-region "ucs-normalize" nil nil nil)
+(autoload 'ucs-normalize-NFD-region "ucs-normalize" nil nil nil)
+(autoload 'ucs-normalize-NFKC-region "ucs-normalize" nil nil nil)
+(autoload 'ucs-normalize-NFKD-region "ucs-normalize" nil nil nil)
 (autoload 'url-handler-mode "url-handlers" nil nil nil)
 (autoload 'variable-at-point "help-fns" nil nil nil)
 (autoload 'vc-register "vc" nil nil nil)
@@ -114,6 +147,7 @@
 (autoload 'view-buffer "view" nil nil nil)
 (autoload 'view-buffer-other-window "view" nil nil nil)
 (autoload 'view-file "view" nil nil nil)
+(autoload 'view-mode "view" nil nil nil)
 (autoload 'view-mode-enter "view" nil nil nil)
 (autoload 'visit-tags-table "etags" nil nil nil)
 (autoload 'warn "warnings" nil nil nil)
-- 
2.7.4