Subject: 30.0.50; pp-fill fails when symbol's lisp-indent-function is bigger than number of arguments

From: Ola x Nilsson <[email-masked]>
Date: Wed, 9 Aug 2023 00:08:54 +0200

The `pp-fill' function uses the symbol property `lisp-indent-function'
to insert line breaks in function calls.  If the property is an integer
larger than the actual number of arguments in the function call,
`forward-sexp' will eventually signal an error.

When the symbol property is `defun', `pp-fill' will assume this is
equivalent to the value 2 which will suffer the same problem.

This behaviour is also present in `lisp-data-mode' where it does not
really make sense to me to assume the first symbol in a list is a
function.

I triggered this problem when I tried to use pp-buffer in a
archive-contents file from GNU ELPA.  The entry for `kiwix' lists
`request' as a dependency.  As `request' is also a symbol with
`lisp-indent-function' set to `defun', `pp-fill' attempts to insert a
newline after the nonexistent ARG2 causing an error. 

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.20, cairo version 1.16.0) of 2023-08-07 built on lap5cg80647hz
Repository revision: 18e7bc87521e3c48b819cfe4a113f532ba905561
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04.6 LTS

Configured using:
 'configure --with-native-compilation --with-mailutils
 --with-tree-sitter'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP
NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

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

Major mode: Diff

Minor modes in effect:
  windmove-mode: t
  magit-auto-revert-mode: t
  tracking-mode: t
  buffer-positions-mode: t
  hes-mode: t
  desktop-save-mode: t
  global-git-commit-mode: t
  whitespace-mode: t
  which-function-mode: t
  display-time-mode: t
  global-auto-revert-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/olani/emacs-packages/cov/cov hides /home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/cov-20220727.31/cov
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/dpkg-dev-el-20230220.1635/debian-autoloads hides /home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/debian-el-20211006.1939/debian-autoloads
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/emacsql-sqlite-20221127.2146/emacsql-sqlite hides /home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/emacsql-20230417.1448/emacsql-sqlite
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/hydra-0.15.0/lv hides /home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/lv-20200507.1518/lv
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/magit-gerrit-20230309.2251/magit-gerrit hides /home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/magit-gerrit-20210831.1453/magit-gerrit
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/magit-gerrit-20230309.2251/magit-gerrit-pkg hides /home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/magit-gerrit-20210831.1453/magit-gerrit-pkg
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/magit-gerrit-20230309.2251/magit-gerrit-autoloads hides /home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/magit-gerrit-20210831.1453/magit-gerrit-autoloads
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/circe-20221126.1508/tracking hides /home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/tracking-20210713.1609/tracking
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/circe-20221126.1508/shorten hides /home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/tracking-20210713.1609/shorten
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/transient-20221127.2242/transient hides /usr/local/share/emacs/30.0.50/lisp/transient
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/use-package-20221127.2217/use-package-lint hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-lint
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/use-package-20221127.2217/use-package-jump hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-jump
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/use-package-20221127.2217/use-package-ensure hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-ensure
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/use-package-20221127.2217/use-package hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/use-package-20221127.2217/use-package-diminish hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-diminish
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/use-package-20221127.2217/use-package-delight hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-delight
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/use-package-20221127.2217/use-package-core hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-core
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/use-package-20221127.2217/use-package-bind-key hides /usr/local/share/emacs/30.0.50/lisp/use-package/use-package-bind-key
/home/olani/.emacs.d/elpa-lap5cg80647hz-30.0.50/bind-key-20221117.1610/bind-key hides /usr/local/share/emacs/30.0.50/lisp/use-package/bind-key

Features:
(shadow mail-extr emacsbug log-view vc-annotate vc goto-addr
gerrit-buttons sort find-dired cl-indent inf-lisp edebug magit-extras
ffap grep dired-aux coan-dired cl-print hydra-examples windmove rect
hydra lv tar-mode arc-mode archive-mode cus-edit cus-start cus-load
coan-magit-gerrit magit-gerrit face-remap coan-magit magit-submodule
magit-obsolete magit-popup magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log magit-diff smerge-mode
diff magit-core magit-autorevert magit-margin magit-transient
magit-process magit-mode mm-archive url-http-ntlm ntlm hmac-md5 hex-util
md4 mule-util network-stream url-cache url-http url-gw nsm
display-line-numbers cursor-sensor circe-color-nicks circe
lui-irc-colors irc lcs lui-logging lui-format lui tracking shorten
flyspell ispell circe-compat scroll-lock oc-basic ol-eww eww url-queue
mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-art mm-uu
mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill
kinsoku url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus
xml gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int
gnus-range gnus-win gnus nnheader range wid-edit ol-docview doc-view
jka-compr image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m ol-doi
org-link-doi yaml-mode flycheck-checkbashisms mmm-sh-here-doc mmm-mode
mmm-univ mmm-class mmm-region sh-script executable help-fns misearch
multi-isearch coan cl checkdoc coan-elisp skeleton autoload
delete-trailing-whitespace-mode init highlight-escape-sequences woman
man ob-dot anaphora groovy-mode dired-rainbow dired-hacks-utils
autoinsert sed-mode smie mmm-sample mmm-auto mmm-vars mmm-utils
mmm-compat t32-auto coan-list midnight desktop frameset python treesit
rustic-flycheck rustic-spellcheck rustic-expand rustic-lsp
rustic-playpen rustic-rustfix rustic-racer etags fileloop rustic-babel
rustic-rustfmt org-element org-persist org-id org-refile avl-tree
generator org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-src ob-comint org-pcomplete org-list org-footnote org-faces
org-entities ob-emacs-lisp ob-core ob-eval org-cycle org-table ol
org-fold org-fold-core org-keys oc org-loaddefs cal-menu calendar
cal-loaddefs org-version org-compat org-macs rustic-comint rustic-clippy
rustic-doc f f-shortdoc shortdoc rustic-popup rustic-cargo
rustic-compile spinner s xterm-color markdown-mode color noutline
outline rustic-interaction rustic rust-utils rust-mode eglot
external-completion jsonrpc xref ert pp ewoc debug backtrace
flycheck-flawfinder flycheck-cstyle flycheck find-func bug-reference
git-modes gitignore-mode gitconfig-mode conf-mode gitattributes-mode
git-commit magit-git magit-base magit-section crm dash compat-27
compat-26 with-editor transient comp comp-cstr compat server log-edit
message sendmail yank-media puny dired dired-loaddefs rfc822 mml mml-sec
epa derived epg rfc6068 epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
flymake-git-whitespace flymake-proc flymake project compile
text-property-search thingatpt vc-git diff-mode vc-dispatcher advice
edmacro kmacro coan-30.0.50-autoloads bitbake-modes-autoloads
loaddefs-gen lisp-mnt radix-tree tramp-sh whitespace which-func imenu
warnings icons exec-path-from-shell cl-extra time avoid autorevert
filenotify use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core finder-inf coan-system pcase tramp trampver
tramp-integration files-x tramp-message help-mode tramp-compat xdg shell
pcomplete comint ansi-osc ring parse-time iso8601 time-date format-spec
ansi-color tramp-loaddefs a-autoloads anaphora-autoloads circe-autoloads
closql-autoloads cmake-mode-autoloads cov-autoloads darkroom-autoloads
dash-functional-autoloads dired-rainbow-autoloads
dired-hacks-utils-autoloads dpkg-dev-el-autoloads dpkg-dev-el
debian-el-autoloads debian-el dts-mode-autoloads edit-server-autoloads
elquery-autoloads emacsql-sqlite-autoloads emacsql-autoloads
erc-hl-nicks-autoloads esxml-autoloads excorporate-autoloads
exec-path-from-shell-autoloads flycheck-checkbashisms-autoloads
flycheck-cstyle-autoloads flycheck-flawfinder-autoloads
flycheck-mypy-autoloads flycheck-autoloads frame-purpose-autoloads
fsm-autoloads ghub-autoloads git-gutter-autoloads git-modes-autoloads
git-timemachine-autoloads graphql-mode-autoloads
graphviz-dot-mode-autoloads groovy-mode-autoloads
highlight-escape-sequences-autoloads hydra-autoloads json-mode-autoloads
rx json-snatcher-autoloads kconfig-mode-autoloads kv-autoloads
lv-autoloads macrostep-autoloads magit-gerrit-autoloads
magit-imerge-autoloads magit-autoloads git-commit-autoloads
magit-popup-autoloads magit-section-autoloads meson-mode-autoloads
mmm-mode-autoloads mu4e-alert-autoloads ht-autoloads alert-autoloads
log4e-autoloads gntp-autoloads ninja-mode-autoloads
ob-restclient-autoloads org-re-reveal-autoloads htmlize-autoloads
ov-autoloads pkg-info-autoloads epl-autoloads pycoverage-autoloads
rainbow-identifiers-autoloads repo-autoloads request-autoloads
restclient-autoloads rustic-autoloads markdown-mode-autoloads
f-autoloads dash-autoloads rust-mode-autoloads s-autoloads
sass-mode-autoloads haml-mode-autoloads scss-mode-autoloads
sed-mode-autoloads spinner-autoloads ssh-config-mode-autoloads
tracking-autoloads transient-autoloads treepy-autoloads
url-http-ntlm-autoloads url-auth use-package-autoloads
bind-key-autoloads web-mode-autoloads with-editor-autoloads info
compat-autoloads xterm-color-autoloads yaml-autoloads
yaml-mode-autoloads package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv
bytecomp byte-compile url-vars cl-loaddefs cl-lib early-init rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
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 emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 2524783 624554) (symbols 48 50577 10)
 (strings 32 473012 53616) (string-bytes 1 13896900)
 (vectors 16 186914) (vector-slots 8 3198879 292395)
 (floats 8 1331 10092) (intervals 56 215514 3376) (buffers 984 61))