From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: master e8488bcc9c: Avoid having font locking triggering unnecessary auto-saving Date: Tue, 10 May 2022 03:51:53 +0200 Message-ID: <87k0aunohy.fsf@gnus.org> References: <165191796540.22789.3432288633082546349@vcs2.savannah.gnu.org> <20220507100605.B7CA7C051FF@vcs2.savannah.gnu.org> <87fsli7uhf.fsf@gnus.org> <87bkw67rru.fsf@gnus.org> <8735hi7r7k.fsf@gnus.org> <87ilqe4roc.fsf@gnus.org> <83levau0r4.fsf@gnu.org> <87v8ue3b9g.fsf@gnus.org> <87mtfq38r3.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10400"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 10 03:52:51 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1noF3S-0002S0-KO for ged-emacs-devel@m.gmane-mx.org; Tue, 10 May 2022 03:52:50 +0200 Original-Received: from localhost ([::1]:48370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1noF3R-0004YU-JF for ged-emacs-devel@m.gmane-mx.org; Mon, 09 May 2022 21:52:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1noF2h-0003r7-Gq for emacs-devel@gnu.org; Mon, 09 May 2022 21:52:03 -0400 Original-Received: from quimby.gnus.org ([2a01:4f9:2b:f0f::2]:38196) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1noF2f-0002hI-VR; Mon, 09 May 2022 21:52:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=XZzIqMm/ZtPhtGYEogSZze3NCQcSlFK1/CTQhcPgdBY=; b=iYELGb5u3+kZHUOXJJtU5VbxzN vKH4hf6XTTqb4lkbLsMXYYesa6F3yyYqgwI+oer43PDvgKXZA8e6BGfB3E4ICIva5VCUhErddjkjF R/YJLJIS203PvIioPg2wQBd7Yy4sM8zmR/dF8jG7Vh73bAzRgJhHms0vgeIT7FJvrbpI=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1noF2Z-0004dn-7b; Tue, 10 May 2022 03:51:57 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEXWq2TeuoyiYkxB LyT////lU39VAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+YFCgEuLJOJMtMAAAGNSURBVDjLbZMBssMg CESRXEDzL2DgAvlw/7t1URNNG6bTZnzCsoQSRaRSSlZH1BJBI3CeyhbnblRyyWmCsnuPmnLKtKRs AyBllqJE2a+oZSaA7Dc4lwSiuxLiAq2/ohOktdtbAheOod4SGjB1E2kgdw/hwlRwKKL+nxeJv7hb dzDR8wnkCj2XptLmoijkavjcgDIFcOc+FI5EIBbCqUD+UMOTcaUOQJq/UG9jRAQgrlHHdBcAMRQQ 6ULRvUnNwofU3puT1AGYuJ+Fe3caF9wqziHL0hpcABoRTplhaAJtoEAj6jU3dM0b4qRywJI+AVzg coLEDyDBOuUXwCnejxgG+dTg8EEab6x3pZcGRmiMZivjJYdzGQAJlWEPJ5sRvtGOD+sS2sb4wmxj O9puUmrL0o3QcbeFSac2fn12FYTbdn23extqpS+gIjNX3jP6851hPhdeV3A13W/pMsTxfwocLifQ AeB7BTZ+D+0D+imVMeKkv8D2mIy8ZABwjlX+BgR3+xtoC/ZWCvM9a4h/AOuenqUSokA1AAAAJXRF WHRkYXRlOmNyZWF0ZQAyMDIyLTA1LTEwVDAxOjQ2OjQ0KzAwOjAwi7QZIgAAACV0RVh0ZGF0ZTpt b2RpZnkAMjAyMi0wNS0xMFQwMTo0Njo0NCswMDowMPrpoZ4AAAAASUVORK5CYII= X-Now-Playing: Joni Mitchell's _Clouds_: "I Think I Understand" In-Reply-To: (Stefan Monnier's message of "Mon, 09 May 2022 14:29:05 -0400") Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:289563 Archived-At: Stefan Monnier writes: >> + (when (or (not ,modified) >> + (eq ,modified 'autosaved)) >> + (restore-buffer-modified-p ,modified)))))) > > [ I'd use `(unless (eq ,modified t)` ] The return value is now defined as nil/`autosaved'/non-nil, so assuming t is no longer the thing. > But... hmm... what if `body` caused the modified-p status to change from > `autosaved` to `nil`. With the old code, we'd leave `nil` untouched, > but with the new code we'd re-set it to `autosaved`. > > Admittedly, it's quite unlikely for `body` to save the buffer (and hence > cause the modified-p status to change from `autosaved` to `nil`), so I'm > not sure how important this is. I think that's probably outside the scope for this macro. >> + if (EQ (flag, Qautosaved)) >> + BUF_AUTOSAVE_MODIFF (b) = MODIFF; >> + /* If SAVE_MODIFF == auto_save_modified == MODIFF, we can either >> + decrease SAVE_MODIFF and auto_save_modified or increase >> + MODIFF. */ >> + else if (SAVE_MODIFF >= MODIFF) >> + SAVE_MODIFF = modiff_incr (&MODIFF); >> + } > > I think this will not do the right thing if you call > `(restore-buffer-modified-p 'autosaved)` when modified-p is `nil`. Yeah, the semantics are slightly obscure now, but you're not supposed to call the function with `autosaved' when it hasn't been modified. Perhaps it should just signal an error in that case? It might also make sense to just add a new function that only does auto-save modiff stuff, because things are somewhat un-orthogonal now. restore-buffer-modified-p can set modification status to nil/t, but can't set autosave status to t, only to nil. But anyway, I've now pushed the changes. (And will be removing internal--set-buffer-modified-tick a bit later, but I'm gonna wait a bit, because removing it will require everybody to say "make boostrap".) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no