all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Kangas <stefan@marxist.se>
Cc: 22847@debbugs.gnu.org, Glenn Morris <rgm@gnu.org>
Subject: bug#22847: #17062: 24.3 current-fill-column breaks fill-match-adaptive-prefix
Date: Wed, 12 May 2021 15:25:51 +0200	[thread overview]
Message-ID: <871rackrs0.fsf@gnus.org> (raw)
In-Reply-To: <CADwFkmmeCMJx2ef1UOE7StOy4KcT5ErcevCm_KvfrzzEs0UrBg@mail.gmail.com> (Stefan Kangas's message of "Mon, 10 May 2021 08:29:49 -0500")

Stefan Kangas <stefan@marxist.se> writes:

> There might be a subtle problem with it after all but I can't remember
> the details now.
>
> This code is a little bit more tricky than what first meets the eye, I
> think.  So I would suggest someone takes a closer look before
> installing.

I've given the patch a try, and it seems to work as advertised.  Does
anybody else have a comment?  I've respun the patch against the current
tree and done some minor edits:

diff --git a/etc/NEWS b/etc/NEWS
index de3779cd73..3069b4d498 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -108,6 +108,16 @@ avoid security issues when executing untrusted code.  See the manual
 page for 'seccomp' system call, for details about Secure Computing
 filters.
 
+** Setting 'fill-column' to nil is obsolete.
+This undocumented use of 'fill-column' is now obsolete.  If you have
+set this value to nil disable auto filling, instead disable
+'auto-fill-mode' in the relevant mode instead.
+
+For instance, you could add something like the following to your init
+file:
+
+    (add-hook 'foo-mode-hook (lambda () (auto-fill-mode -1))
+
 \f
 * Changes in Emacs 28.1
 
diff --git a/lisp/simple.el b/lisp/simple.el
index b4e34f1e4c..d21daf9e19 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7931,7 +7931,7 @@ do-auto-fill
   (let (fc justify give-up
 	   (fill-prefix fill-prefix))
     (if (or (not (setq justify (current-justification)))
-	    (null (setq fc (current-fill-column)))
+	    (setq fc (current-fill-column))
 	    (and (eq justify 'left)
 		 (<= (current-column) fc))
 	    (and auto-fill-inhibit-regexp
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 3914bdeb83..f394171fb6 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -133,6 +133,8 @@ adaptive-fill-function
 (defvar fill-indent-according-to-mode nil ;Screws up CC-mode's filling tricks.
   "Whether or not filling should try to use the major mode's indentation.")
 
+(defvar current-fill-column--has-warned nil)
+
 (defun current-fill-column ()
   "Return the fill-column to use for this line.
 The fill-column to use for a buffer is stored in the variable `fill-column',
@@ -158,7 +160,14 @@ current-fill-column
 			     (< col fill-col)))
 	    (setq here change
 		  here-col col))
-	  (max here-col fill-col)))))
+	  (max here-col fill-col))
+      ;; This warning was added in 28.1.  It should be removed later,
+      ;; and this function changed to never return nil.
+      (unless current-fill-column--has-warned
+        (lwarn '(fill-column) :warning
+               "Setting this variable to nil is obsolete; use `(auto-fill-mode -1)' instead")
+        (setq current-fill-column--has-warned t))
+      most-positive-fixnum)))
 
 (defun canonically-space-region (beg end)
   "Remove extra spaces between words in region.


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





  reply	other threads:[~2021-05-12 13:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29  7:33 bug#22847: #17062: 24.3 current-fill-column breaks fill-match-adaptive-prefix Andreas Röhler
2016-02-29 15:56 ` Eli Zaretskii
2016-12-08 22:32   ` Glenn Morris
2016-12-09  8:08     ` Eli Zaretskii
2016-12-11  2:18       ` Glenn Morris
2020-08-15  5:14         ` Stefan Kangas
2021-05-10 11:48           ` Lars Ingebrigtsen
2021-05-10 13:29             ` Stefan Kangas
2021-05-12 13:25               ` Lars Ingebrigtsen [this message]
2021-07-23 12:58                 ` Lars Ingebrigtsen

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

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

  git send-email \
    --in-reply-to=871rackrs0.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=22847@debbugs.gnu.org \
    --cc=rgm@gnu.org \
    --cc=stefan@marxist.se \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.