Subject: bug#54491: 27.2; left-margin variable breaks autoload generation

From: chris <[email-masked]>
Date: Sun, 12 Jun 2022 16:33:27 +0200

I've just recomplied emacs with latest master:

```
$ git --no-pager grep "left-margin 0" 8c252e2326:lisp/emacs-lisp/autoload.el
8c252e2326:lisp/emacs-lisp/autoload.el:         (left-margin 0)
```

Build emacs with:

```
git pull; git clean -dfx; git checkout master; ./autogen.sh; ./configure --prefix="$HOME/.local" --with-pgtk; make -j$(nproc)
```
Start emacs with:
`/path_to_emacs_clone/emacs/src/emacs -Q --load ~/.emacs.d/myinit-dev.el --daemon; /path_to_emacs_clone/emacs/lib-src/emacsclient --create-frame --alternate-editor="" &`

Right after that I do:
```
(make-directory-autoloads "~/.emacs.d/straight/repos/minimap/" "/tmp/minimap-autoloads-left-margin-0.el")
```

on input:
```
$ git -C ~/.emacs.d/straight/repos/minimap/ rev-parse --short HEAD
ed74906
```

And it gives:
```
;;; minimap-autoloads-left-margin-0.el --- automatically extracted autoloads (do not edit)   -*- lexical-binding: t -*-
;; Generated by the `loaddefs-generate--rubric' function.

;; This file is part of GNU Emacs.

;;; Code:


;;;### (autoloads nil "../home/chris/.emacs.d/straight/repos/minimap/minimap"
;;;;;;  "../home/chris/.emacs.d/straight/repos/minimap/minimap.el"
;;;;;;  (0 0 0 0))
;;; Generated autoloads from ../home/chris/.emacs.d/straight/repos/minimap/minimap.el

(defvar minimap-mode nil "\
Non-nil if Minimap mode is enabled.
See the `minimap-mode' command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `minimap-mode'.")

(custom-autoload 'minimap-mode "../home/chris/.emacs.d/straight/repos/minimap/minimap" nil)

(autoload 'minimap-mode "../home/chris/.emacs.d/straight/repos/minimap/minimap" "\
("Toggle minimap mode.

This is a global minor mode.  If called interactively, toggle the
`Minimap mode' mode.  If the prefix argument is positive, enable
the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is `toggle'.  Enable
the mode if ARG is nil, omitted, or is a positive number.
Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer,
evaluate `(default-value \\='minimap-mode)'.

The mode's hook is called both when the mode is enabled and when
it is disabled.

\(fn &optional ARG)" 335 336 (fill-space "  ")) t nil)

(register-definition-prefixes "../home/chris/.emacs.d/straight/repos/minimap/minimap" '("minimap-"))

;;;***

;;; End of scraped data

(provide 'minimap-autoloads-left-margin-0)

;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8-emacs-unix
;; End:

;;; minimap-autoloads-left-margin-0.el ends here
```

This grep shows the error is present:
```
$ grep -A2 "(autoload 'minimap-mode" /tmp/minimap-autoloads-left-margin-0.el                        
(autoload 'minimap-mode "../home/chris/.emacs.d/straight/repos/minimap/minimap" "\ 
("Toggle minimap mode.
```

Initially I stumbled on that from `straight.el`:
`(straight-use-package 'minimap)` sort of command fails most of the time. With:
`Debugger entered--Lisp error: (invalid-read-syntax "." 29 56)`

```
$ sed -n '20,29p' ~/.emacs.d/straight/build/minimap/minimap-autoloads.el   
(custom-autoload 'minimap-mode "minimap" nil) 

(autoload 'minimap-mode "minimap" "\ 
("Toggle minimap mode. 

This is a global minor mode.  If called interactively, toggle the 
`Minimap mode' mode.  If the prefix argument is positive, enable 
the mode, and if it is zero or negative, disable the mode. 

If called from Lisp, toggle the mode if ARG is `toggle'.  Enable
```

I have no idea how to fix this issue which is presenting itself very often.
Thanks
Chris