GNU bug report logs -
#36702
27.0.50; newline: don't auto-fill regardless of auto-fill-mode
Previous Next
Reported by: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Date: Wed, 17 Jul 2019 10:18:03 UTC
Severity: minor
Tags: fixed, patch
Found in versions 27.0.50, 26.2.90
Fixed in version 27.1
Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Bug is archived. No further changes may be made.
Full log
Message #14 received at 36702 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
severity 36702 minor
found 36702 26.2.90
tags 36702 + patch
quit
Andreas Röhler <andreas.roehler <at> easy-emacs.de> writes:
> On 17.07.19 12:47, Basil L. Contovounesios wrote:
>
>> The docstring of newline says:
>>
>> Calls `auto-fill-function' if the current column number is greater
>> than the value of `fill-column' and ARG is nil.
>
> Did you try the test-function delivered?
Yes.
> It inserts a newline in an empty buffer.
>
> May that condition being matched then?
Ah, are you referring to the condition that the current column number be
greater than fill-column? This condition is enforced by the default
value of normal-auto-fill-function when auto-fill-mode is enabled,
namely do-auto-fill. A different auto-fill-function mightn't enforce
it.
In general, there are multiple conditions guarding calls to
auto-fill-function (see e.g. internal-auto-fill and
internal_self_insert), and I'm not sure the docstring of newline is the
right place to discuss these things. How's the following clarification
for emacs-26 instead?
[0001-Clarify-docs-on-newline-and-auto-fill-mode.patch (text/x-diff, inline)]
From 2ed60518cb5d29c0d8c7cc944740c0fecb1713ef Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Date: Wed, 17 Jul 2019 13:05:42 +0100
Subject: [PATCH] Clarify docs on newline and auto-fill-mode
* doc/lispref/text.texi (Commands for Insertion):
* lisp/simple.el (newline): Do not mention conditions specific to
'do-auto-fill' under documentation of 'newline' (bug#36702).
---
doc/lispref/text.texi | 17 ++++++++++-------
lisp/simple.el | 9 +++++----
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index f44659c622..dad6fa2280 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -542,25 +542,28 @@ Commands for Insertion
loop handles this function specially.
@end deffn
-@deffn Command newline &optional number-of-newlines
+@deffn Command newline &optional number-of-newlines interactive
This command inserts newlines into the current buffer before point.
If @var{number-of-newlines} is supplied, that many newline characters
-are inserted.
+are inserted. In an interactive call, @var{number-of-newlines} is the
+numeric prefix argument.
@cindex newline and Auto Fill mode
-This function calls @code{auto-fill-function} if the current column
-number is greater than the value of @code{fill-column} and
-@var{number-of-newlines} is @code{nil}. Typically what
+This command calls @code{self-insert-command} to insert newlines,
+which may subsequently break the preceding line by calling
+@code{auto-fill-function} (@pxref{Auto Filling}). Typically what
@code{auto-fill-function} does is insert a newline; thus, the overall
result in this case is to insert two newlines at different places: one
at point, and another earlier in the line. @code{newline} does not
auto-fill if @var{number-of-newlines} is non-@code{nil}.
+This command does not run the hook @code{post-self-insert-hook} unless
+called interactively or @var{interactive} is non-@code{nil}.
+
This command indents to the left margin if that is not zero.
@xref{Margins}.
-The value returned is @code{nil}. In an interactive call, @var{count}
-is the numeric prefix argument.
+The value returned is @code{nil}.
@end deffn
@defvar overwrite-mode
diff --git a/lisp/simple.el b/lisp/simple.el
index a0f2da7152..d524d3f0ce 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -427,17 +427,18 @@ newline
that it adds, and reindents the preceding line. To just insert
a newline, use \\[electric-indent-just-newline].
-Calls `auto-fill-function' if the current column number is greater
-than the value of `fill-column' and ARG is nil.
+If `auto-fill-mode' is enabled, this may cause automatic line
+breaking of the preceding line. A non-nil ARG inhibits this.
+
A non-nil INTERACTIVE argument means to run the `post-self-insert-hook'."
(interactive "*P\np")
(barf-if-buffer-read-only)
- ;; Call self-insert so that auto-fill, abbrev expansion etc. happens.
+ ;; Call self-insert so that auto-fill, abbrev expansion etc. happen.
;; Set last-command-event to tell self-insert what to insert.
(let* ((was-page-start (and (bolp) (looking-at page-delimiter)))
(beforepos (point))
(last-command-event ?\n)
- ;; Don't auto-fill if we have a numeric argument.
+ ;; Don't auto-fill if we have a prefix argument.
(auto-fill-function (if arg nil auto-fill-function))
(arg (prefix-numeric-value arg))
(postproc
--
2.20.1
[Message part 3 (text/plain, inline)]
Thanks,
--
Basil
This bug report was last modified 5 years and 224 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.