From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Turning on savehist-mode by default Date: Tue, 28 Nov 2023 16:38:26 +0200 Message-ID: <83a5qy7xjx.fsf@gnu.org> References: <87wmufm7r7.fsf@catern.com> <87edga86m9.fsf@thanosapollo.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37821"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Thanos Apollo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 28 15:39: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 1r7zFL-0009WY-H4 for ged-emacs-devel@m.gmane-mx.org; Tue, 28 Nov 2023 15:39:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7zEb-0006DG-S9; Tue, 28 Nov 2023 09:38:46 -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 1r7zEY-0006D6-Gu for emacs-devel@gnu.org; Tue, 28 Nov 2023 09:38:42 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r7zEU-00052F-M9; Tue, 28 Nov 2023 09:38:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=iiu8GWQYLIrzDHopie7nMdR+b15VRGMwZRcZbsoGSzQ=; b=nCnRPmfVDuNfKivmDi5x bVjDO+/oMG58e4tztEZ9vS/1jXgMBomO8+hZKRG/2F1xTkhMN+2bG56NbfF/gEKsz8UHlk2gcSS8u cDT1euYIqhZNkKACo/6+SKOT9rt6QcnyV8CQ2DKuKo2+Wf1+d1b1Tbx+ABNc9wGX7kV/b8nrWaL8h T1PN9j0pDZfmKBrum57w6skH1TQ5WgcMRFMNH29xxqCqemBcOryQbSsMwSM2eagYn0DJ45gIqJs+H /5h1UFdHi1xFq6SJirLnqYwhtvBc+mOo6Ob0mhG6TSY8yE3uLbgkmzTe7zUlE4lyWcXt490mmmV21 BHzAEGXBOMGlVg==; In-Reply-To: <87edga86m9.fsf@thanosapollo.org> (message from Thanos Apollo on Tue, 28 Nov 2023 13:04:41 +0200) 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:313321 Archived-At: > From: Thanos Apollo > Date: Tue, 28 Nov 2023 13:04:41 +0200 > > > 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. > > > > What is the recommended way for package authors to disable > savehist-mode? > > If savehist-mode is enabled by default, it is advisable to also consider > a simple way to disable it for a specific package mode. > > for example I'm using emacs to answer a MCQ, such as: > > Q:Which one of the following statements concerning the > ability of acidosis to precipitate a crisis in sickle cell > anemia is correct? > > ```emacs-lisp > (completing-read "Answer: " > '("Fetal blood has a higher affinity for oxygen than does > adult blood because Hb F has a decreased affinity for > 2,3-BPG." > "Purified Hb F (stripped of 2,3-BPG) has a higher affin- > ity for oxygen than does purified Hb A." > "The globin chain composition of Hb F is α2δ2.")) > ``` > Saving the latest and usually correct answer defeats the purpose of an MCQ. > > One workaround for this is to set minibuffer-history to nil, although it > is unclear whether this is advised, even with a let statement. You could instead bind history-add-new-input to nil around calls to completing-read.