unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34986: write-region not governed by require-final-newline
@ 2019-03-25  3:28 積丹尼 Dan Jacobson
  2019-03-25  4:08 ` Basil L. Contovounesios
  0 siblings, 1 reply; 4+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-03-25  3:28 UTC (permalink / raw)
  To: 34986

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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#34986: write-region not governed by require-final-newline
  2019-03-25  3:28 bug#34986: write-region not governed by require-final-newline 積丹尼 Dan Jacobson
@ 2019-03-25  4:08 ` Basil L. Contovounesios
  2019-03-25  4:14   ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 4+ messages in thread
From: Basil L. Contovounesios @ 2019-03-25  4:08 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 34986

積丹尼 Dan Jacobson <jidanni@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#34986: write-region not governed by require-final-newline
  2019-03-25  4:08 ` Basil L. Contovounesios
@ 2019-03-25  4:14   ` 積丹尼 Dan Jacobson
  2019-10-14 20:49     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-03-25  4:14 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 34986

>>>>> "BLC" == Basil L Contovounesios <contovob@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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#34986: write-region not governed by require-final-newline
  2019-03-25  4:14   ` 積丹尼 Dan Jacobson
@ 2019-10-14 20:49     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-14 20:49 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: Basil L. Contovounesios, 34986

積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:

>>>>>> "BLC" == Basil L Contovounesios <contovob@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-14 20:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-25  3:28 bug#34986: write-region not governed by require-final-newline 積丹尼 Dan Jacobson
2019-03-25  4:08 ` Basil L. Contovounesios
2019-03-25  4:14   ` 積丹尼 Dan Jacobson
2019-10-14 20:49     ` Lars Ingebrigtsen

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).