From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Daniele Nicolodi Newsgroups: gmane.emacs.devel Subject: Re: Different fontification in temp buffer Date: Sat, 19 Jan 2019 19:14:03 -0700 Message-ID: <240a311e-ec17-8c91-74c1-d30fd4da2809@grinta.net> References: <36cc3b65-2459-bf32-37f1-2bd538fafe07@grinta.net> NNTP-Posting-Host: ciao.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: ciao.gmane.org 1547950478 249922 195.159.176.228 (20 Jan 2019 02:14:38 GMT) X-Complaints-To: usenet@ciao.gmane.org NNTP-Posting-Date: Sun, 20 Jan 2019 02:14:38 +0000 (UTC) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 20 03:14:36 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1gl2dA-00130L-8N for ged-emacs-devel@m.gmane.org; Sun, 20 Jan 2019 03:14:36 +0100 Original-Received: from localhost ([127.0.0.1]:34162 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gl2dJ-00089D-9x for ged-emacs-devel@m.gmane.org; Sat, 19 Jan 2019 21:14:45 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gl2ci-00088w-Tx for emacs-devel@gnu.org; Sat, 19 Jan 2019 21:14:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gl2ci-0001UR-4k for emacs-devel@gnu.org; Sat, 19 Jan 2019 21:14:08 -0500 Original-Received: from zed.grinta.net ([109.74.203.128]:48354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gl2ch-0001RA-L7 for emacs-devel@gnu.org; Sat, 19 Jan 2019 21:14:08 -0500 Original-Received: from black.hsd1.co.comcast.net (c-98-245-163-4.hsd1.co.comcast.net [98.245.163.4]) (Authenticated sender: daniele) by zed.grinta.net (Postfix) with ESMTPSA id 59435E3C33 for ; Sun, 20 Jan 2019 02:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=grinta.net; s=mail; t=1547950446; bh=EGU4LZFXmod4y06HOf15SXB7ujNit1B1GlXhCHXHF6g=; h=Subject:To:References:From:Date:In-Reply-To:From; b=uGpOj0+WCdHfp0lXOEhuN0skaquDa6AhOEE1CtokkP/HYZvRPhlqcpTHHncqBbITo RCV7bsusFFLI1GmldR6oCLrVk6VOxfCwmX9TMnhtc+408rIbRUi7NlYwQsQQxFct2q KM+ccoyFfdK7UifLp4XM5seVC3Xyi8KCKnmnis9k= Openpgp: preference=signencrypt In-Reply-To: <36cc3b65-2459-bf32-37f1-2bd538fafe07@grinta.net> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 109.74.203.128 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:232522 Archived-At: On 19/01/2019 17:48, Daniele Nicolodi wrote: > Hello, > > I'm hacking on a minor mode and I'm writing unit tests for the > fontification feature. I am encountering a strange issue: the > fontification is different if execute in a temp buffer or in a regular > buffer. In particular: > > (with-temp-buffer > (insert string) > (fundamental-mode) > (beancount-mode) > (font-lock-ensure) > (buffer-string)) > > and > > (with-current-buffer (generate-new-buffer "*test*") > (insert string) > (fundamental-mode) > (beancount-mode) > (font-lock-ensure) > (buffer-string)) > > strangely result in two different results. Why is it so? Investigating further, the difference between the two cases is that with-temp-buffer creates a buffer that does not keep undo information. Surely enough, if I modify the second code to do the same (using a buffer name starting with a space character) I obtain the same behavior. What's left to understand is why this results in two different syntax table being applied to the buffer. Cheers, Dan