unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Matthew Malcomson <hardenedapple@gmail.com>
Cc: 62419@debbugs.gnu.org
Subject: bug#62419: 28.2; Elisp let-bound buffer-local variable and kill-local-variable
Date: Sun, 26 Mar 2023 10:34:05 -0400	[thread overview]
Message-ID: <jwvpm8v7fcg.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <jwvv8in7hm8.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 26 Mar 2023 10:01:48 -0400")

> The "`newline` let-binds `auto-fill-mode`" seems like the source of the
> problem :-(

We could fix it with a patch like the one below (intended for `master`).


        Stefan


diff --git a/lisp/simple.el b/lisp/simple.el
index 3e50e888dad..6f0215bfb1d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -659,7 +659,7 @@ newline
          (beforepos (point))
          (last-command-event ?\n)
          ;; Don't auto-fill if we have a prefix argument.
-         (auto-fill-function (if arg nil auto-fill-function))
+         (inhibit-auto-fill (or inhibit-auto-fill arg))
          (arg (prefix-numeric-value arg))
          (procsym (make-symbol "newline-postproc")) ;(bug#46326)
          (postproc
@@ -9269,11 +9269,15 @@ default-indent-new-line
        ;; If we're not inside a comment, just try to indent.
        (t (indent-according-to-mode))))))
 
+(defvar inhibit-auto-fill nil
+  "Non-nil means to do as if `auto-fill-mode' was disabled.")
+
 (defun internal-auto-fill ()
   "The function called by `self-insert-command' to perform auto-filling."
-  (when (or (not comment-start)
-            (not comment-auto-fill-only-comments)
-            (nth 4 (syntax-ppss)))
+  (when (and (not inhibit-auto-fill)
+             (or (not comment-start)
+                 (not comment-auto-fill-only-comments)
+                 (nth 4 (syntax-ppss))))
     (funcall auto-fill-function)))
 
 (defvar normal-auto-fill-function #'do-auto-fill






  reply	other threads:[~2023-03-26 14:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 13:37 bug#62419: 28.2; Elisp let-bound buffer-local variable and kill-local-variable Matthew Malcomson
2023-03-25 11:49 ` Eli Zaretskii
2023-03-25 16:19   ` Matthew Malcomson
2023-03-26 14:01 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-26 14:34   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-03-26 15:01   ` Matthew Malcomson
2023-03-26 15:16     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-26 15:30     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-29 10:56       ` Matthew Malcomson
2023-04-02 21:55         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-12  0:00           ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvpm8v7fcg.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=62419@debbugs.gnu.org \
    --cc=hardenedapple@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).