From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Turning on savehist-mode by default Date: Sun, 19 Nov 2023 14:59:47 +0800 Message-ID: <87fs12jkik.fsf@yahoo.com> References: <87wmufm7r7.fsf@catern.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32630"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: sbaugh@catern.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 19 08:00:25 2023 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 1r4bn7-0008Li-D6 for ged-emacs-devel@m.gmane-mx.org; Sun, 19 Nov 2023 08:00:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4bmn-0006No-Lb; Sun, 19 Nov 2023 02:00:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r4bml-0006NT-7r for emacs-devel@gnu.org; Sun, 19 Nov 2023 02:00:03 -0500 Original-Received: from sonic304-20.consmr.mail.ne1.yahoo.com ([66.163.191.146]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r4bmi-0008Ks-Tc for emacs-devel@gnu.org; Sun, 19 Nov 2023 02:00:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1700377198; bh=3xgjYusd/gnxdS/2387ngS6B1ns7W2n7BF8Qq51hQMk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=l/sc7S7eZbpcvGcMEkjckf5Bj8dAqTgqAuE+XlYCUKkjyI4gq6+BNP3rqSqji0j2k/WagRVzRCit5+5JF7xEH25Kztd+TdpNYSzJ+Jv5hOKbvcntAs9e2Fu+d2Kg4LCA/dZreyNZResQWFJqBX8Hq1EkRQUXXlq1ZR3Q7bvOi1J3cHQO9hdQde6els1RTPJuXyT7dkD2Mj3hOKvZus2Y86LkvNC9ViqwOAN+yDzJFAsjAZbK3vUeAv28vTOGdqzvGv+S4KNqlaZRGQHYMglXepBOc6aoXdzSoLN342/Ra0daAcBVvIn5z6V4WiDJZgjJkZ51iAuXtq0wycZX9BLMAg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1700377198; bh=aGpVncM9YlWQe/hUooFT5zjKeLK0K/pIlSvI6l6XIy+=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=jVQBXJGg0ZeJWNSMOJdYle49EVVNlPdIGOXHJU9Uc+AbVlSSea6ZSS8LIh2eQrdCRgDTIdn40zLsPDxcR/dTqSJxYEJHi3oMk7k+7ac6PMrNiN+R3aKN+7qt45sSVLbY+EA+o97AKj9bT5nDH2KwC5B91JKy//3ntHGULoq538tuMq+7HlqTaPAXusgjufnscCfna+FGNYYDUYzebmZokBKwcoepIHhV9x+H5L12H1MvT1apl9s3GgzjPWUtF7/hpspcoNL7UCy8KR3ebvoIyTlAM1JHJA1gh4vz/OuCopJ45wLKA9/1D8VeYl64hyn90q3jGk6l0plMECD6vP/ERQ== X-YMail-OSG: QuzHcOMVM1kuG8c_MT88tttch3rB3MidVp_lEPWRVYus66F2fzZCu0L9TbjhY87 n1oogH3qc1hAFdhSreRLRjWr.ViqSP7JqiuHkN.Xy8XSVSQDlgIEN.KVEjGfAJ.mpN822j3lGwCU ibCNNQn3vSoo30TiXw94KP7aGaJN4AjaSgT_3a1xXCLbmVLfuaHlJDxciSbIM8iRD8KoHEeVy5NH eciLZMwcmycneYfwbgs.mkrqrpPKzU_zafLS6fK57qqakaqHkneZ6OOQ8CbZ1_wYwSLQ1G_iq.da YxoX53ePmT6Mtl56eYI0pgx_zW7_SA8a4rwer6ur.5LhBDic7B86uHnbzdDlOf3rZSnf1JNZvcYV fwRzHwKPhTWmvbvFXNL6HWyh7G6SexB5EHLqUOf6Vzgtd_1DhscYbQDfxigk2bOPj.epyYSgtQd8 _cedpDO5MU1zVz.bmBFyARd9_PMVNdsrdoCZRWWqgRZ5FvSPHT5sBgerXKgBIrtBpkFCk5Ym7Plh M7.Yk.3JAocGFSnlDimMZv.TEPXhwJ.esL1AIy.iYzBgC8NPgZWjfviv19yDnK7XeXbu_6H0Ud8d 6syOHQmZJ4GZ_6VkWZU_WuJyHB.nwOBlGYjsGPoh1Wr13qxEYxuLFaEOEmWKKkcRlJ9XAU5z3E01 oXz0euSpwlaB17.vtPkA_gQsh6W3mhkx8lYddCOzoSAsl8nhm90qeLhlI_wnSnnOOwgArdN1obDa hOpQn4t1bY7K1Oes75hdBWkYcgewxxeMyh_Yqk8cMmkCeL7qkq3cIJgoV5PWS.Z.LyOZuagMpMj6 7hodoQmEcM7Q.oFdqTlM_bEb0WmIQf10OY6AdNJUBx X-Sonic-MF: X-Sonic-ID: 2f4e0744-7c88-4714-8604-21c027e5366a Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.ne1.yahoo.com with HTTP; Sun, 19 Nov 2023 06:59:58 +0000 Original-Received: by hermes--production-sg3-8696d769c6-z26jv (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID e42a384ad3d832f490bf4d0bc7319a35; Sun, 19 Nov 2023 06:59:53 +0000 (UTC) In-Reply-To: <87wmufm7r7.fsf@catern.com> (sbaugh@catern.com's message of "Sat, 18 Nov 2023 14:54:52 +0000") X-Mailer: WebService/1.1.21896 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.191.146; envelope-from=luangruo@yahoo.com; helo=sonic304-20.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:312949 Archived-At: sbaugh@catern.com writes: > savehist-mode is a useful mode which is turned on by many Emacs > users. [1] It matches the default behavior of programs like bash and > vim, which save command history by default. I suggest that we should > find some way to enable savehist by default. > > By default savehist creates a timer which saves the history every 5 > minutes. I suggest that by default we should just have behavior like: > (add-hook 'kill-emacs-hook #'savehist-autosave) > If the user explicitly runs (savehist-mode 1) then that would enable the > timer-based saving. > > I'm not sure what other issues have prevented savehist from being turned > on by default, but I'm happy to do the work to get it into good shape. > > This proposal is somewhat motivated by bug#66993, because project.el > already has some custom code which runs by default which is kind of like > savehist-mode, but which only save project--list. It may be possible to > get rid of that code in favor of the generic savehist logic, but to do > that we'd need to turn savehist on by default in some form. There is a grave disadvantage to introducing kill-emacs-hooks or saving files periodically from a timer. In the case of the former, Emacs will behave inconsistently, subject to whether it's been killed such that the hook cannot run. And the latter runs the risk of files being corrupted if the file is being saved, by chance, the instant Emacs is killed. You might object that people are always meant to shut Emacs down in a way that prompts it to execute these hooks, but I've always considered it a virtue of Emacs's that it can be so terminated without consequence. Departing from this in our default configuration would be a step backwards, inasmuch as we constantly hear of users suffering from long startup times, implying that Emacs is frequently started for momentary editing sessions. And in such scenarios users are apt to kill Emacs by whatever means are then at hand: xkill, pkill, and the like, this being behavior that I have myself engaged in on occasion. As regards enabling savehist-mode by default, I have no strong objections. Provided that you can pull it off without either timers or entries in kill-emacs-hook.