From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Re: Operating the HIST feature of completing-read Date: Tue, 12 Jul 2022 11:52:07 +0300 Message-ID: References: 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="14179"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/+ () (2022-06-11) Cc: Help Gnu Emacs To: carlmarcos@tutanota.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 12 11:02:57 2022 Return-path: Envelope-to: geh-help-gnu-emacs@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 1oBBnF-0003Pl-9r for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 12 Jul 2022 11:02:57 +0200 Original-Received: from localhost ([::1]:38190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBBnE-0001TE-2b for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 12 Jul 2022 05:02:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBBmK-0001Sj-3h for help-gnu-emacs@gnu.org; Tue, 12 Jul 2022 05:02:00 -0400 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:53881) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBBmI-0002R7-1C for help-gnu-emacs@gnu.org; Tue, 12 Jul 2022 05:01:59 -0400 Original-Received: from localhost ([::ffff:154.226.102.225]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 00000000000A3C53.0000000062CD3883.00002EF6; Tue, 12 Jul 2022 02:01:54 -0700 Mail-Followup-To: carlmarcos@tutanota.com, Help Gnu Emacs Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-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: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:138426 Archived-At: * carlmarcos--- via Users list for the GNU Emacs text editor [2022-07-12 03:14]: > Jul 11, 2022, 22:43 by bugs@gnu.support: > > > * carlmarcos--- via Users list for the GNU Emacs text editor [2022-07-11 03:23]: > > > >> How does HIST work when using completing-read?  Any examples that > >> would help me with this? > >> > > > > I find HIST variables a waste in coding, so I am automating it by > > automatically assigning HIST variable to every call to the function. > > > I found your elaboration difficult to follow.  I just need a summary > on what it is, how to use it, and how it works.  Without wrappers > and clever stuff. Here is practically how history works: 1) First you define history variable: (defvar my-history nil "This is to remember my previous inputs.") ⇒ my-history 2) You use the history variable: (completing-read "Input: " '("One" "Two" "Three") nil nil nil 'my-history) ⇒ "One" 3) Now you may inspect history variable: my-history ⇒ ("One") 4) Now you may inspect the file (find-file "~/.emacs.d/history") as that is the file where history variable will be recorded so that history works over Emacs sessions 5) You may browse through history by using M-n and M-p as to easy selection of your previously recorded choices (history). -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/