From: Drew Adams <drew.adams@oracle.com>
To: egarrulo <egarrulo@gmail.com>, help-gnu-emacs@gnu.org
Subject: RE: Highlighting a missing final newline?
Date: Tue, 22 Mar 2016 06:49:45 -0700 (PDT) [thread overview]
Message-ID: <1049fd4f-1b77-414c-be02-c64e8d6bb7fb@default> (raw)
In-Reply-To: <dlcon6FtmquU1@mid.individual.net>
> How would you highlight a missing final newline? I mean: if a buffer
> lacks a final newline, then you would see a (customizable) character at
> the end of the buffer; otherwise, you would see nothing.
>
> AFAIK, `font-lock-add-keywords' can't help here because there is no
> character to highlight. I have looked into `whitespace-mode' for
> inspiration, but the code is too complex for me.
I suppose you already know about option `require-final-newline',
and you really want highlighting, not just a chance to add a final
newline. If not:
---
require-final-newline is a variable defined in ‘files.el’.
Its value is nil
This variable is safe as a file local variable if its value
satisfies the predicate ‘symbolp’.
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.
Certain major modes set this locally to the value obtained
from ‘mode-require-final-newline’.
You can customize this variable.
next prev parent reply other threads:[~2016-03-22 13:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 11:30 Highlighting a missing final newline? egarrulo
2016-03-22 11:50 ` Yuri Khan
2016-03-22 13:37 ` egarrulo
2016-03-22 13:49 ` Drew Adams [this message]
[not found] ` <mailman.8110.1458654604.843.help-gnu-emacs@gnu.org>
2016-03-22 13:54 ` egarrulo
2016-03-22 13:57 ` Óscar Fuentes
2016-03-22 16:21 ` Eli Zaretskii
[not found] ` <mailman.8133.1458663736.843.help-gnu-emacs@gnu.org>
2016-03-22 16:42 ` egarrulo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1049fd4f-1b77-414c-be02-c64e8d6bb7fb@default \
--to=drew.adams@oracle.com \
--cc=egarrulo@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.