[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Last line [was: Re: [SOLVED] Trouble/bug with initramfs-tools adding encrypted swap partition]



On 26/04/2024 10:56, David Wright wrote:
Editor examples: a windowed emacs buffer has a ≣ decoration at the
extreme left edge after the last line of text, so that you can
distinguish an absence of lines from empty lines.

Perhaps that decoration should be explicitly enabled. However it reminded me the following:

(info "(elisp) Library-Headers")
https://www.gnu.org/software/emacs/manual/html_node/elisp/Library-Headers.html
"D.8 Conventional Headers for Emacs Libraries"
‘;;; filename ends here’

This is the footer line; it appears at the very end of the file.
Its purpose is to enable people to detect truncated versions of the file
from the lack of a footer line.

As to some ignored line at the end of a file:
https://mywiki.wooledge.org/BashFAQ/005#Handling_newlines_.28or_lack_thereof.29_at_the_end_of_a_file
"2.1.1. Handling newlines (or lack thereof) at the end of a file"
in BASH FAQ "How can I use array variables?"

`read` returns false when it reads the last line of a file. This
presents a problem: if the file contains a trailing newline, then
read will be false when reading/assigning that final line, otherwise,
it will be false when reading/assigning the last line of data.
Without a special check for these cases, no matter what logic is
used, you will always end up either with an extra blank element in
the resulting array, or a missing final element.



Reply to: