From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: set-text-properties and jit-lock-mode Date: Sun, 21 Feb 2016 19:04:38 +0000 Message-ID: <20160221190438.GB2220@acm.fritz.box> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1456081351 9964 80.91.229.3 (21 Feb 2016 19:02:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Feb 2016 19:02:31 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Schmitt Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 21 20:02:22 2016 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 1aXZGv-0002Nq-LG for ged-emacs-devel@m.gmane.org; Sun, 21 Feb 2016 20:02:21 +0100 Original-Received: from localhost ([::1]:43394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXZGv-00055G-3W for ged-emacs-devel@m.gmane.org; Sun, 21 Feb 2016 14:02:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXZGr-00054y-O5 for emacs-devel@gnu.org; Sun, 21 Feb 2016 14:02:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXZGo-0007c8-JI for emacs-devel@gnu.org; Sun, 21 Feb 2016 14:02:17 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:34733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXZGo-0007Xt-AF for emacs-devel@gnu.org; Sun, 21 Feb 2016 14:02:14 -0500 Original-Received: (qmail 92906 invoked by uid 3782); 21 Feb 2016 19:02:12 -0000 Original-Received: from acm.muc.de (p579E8505.dip0.t-ipconnect.de [87.158.133.5]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 21 Feb 2016 20:02:11 +0100 Original-Received: (qmail 7632 invoked by uid 1000); 21 Feb 2016 19:04:38 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 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:200397 Archived-At: Hello, Alan. On Sun, Feb 21, 2016 at 07:02:31PM +0100, Alan Schmitt wrote: > Hello, > I'm tracking down a bug in ledger-mode and I'm now at the point where I > think I need some help about some emacs core code. > The problem: if jit-lock-mode it t, then using set-text-properties to > change the face does not work. > To reproduce: start emacs with -Q. In the scratch buffer, type "foo". > Then evaluate: > (set-text-properties 192 195 (list 'face 'italic)) > Nothing changes, and when I do a `describe-char' on one letter of "foo" > I don't see the face. At a guess, what's happening here is this: your `set-text-properties' does indeed work. But setting text properties is a buffer change. So `before-change-functions' and `after-change-functions' will both be executed. `a-c-f' contains `jit-lock-after-change', which helpfully refontifies the line for you. All this happens before the screen is redisplayed. If you bind these hooks to nil around your call, I think it will work: (let (before-change-functions after-change-functions) (set-text-properties 192 195 (list 'face 'italic))) > If I then evaluate > (setq jit-lock-mode nil) > (set-text-properties 192 195 (list 'face 'italic)) > then I see the face change to italic, confirmed by `describe-char'. > As `set-text-properties' is a function in C, I don't know how to look at > its source (any pointers on how to do this would be great). Is it > supposed not to work for faces when jit-lock is on? > Thanks, > Alan -- Alan Mackenzie (Nuremberg, Germany).