Subject: bug#54993: 28.1; Editing etc/NEWS on master with Emacs 28 signals an error

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 17 Apr 2022 22:27:51 +0200

Jim Porter <[email-masked]> writes:

>   # -*- mode: FOO; mode: BAR -*-
>
> This way, it would try to load FOO-mode and then BAR-mode in order,
> and so I could set up the mode for files to ensure that users with
> BAR-mode available can use that, but it falls back to FOO-mode
> otherwise. Unfortunately, in Emacs 28.1, this now fails with:
>
>   File local-variables error: (error Lisp nesting exceeds
>   ‘max-lisp-eval-depth’)

Yes, there's something weird going on with the mode: spec.  With the
following, and Emacs 28.1 (and NEWS from 29), it infloops.

(unless (fboundp 'emacs-news-mode)
  (defun emacs-news-mode ()
    (outline-mode)))

Like this:

  emacs-news-mode()
  hack-one-local-variable(mode emacs-news)
  hack-local-variables-apply()
  hack-local-variables(no-mode)
  run-mode-hooks(outline-mode-hook)
  outline-mode()
  emacs-news-mode()
  hack-one-local-variable(mode emacs-news)
  hack-local-variables-apply()
  hack-local-variables(no-mode)
  run-mode-hooks(outline-mode-hook)
  outline-mode()
  emacs-news-mode()
  set-auto-mode-0(emacs-news-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)

The mode: parsing stuff was largely redone for Emacs 28.1, and
I guess this is a fallout from that.  

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no