From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: feature request: text property to prevent font-locking Date: Sat, 30 Aug 2014 13:15:46 -0700 (PDT) Message-ID: <34f3e246-bbfb-4864-83e9-4a0c81d4202e@default> References: <20140830092701.GA3351@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1409429776 4406 80.91.229.3 (30 Aug 2014 20:16:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 30 Aug 2014 20:16:16 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 30 22:16:09 2014 Return-path: Envelope-to: ged-emacs-devel@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 1XNp4B-0007ie-Go for ged-emacs-devel@m.gmane.org; Sat, 30 Aug 2014 22:16:07 +0200 Original-Received: from localhost ([::1]:47651 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNp4B-0000oL-3Q for ged-emacs-devel@m.gmane.org; Sat, 30 Aug 2014 16:16:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNp40-0000o0-3Z for emacs-devel@gnu.org; Sat, 30 Aug 2014 16:16:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNp3r-000097-BR for emacs-devel@gnu.org; Sat, 30 Aug 2014 16:15:56 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:19101) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNp3r-000090-22 for emacs-devel@gnu.org; Sat, 30 Aug 2014 16:15:47 -0400 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s7UKFkUZ019922 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 30 Aug 2014 20:15:46 GMT Original-Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by ucsinet22.oracle.com (8.14.5+Sun/8.14.5) with ESMTP id s7UKFjN4028848 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 30 Aug 2014 20:15:45 GMT Original-Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userz7022.oracle.com (8.14.5+Sun/8.14.4) with ESMTP id s7UKFiiO028834; Sat, 30 Aug 2014 20:15:45 GMT In-Reply-To: <20140830092701.GA3351@acm.acm> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2 (807160) [OL 12.0.6691.5000 (x86)] X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:173913 Archived-At: > For this particular application of fontifying, you might be able to > use overlays, which take priority over text properties (see page > "Overlay Properties" in the Elisp manual). You might have to define > a lot of attributes for the overlay face to prevent attributes from > font-locking "showing through". >=20 > That feels like a bit of a kludge, though. The facility you've > sketched out (and implemented) might well be a useful one. Just in case I was not clear enough - I do use overlays, when they are appropriate. They are essentially about buffer positions, not the text in the buffer. But yes, one can fiddle with overlays to work around the effective removal, in a font-locked buffer, of the possibility of using `face' as a text property for other than font-locking. Like others, I have done that. I suspect that people have gotten used to this behavior by font-lock and act as if it were normal. But font-lock does not (should not) own text-property `face', even in font-locked buffers. You should not need to resort to using `face' with overlays, just to get around font-lock's effective confiscation of it for buffer text. You should be able to apply `face' to any buffer text and have a way to prevent it being taken over by font-lock there. And yes, people sometimes try other ways to work around the expropriation of `face' by font-lock. They try to show links on top of font-locked text by using property `display', for example. And yes, people sometimes end up using font-lock itself to add ad-hoc highlighting, not because it is particularly appropriate for the particular use case, but because there is little choice to do otherwise. AFAICT, this is just a missing Emacs feature: be able to exclude zones of text from being taken over by font-lock. Stop font-lock from changing property `face' from a value set by non font-lock highlighting. This feature is essentially what font-lock itself already provides for given font-lock rules (keywords), via keyword `keep'. The problem is that Font-lock does not recognize any such protection outside `font-lock-keywords'. So again, I am not looking to solve a particular highlighting problem by a workaround (overlays, other text properties such as `display',...). I'm arguing that there should be a simple way to tell font-lock "Hands off!" particular text. It should be simple to indicate that property `face' on this or that text is not open to being altered by font-lock. And I do have a solution - a trivial patch, as I indicated. And for users a simple way to tell font-lock "Hands off!": just put text property `font-lock-ignore' where you do not want font-lock to change text properties. I cannot see a downside to providing this. But since your reply is the only one so far, Alan, I conclude so far that there is no special interest in this -the problem or the proposed solution. That's OK by me - I'll continue to use the code I have. And others can continue to add a `display' property or whatever to get around the roughshod behavior of font-lock. Been there, done that. And just in case, I'll send the patch, with `report-emacs-bug'. As I said: I use this feature for various highlighting (and unhighlighting) commands, so that the highlighting works for font-locked text too. This includes `facemenu-add-face' (my version). I use it for links (`link' face), `facemenu-add-face' (any face), `hlt-highlighter' & `hlt-eraser' (mouse-drag highlighter/eraser), `hlt-region' (arbitrary (un)highlighting), `hlt-yank-props' (paste copied text properties), and more.