From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "andlind@gmail.com" Newsgroups: gmane.emacs.help Subject: Re: Font-lock seemingly interacting with insertion Date: Tue, 15 May 2018 01:04:20 -0700 (PDT) Message-ID: <10a1561f-953f-4514-90e1-ffed73058fa1@googlegroups.com> References: <87bmfi0zgb.fsf@mbork.pl> <83bmfhly00.fsf@gnu.org> <87d0zx8qmy.fsf@web.de> <83tvt9jvsv.fsf@gnu.org> <87muz1zbez.fsf@web.de> <18a0fded-210a-4c21-b1f1-e7193d7b1110@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1526371409 9617 195.159.176.226 (15 May 2018 08:03:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 15 May 2018 08:03:29 +0000 (UTC) Injection-Date: Tue, 15 May 2018 08:04:20 +0000 User-Agent: G2/1.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 15 10:03:25 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fIUvc-0002NX-Ud for geh-help-gnu-emacs@m.gmane.org; Tue, 15 May 2018 10:03:25 +0200 Original-Received: from localhost ([::1]:50279 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIUxi-0004uq-Ih for geh-help-gnu-emacs@m.gmane.org; Tue, 15 May 2018 04:05:34 -0400 X-Received: by 2002:a37:1111:: with SMTP id b17-v6mr20050995qkh.45.1526371460539; Tue, 15 May 2018 01:04:20 -0700 (PDT) X-Received: by 2002:a1f:b09:: with SMTP id 9-v6mr2290893vkl.13.1526371460351; Tue, 15 May 2018 01:04:20 -0700 (PDT) Original-Path: usenet.stanford.edu!x25-v6no2518352qto.0!news-out.google.com!p41-v6ni625qtp.1!nntp.google.com!x25-v6no2518348qto.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: Complaints-To: groups-abuse@google.com Original-Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=90.227.126.54; posting-account=k77ESQoAAABOHZ-xdSiC_Gs4kD0z8QFO Original-NNTP-Posting-Host: 90.227.126.54 Original-Xref: usenet.stanford.edu gnu.emacs.help:222619 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:116738 Archived-At: Hi! You could add your own custom property to `char-property-alias-alist'. This will work regardless if font-lock is active or not. This is how font-lock implements `font-lock-face', so you might find that it has the same drawbacks as `font-lock-face'. One drawback that I can see is that some packages that convert buffers with syntax highlighting to other formats might not take this into account. -- Anders On Sunday, 25 March 2018 19:00:59 UTC+2, Marcin Borkowski wrote: > On 2018-03-22, at 01:39, Drew Adams wrote: > > >> > That's a possibility, but it will only work in modes/buffers that turn > >> > on font-lock. AFAIU, that was not OP's intent. > >> > >> I wasn't sure about the actual use case. > >> > >> If it should work for both font-lock on and off, would it make sense to > >> add both a face and a font-lock-face property to the string to be > >> inserted? > > > > I haven't followed this, so the use case is not clear to me. > > > > But if the OP wants highlighting that will be present whether > > font-locking is on or off then font-lock is not the answer (!), > > including its use of `font-lock-face'. > > font-lock-face won't work, but for different reasons. As I mentioned in > my previous message, I'll report back (in fact, I'll blog about it some > day) when the issue is solved. Most probably, I will have to use > overlays. > > > If you want highlighting that is independent of font-lock then > > you might give library `highlight.el' a try. It lets you > > highlight using text properties or overlay properties, and the > > highlighting can be independent of font-lock (or not - au choix). > > That is interesting - I even have that library because of > `hlt-highlight-region' - but in this case I don't want any > dependencies. But thanks anyway! > > > If you want to be able to tell font-lock "hands off", i.e., to > > ignore particular text, you can alternatively use text property > > `font-lock-ignore'. For that, see library `font-lock+.el'. > > Interesting, but again - external library.