GNU bug report logs - #34986
write-region not governed by require-final-newline

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Mon, 25 Mar 2019 03:30:02 UTC

Severity: wishlist

Tags: fixed

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34986 in the body.
You can then email your comments to 34986 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#34986; Package emacs. (Mon, 25 Mar 2019 03:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 25 Mar 2019 03:30:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <at> gnu.org
Subject: write-region not governed by require-final-newline
Date: Mon, 25 Mar 2019 11:28:56 +0800
User, despite setting
 require-final-newline t
in .emacs, still finds he is often creating files without final
newlines.

It turns out write-region, which he often uses, is not governed by
require-final-newline.

I though the whole logic of require-final-newline was to help people add
those newlines.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34986; Package emacs. (Mon, 25 Mar 2019 04:09:02 GMT) Full text and rfc822 format available.

Message #8 received at 34986 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 34986 <at> debbugs.gnu.org
Subject: Re: bug#34986: write-region not governed by require-final-newline
Date: Mon, 25 Mar 2019 04:08:38 +0000
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:

> User, despite setting
>  require-final-newline t
> in .emacs, still finds he is often creating files without final
> newlines.
>
> It turns out write-region, which he often uses, is not governed by
> require-final-newline.
>
> I though the whole logic of require-final-newline was to help people add
> those newlines.

The user option require-final-newline is relevant only when visiting
files, not when writing to arbitrary ones, so you probably want to use
save-buffer instead of write-region or similar.

See (info "(emacs) Visiting"), (info "(emacs) Customize Save"), and
(info "(elisp) Saving Buffers").

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34986; Package emacs. (Mon, 25 Mar 2019 04:15:02 GMT) Full text and rfc822 format available.

Message #11 received at 34986 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 34986 <at> debbugs.gnu.org
Subject: Re: bug#34986: write-region not governed by require-final-newline
Date: Mon, 25 Mar 2019 12:14:06 +0800
>>>>> "BLC" == Basil L Contovounesios <contovob <at> tcd.ie> writes:

BLC> The user option require-final-newline is relevant only when visiting
BLC> files, not when writing to arbitrary ones,

OK, but perhaps add a note about that somewhere on the docstring:

require-final-newline...
Documentation:
Whether to add a newline automatically at the end of the file.

A value of t means do this only when the file is about to be saved.
A value of ‘visit’ means do this right after the file is visited.
A value of ‘visit-save’ means do it at both of those times.
Any other non-nil value means ask user whether to add a newline, when saving.
A value of nil means don’t add newlines.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34986; Package emacs. (Mon, 14 Oct 2019 20:50:02 GMT) Full text and rfc822 format available.

Message #14 received at 34986 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: "Basil L. Contovounesios" <contovob <at> tcd.ie>, 34986 <at> debbugs.gnu.org
Subject: Re: bug#34986: write-region not governed by require-final-newline
Date: Mon, 14 Oct 2019 22:49:52 +0200
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:

>>>>>> "BLC" == Basil L Contovounesios <contovob <at> tcd.ie> writes:
>
> BLC> The user option require-final-newline is relevant only when visiting
> BLC> files, not when writing to arbitrary ones,
>
> OK, but perhaps add a note about that somewhere on the docstring:
>
> require-final-newline...
> Documentation:
> Whether to add a newline automatically at the end of the file.

I've now added text to the doc string to mention this.

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 14 Oct 2019 20:51:04 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 34986 <at> debbugs.gnu.org and 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 14 Oct 2019 20:51:05 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 12 Nov 2019 12:24:14 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 220 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.