Subject: Re: bug#61925: 30.0.50; normal-mode does not set up local variables in temporary buffers (scratch, with-temp-buffer)

From: Wolfgang Scherer <[email-masked]>
Date: Mon, 6 Mar 2023 03:07:57 +0100

The corrected version of the advice fixes the invalid mode specification.

(let* ((expected-value (not (default-value 'truncate-lines)))

        (need-advice (with-temp-buffer
                       (insert (format (concat ";; -*-"
                                               " mode: fundamental;"
                                               " truncate-lines: %S;"
                                               " -*-")
                                       expected-value))
                       (normal-mode)
                       (not (eq truncate-lines expected-value)))))
   (when need-advice
     (defadvice normal-mode (around wsx-normal-mode activate)
       "Bind buffer-file-name to `null-device', if it is nil."
       (let ((buffer-file-name (or buffer-file-name null-device "/dev/null")))
         ad-do-it))))