From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: sbaugh@catern.com Newsgroups: gmane.emacs.devel Subject: Turning on savehist-mode by default Date: Sat, 18 Nov 2023 14:54:52 +0000 Message-ID: <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="19439"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Cancel-Lock: sha1:PehTfT1jyOAgWJrqmBzGWrOekyo= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 18 17:22:35 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 1r4O5a-0004q1-Hv for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Nov 2023 17:22:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4O57-0005nN-Bc; Sat, 18 Nov 2023 11:22: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 1r4Mj1-0005Fz-1G for emacs-devel@gnu.org; Sat, 18 Nov 2023 09:55:11 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r4Miz-0004Iv-2K for emacs-devel@gnu.org; Sat, 18 Nov 2023 09:55:10 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1r4Miw-0000Jd-95 for emacs-devel@gnu.org; Sat, 18 Nov 2023 15:55:06 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 18 Nov 2023 11:22:01 -0500 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:312916 Archived-At: 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. [1]: At least, savehist is turned on by every Emacs configuration framework I've checked, in a brief search of the most popular ones: https://git.sr.ht/~technomancy/better-defaults/tree/main/item/better-defaults.el https://github.com/doomemacs/doomemacs/blob/986398504d09e585c7d1a8d73a6394024fe6f164/lisp/doom-editor.el#L356 https://github.com/syl20bnr/spacemacs/blob/a6a834f08af61b5a4dd80e337449f0f7026f6a0c/layers/%2Bspacemacs/spacemacs-defaults/packages.el#L401 https://github.com/bbatsov/prelude/blob/b57ff48e0985a6ef0f1ed9b279ec487c55982334/core/prelude-editor.el#L108 https://github.com/pprevos/emacs-writing-studio/blob/master/init.el#L247 https://systemcrafters.net/emacs-from-scratch/the-best-default-settings/