From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.help Subject: Re: disable that the face of a newline character extends to the right Date: Fri, 22 May 2009 10:00:33 +0200 Message-ID: <4A165BA1.3000307@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1242982874 32318 80.91.229.12 (22 May 2009 09:01:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 May 2009 09:01:14 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: sensorflo@gmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 22 11:01:07 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1M7Qck-0002R1-0c for geh-help-gnu-emacs@m.gmane.org; Fri, 22 May 2009 11:01:06 +0200 Original-Received: from localhost ([127.0.0.1]:33893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M7Qcj-00048J-9S for geh-help-gnu-emacs@m.gmane.org; Fri, 22 May 2009 05:01:05 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M7QcO-00048E-4l for help-gnu-emacs@gnu.org; Fri, 22 May 2009 05:00:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M7QcI-00047z-75 for help-gnu-emacs@gnu.org; Fri, 22 May 2009 05:00:42 -0400 Original-Received: from [199.232.76.173] (port=37495 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M7QcI-00047w-37 for help-gnu-emacs@gnu.org; Fri, 22 May 2009 05:00:38 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]:59982) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1M7QcH-0001F9-D5 for help-gnu-emacs@gnu.org; Fri, 22 May 2009 05:00:37 -0400 Original-Received: (qmail invoked by alias); 22 May 2009 08:00:36 -0000 Original-Received: from 62-47-49-153.adsl.highway.telekom.at (EHLO [62.47.49.153]) [62.47.49.153] by mail.gmx.net (mp014) with SMTP; 22 May 2009 10:00:36 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18zw58E02IzM+StZlMPZ4nbFQ8gci58SNucXzz9hp 79tJsb+I8n6/CN User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) Original-References: 6a97a501-948a-47ad-997b-3743998fda04@l32g2000vba.googlegroups.com X-Y-GMX-Trusted: 0 X-FuHaFi: 0.62 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:64622 Archived-At: > The face of a newline character seems to extend to the right to > infinity. > > I have set the background color of font-lock-comment-face, but I find > it ugly if now all comment lines have a colored beam at the right > side. > > Is there a way to configure how the background color of a newline > character should be rendered? E.g. not at all, or just the newline > character itself. Try to add the function below to your .emacs. It's likely suboptimal and I didn't look into it for quite a while but it still does the job. martin (defun font-lock-fontify-syntactically-region (start end &optional loudly ppss) "Put proper face on each string and comment between START and END. START should be at the beginning of a line." (let (state face from to lep) (goto-char start) (setq state (or ppss (syntax-ppss start))) (while (progn (when (or (nth 3 state) (nth 4 state)) (setq face (funcall font-lock-syntactic-face-function state)) (setq from (max (nth 8 state) start)) (setq state (parse-partial-sexp (point) end nil nil state 'syntax-table)) (setq to (point)) (save-excursion (goto-char from) (while (< from to) (setq lep (line-end-position)) (if (< lep to) (progn (put-text-property from lep 'face face) (remove-text-properties lep (1+ lep) '(face nil)) ; rear-nonsticky t)) (goto-char (setq from (1+ lep)))) (put-text-property from to 'face face) (setq from to))))) (< (point) end)) (setq state (parse-partial-sexp (point) end nil nil state 'syntax-table)))))