From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?=C3=93scar_Fuentes?= Newsgroups: gmane.emacs.help Subject: Re: Highlighting a missing final newline? Date: Tue, 22 Mar 2016 14:57:11 +0100 Message-ID: <87wpouehu0.fsf@wanadoo.es> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1458655090 2702 80.91.229.3 (22 Mar 2016 13:58:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Mar 2016 13:58:10 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 22 14:57:56 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aiMoj-0001LJ-HX for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Mar 2016 14:57:53 +0100 Original-Received: from localhost ([::1]:37123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiMoe-0004Yj-0X for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Mar 2016 09:57:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiMoM-0004YF-NN for help-gnu-emacs@gnu.org; Tue, 22 Mar 2016 09:57:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aiMoI-0001U3-K7 for help-gnu-emacs@gnu.org; Tue, 22 Mar 2016 09:57:30 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:52173) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiMoI-0001Tp-3s for help-gnu-emacs@gnu.org; Tue, 22 Mar 2016 09:57:26 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aiMoB-00013T-3Q for help-gnu-emacs@gnu.org; Tue, 22 Mar 2016 14:57:19 +0100 Original-Received: from 151.red-79-153-146.dynamicip.rima-tde.net ([79.153.146.151]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 22 Mar 2016 14:57:19 +0100 Original-Received: from ofv by 151.red-79-153-146.dynamicip.rima-tde.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 22 Mar 2016 14:57:19 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 13 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 151.red-79-153-146.dynamicip.rima-tde.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.92 (gnu/linux) Cancel-Lock: sha1:y62RZaThvpSvtNZ0O35DObS7FQA= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:109654 Archived-At: egarrulo writes: > 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. If your problem consists on editing files that require to end with a newline, set `require-final-newline' on the mode hook and forget about that.