reddit / emacs

My autoloads generate weird

where_Is_My_Towel · 2022-03-07 00:15
Hi! I cannot figure out this bug, and do not know where I'd start. Whenever packages are installed I sometimes get autoloads that look sorta like this: `(custom-autoload 'async-bytecomp-package-mode "async-bytecomp" nil)` `(autoload 'async-bytecomp-package-mode "async-bytecomp" "\` `("Byte compile asynchronously packages installed with package.el.` `Async compilation of packages can be controlled by` `\`async-bytecomp-allowed-packages'.` `If called interactively, enable Async-Bytecomp-Package` `mode if ARG is positive, and disable it if ARG is zero or` `negative. If called from Lisp, also enable the mode if` `ARG is omitted or nil, and toggle it if ARG is \`toggle';` `disable the mode otherwise.` `\(fn &optional ARG)" 151 152 (face default) 207 208 (face default) 266 267 (face default) 323 324 (face default) 381 382 (face default)) t nil)` The (" starting on line 3 and the snippet `151 152 (face default) 207 208 (face default) 266 267 (face default) 323 324 (face default) 381 382 (face default))` break autoloads for all sorts of packages in a way that is hard to track down (paren/quote mismatch leads to invalid autoloads for rest of the file). The snippet does not always feature the same numbers. Example: `34 35 (face default) 91 92 (face default) 148 149 (face default) 201 202 (face default) 260 261 (face default))` ...any ideas on this? These snippets have appeared in a wide number of autoload files-- magit, org-roam, valign, some ivy rich packages, etc. They do not appear in the upstream git repositories. ​ They also reappear on package update, breaking large swathes of functionality. edit: emacs 27.2
nv-elisp · 2022-03-07 00:54
What package manager are you using?
fragglestickcar0 · 2022-03-07 01:49
Yodel looks better with every indecipherable question of OP's sort.
where_Is_My_Towel · 2022-03-07 02:36
use-package for basically everything. Some things are not configured with use-package but are using the default emacs package manager. The system is arch, so pacman
where_Is_My_Towel · 2022-03-07 02:38
to clarify, the packages work as intended when I remove the snippets from the auto loads file, and the snippets are put into the auto loads automatically
nv-elisp · 2022-03-07 03:40
You should amend your post to include this information as well as the version of Emacs you are running.
where_Is_My_Towel · 2022-03-21 08:43
Alright So I've investigated a bit. The autoload error comes down to setting left-margin in custom-variables, which, like, insane. Here's the steps to reproduce from the bug report I filed with gnu: Setting left-margin variable breaks many autoload files when installing or updating packages. Steps to reproduce (arch linux, GNU Emacs 27.2 (build 1, x86\_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.4) of 2022-03-11) 1. Delete all installed versions of magit (our test package) a. for me this looks like calling M-x package-delete return magit until I can't delete anything else 2. from command line, emacs -Q 3. yank reproduction config file into a scratch buffer of clean emacs instance: `(custom-set-variables '(left-margin 8) ) (setq byte-compile-warnings '(cl-functions))` `;;Initialize package sources (require 'package) (setq package-archives '( ("melpa" . "`[`https://melpa.org/packages/`](https://melpa.org/packages/)`") ("org" . "`[`https://orgmode.org/elpa/`](https://orgmode.org/elpa/)`") ("elpa" . "`[`https://elpa.gnu.org/packages/`](https://elpa.gnu.org/packages/)`") ) )` 4. M-x eval-buffer return 5. M-x package-install return magit 6. Notice a bunch of a compiler warnings and errors, I usually receive something about autoloads 105 7. Examine magit-autoloads.el file 8. Notice that some of the generated autoloads have mismatched delimiters, (" appearing on the second line of an autoload, in a region that is supposed to be a comment is fairly common, like `(autoload 'magit-wip-before-change-mode "magit-wip" "("Commit to work-in-progress refs before certain destructive changes.` `If called interactively, enable Magit-Wip-Before-Change` `mode if ARG is positive, and disable it if ARG is zero or` `negative. If called from Lisp, also enable the mode if` `ARG is omitted or nil, and toggle it if ARG is \`toggle';` `disable the mode otherwise.` `Before invoking a revert command or an "apply variant" command (apply, stage, unstage, discard, and reverse) commit the affected tracked files to the current wip refs. For each branch there may be two wip refs; one contains snapshots of the files as found in the worktree and the other contains snapshots of the entries in the index.` `Only changes to files which could potentially be affected by the command which is about to be called are committed.` `(fn &optional ARG)" 69 70 (face default) 126 127 (face default) 185 186 (face default) 242 243 (face default) 300 301 (face default)) t nil)` face default mismatched paren occurs sometimes (I've only reproduced that with my full init.el though). These mismatched delimiters do not appear upstream! 9. This does not necessarily break the autoload it happens to, but it will tend to break all subsequent autoloads in the file, and it is fairly difficult for a user to understand why this would happen. 10. You can toggle this error on and off by following steps to reproduce and commenting or uncommenting the left-margin line. a. it is important you start with a fresh instance of emacs each time, setting left-margin, commenting the line, then reevaluting the buffer will leave left-margin still set, and the error will still occur 11. This happens for a bunch of packages! org-roam, lsp-mode, magit, valign, some ivy packages, some ivy stuff, treemacs, company, the list is long.
nice___bot · 2022-03-21 08:44
Nice!