Subject: bug#42143: 26.1; auto-fill-mode

From: Alan Mackenzie <[email-masked]>
Date: 1 Jul 2020 17:53:00 -0000

Hello, Susan.

In article <[email-masked]> you wrote:
> [-- text/plain, encoding quoted-printable, charset: UTF-8, 657 lines --]

> --text follows this line--

> ;; ———————————————————————————————————————————————————————

> ;; I found this week that auto-fill-mode wasn't working.

How wasn't it working?  What did Emacs do and/or fail to do, and what
action were you taking when it did/didn't do this?

> ;; The issue
> ;; seemed to be some missing variables (`current-fill-column' and
> ;; `right-margin') that were mentioned in the doc string ....

Which doc string, exactly?

> ;; .... but
> ;; didn't show up in the actual code.

current-fill-column is actually a function rather than a variable.
right-margin is, I think, a variable which is bound locally within
functions, but isn't in any sense a configuration variable.

> ;; I cobbled together this
> ;; workaround to get it going.

> (use-package simple

>   :preface
>   ;; `auto-fill-mode': The doc string describes how
>   ;; `current-fill-column' is calculated, but the code fails to
>   ;; do so. This provides some values so `auto-fill-mode' can
>   ;; work. Without it, the mode does nothing.
>   (defvar right-margin 0
>     "Supply right-margin if needed.")
>   (defvar current-fill-column 80
>     "Supply current-fill-column if needed.")
>   (setq current-fill-column (- fill-column right-margin))

>   :init
>   (defun auto-fill (&optional arg)
>     "Run `auto-fill-mode' with `current-fill-column' set."
>     ;; I reset `current-fill-column' here in case `fill-column'
>     ;; and/or `right-margin' have changed.
>     (setq current-fill-column (- fill-column right-margin))
>     (auto-fill-mode arg))

>   :hook (text-mode . auto-fill))

> ;; ———————————————————————————————————————————————————————

Do you still see problems in auto-fill-mode when you start emacs with
the -Q flag?  If not, there could be something wrong with your
configuration.

> In GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
>  of 2019-09-22, modified by Debian built on x86-grnet-01
> Windowing system distributor 'The X.Org Foundation', version 11.0.12001000
> System Description: Debian GNU/Linux 10 (buster)

[ .... ]

> Configured using:
>  'configure --build x86_64-linux-gnu --prefix=/usr
>  --sharedstatedir=/var/lib --libexecdir=/usr/lib
>  --localstatedir=/var/lib --infodir=/usr/share/info
>  --mandir=/usr/share/man --enable-libsystemd --with-pop=yes
>  --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/usr/share/emacs/site-lisp
>  --with-sound=alsa --without-gconf --with-mailutils --build
>  x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
>  --libexecdir=/usr/lib --localstatedir=/var/lib
>  --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd
>  --with-pop=yes
>  --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/usr/share/emacs/site-lisp
>  --with-sound=alsa --without-gconf --with-mailutils --with-x=yes
>  --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
>  -fdebug-prefix-map=/build/emacs-StqULU/emacs-26.1+1=.
>  -fstack-protector-strong -Wformat -Werror=format-security -Wall'
>  'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

> Configured features:
> XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
> ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
> TOOLKIT_SCROLL_BARS GTK3 X11 THREADS LIBSYSTEMD LCMS2

> Important settings:
>   value of $LANG: en_US.UTF-8
>   locale-coding-system: utf-8-unix

> Major mode: LispInt

> Minor modes in effect:
>   display-line-numbers-mode: t
>   display-time-mode: t
>   show-paren-mode: t
>   global-hl-line-mode: t
>   homing-mode: t
>   recentf-mode: t
>   delete-selection-mode: t
>   cua-mode: t
>   override-global-mode: t
>   tooltip-mode: t
>   global-eldoc-mode: t
>   eldoc-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   tool-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   size-indication-mode: t
>   column-number-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>   abbrev-mode: t

> Load-path shadows:

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).