From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] emacs-26 ee512e9: Ignore buffers whose name begins with a space in save-some-buffers Date: Tue, 19 Sep 2017 13:25:03 +0000 Message-ID: References: <20170918202953.21378.63492@vcs0.savannah.gnu.org> <20170918202955.5043420AC4@vcs0.savannah.gnu.org> <87ingfcrf6.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114fa8a6206d2705598acae5" X-Trace: blaine.gmane.org 1505828660 19137 195.159.176.226 (19 Sep 2017 13:44:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 19 Sep 2017 13:44:20 +0000 (UTC) To: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 19 15:44:14 2017 Return-path: Envelope-to: ged-emacs-devel@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 1duIou-0004bw-43 for ged-emacs-devel@m.gmane.org; Tue, 19 Sep 2017 15:44:12 +0200 Original-Received: from localhost ([::1]:42986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duIp1-00068x-GY for ged-emacs-devel@m.gmane.org; Tue, 19 Sep 2017 09:44:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duIWh-0008VH-4w for emacs-devel@gnu.org; Tue, 19 Sep 2017 09:25:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duIWc-0002l4-Ub for emacs-devel@gnu.org; Tue, 19 Sep 2017 09:25:23 -0400 Original-Received: from mail-yw0-x232.google.com ([2607:f8b0:4002:c05::232]:56784) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1duIWc-0002kl-QX for emacs-devel@gnu.org; Tue, 19 Sep 2017 09:25:18 -0400 Original-Received: by mail-yw0-x232.google.com with SMTP id w22so2452758ywa.13 for ; Tue, 19 Sep 2017 06:25:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=bSstDE839FGUHwKqb2uj6OuDnLei0e+ZTbq30G/IJ9o=; b=Un/ymyJma6TiiGTr3StsE0UeXN+bWsDuvuhv96yj6AexrMLXKPbkjHrdwj7xGLJpF4 8/TLqVq2AVvj35gTjsXr3hu2SldBwdravZeIAzjW1jOpghu7Wk0gYADhwq7yJL0+mos3 9irk3E5OQ1vRsVCUn2i+0SnflFShW/S4OQJlHLho+wQQ1n4S71zBXHnP71rkblxdbCmz QTGaCNov6E+26xMNkU9Ja3aG+ZXRA+TXWE1AgxP5oggBTI+StutXo+DhwegBgE/qX3xG 7H/Dj7yjilAX9Z7bZ5SeyC2414PPzdVEbYAcpREK4TSIHPxqUuz4BdAFBdHp062FM6OB HHhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=bSstDE839FGUHwKqb2uj6OuDnLei0e+ZTbq30G/IJ9o=; b=R+UBjbFWZ9w9o9dQvHocPByh7FIgjkAXpMeYLS3xoUzWcI3qBEBa6MG5Ao3fX69GPl eoqCo94VBZqbzI7MlYVWL+fmeM7Z34Za6aDJPLUPA4f3tXYH+mP3RepbfbkwefEPn3GF yP1wWLQ8yv/ZOu+JtEtHnM5bRascbg3OheK5mgujX2T+0b99723aIqdhUSEl2UMXbVaR 46mIpiM/riy1umTQbDZ9EL4vmWf03ayRjTCSjC1t/LRmqGfptCH82u+Roa53CKiuJHnv 9Dp09dOzT55dNLnP4V811my0oQ1lyW1XfuKoMe9qbI2HnD1ggmBoWuJztfDMJixVHlbI CWXg== X-Gm-Message-State: AHPjjUiWgKKKCS49zngrkSqHPmf1118uLOgAPWvrh8jpH9PBa3HHHGmd 5XQkU+nDbHjKspdpHPtWCDnmwJVgQ0krwIgcvKQ= X-Google-Smtp-Source: AOwi7QCeD1HUtGCXtSqLvViVjc1QqGJLwcliwLMGQGpBZGsha2iU0Ss1Lksuc7eJLAlQU0lmd7R28oRgngRwM379YDE= X-Received: by 10.13.212.3 with SMTP id w3mr916583ywd.200.1505827515022; Tue, 19 Sep 2017 06:25:15 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4002:c05::232 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:218516 Archived-At: --001a114fa8a6206d2705598acae5 Content-Type: text/plain; charset="UTF-8" On Tue, Sep 19, 2017 at 9:00 AM Stefan Monnier wrote: > > This was fallout from 9b980e269, aka bug #28412, where now we prompt for > > buffers that have functions in the `write-contents-functions' hook. > > Ah, I see I was looking at the wrong version of the code, sorry. > So the question becomes: why does " *Code-Fontify*" have a non-nil > write-contents-functions? > It's because ggtags.el enables the major mode from the actual file in this temp " *Code-Fontify*" buffer by calling (funcall mode) in ggtags-fontify-code. And in my case, the verilog-mode is setting the write-contents-hooks (old name of write-contents-functions)[1]. Looking at ggtags.el, I also wonder why the buffer survives the call to > ggtags-fontify-code. I would have expected ggtags-fontify-code to look > more like: > > (cl-defun ggtags-fontify-code (code &optional (mode major-mode)) > (cl-check-type mode function) > (cl-typecase code ;; FIXME: Using `stringp` is more efficient. > ((not string) code) > (string > (with-temp-buffer > (insert code) > ;; FIXME: `delay-mode-hooks' needs a comment > (delay-mode-hooks (funcall mode)) > (font-lock-ensure) > (buffer-string))))) > I will start this discussion on the ggtags.el repo. Thanks. [1]: https://github.com/veripool/verilog-mode/blob/ecdaea3386bee9d38520914e458d4860da644773/verilog-mode.el#L3969 -- Kaushal Modi --001a114fa8a6206d2705598acae5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Sep 19= , 2017 at 9:00 AM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> This was fallout from 9b980e269, aka bug #28412, where now = we prompt for
> buffers that have functions in the `write-contents-functions' hook= .

Ah, I see I was looking at the wrong version of the code, sorry.
So the question becomes: why does " *Code-Fontify*" have a non-ni= l
write-contents-functions?

It's beca= use ggtags.el enables the major mode from the actual file in this temp &quo= t; *Code-Fontify*" buffer by calling (funcall mode) in ggtags-fontify-= code.

And in my case, the verilog-mode is setting = the=C2=A0write-contents-hooks (old name of write-contents-functions)[1].


Looking at = ggtags.el, I also wonder why the buffer survives the call to
ggtags-fontify-code.=C2=A0 I would have expected ggtags-fontify-code to loo= k
more like:

(cl-defun ggtags-fontify-code (code &optional (mode major-mode))
=C2=A0 (cl-check-type mode function)
=C2=A0 (cl-typecase code=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; FIXME: Using `string= p` is more efficient.
=C2=A0 =C2=A0 ((not string) code)
=C2=A0 =C2=A0 (string
=C2=A0 =C2=A0 =C2=A0(with-temp-buffer
=C2=A0 =C2=A0 =C2=A0 =C2=A0(insert code)
=C2=A0 =C2=A0 =C2=A0 =C2=A0;; FIXME: `delay-mode-hooks' needs a comment=
=C2=A0 =C2=A0 =C2=A0 =C2=A0(delay-mode-hooks (funcall mode))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(font-lock-ensure)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(buffer-string)))))

I will start this discussion on the ggtags.el repo. Thanks.

-- =

Kaushal Modi

--001a114fa8a6206d2705598acae5--