From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: carlmarcos--- via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: RE: [External] : Re: Operating the HIST feature of completing-read Date: Tue, 12 Jul 2022 18:20:53 +0200 (CEST) Message-ID: References: Reply-To: carlmarcos@tutanota.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4695"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Jean Louis , Help Gnu Emacs To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 12 18:21:54 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 1oBIe1-0000zY-RU for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 12 Jul 2022 18:21:53 +0200 Original-Received: from localhost ([::1]:33298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oBIe0-0003LW-9k for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 12 Jul 2022 12:21:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBId8-0003Kh-Ap for help-gnu-emacs@gnu.org; Tue, 12 Jul 2022 12:20:58 -0400 Original-Received: from w1.tutanota.de ([81.3.6.162]:33622) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBId5-0005mS-7B for help-gnu-emacs@gnu.org; Tue, 12 Jul 2022 12:20:58 -0400 Original-Received: from w3.tutanota.de (unknown [192.168.1.164]) by w1.tutanota.de (Postfix) with ESMTP id 96DDFFBF884; Tue, 12 Jul 2022 16:20:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1657642853; s=s1; d=tutanota.com; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=CWyecDinPu/cP+emHGdARO+3rPbDWC0DT0dGM24b6ow=; b=RSV9e6gi1NETLZCC/IhFdWz6mlZwtqIW5bs3VBfcjlbh1m3bSJOWyQpb23vtcmX/ NmNEAz1rlqCqO97YTQ+a7QL/k14Z9cPxAg8prrpT2CChPdWfreQquRWzw+1TIdo9Brr lNZs+wdvJ7UDyG4YhsFfQjMP7XnUr7k7+bXf3FITrX/jxxheSaxwWk4BbpOy5WUmJuI TsxCyjsh6ACyA72N1S7ZD5hpk4Y+lAa1Pz1tEPx0uHFczSdHHHPSNewMqMjc9mm9vsz 9zZmUgBWjFMf1kD/UQPy2zDEeG2W91Oh+MF0GVPElTZ7ErLBeFt6dZBtIRmjVp97hwt wFo80NJLoQ== In-Reply-To: Received-SPF: pass client-ip=81.3.6.162; envelope-from=carlmarcos@tutanota.com; helo=w1.tutanota.de 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, HTML_MESSAGE=0.001, 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-Content-Filtered-By: Mailman/MimeDel 2.1.29 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:138436 Archived-At: Jul 12, 2022, 14:28 by drew.adams@oracle.com: >> Here is practically how history works: >> >> 1) First you define history variable: >> (defvar my-history nil "...previous inputs.") =E2=87=92 my-history >> >> 2) You use the history variable: >> (completing-read "X: " '("a" "b") nil nil nil 'my-history) =E2=87=92 "a" >> Does the history remember the the user input associated with each specific = completing-read call? >> 3) Now you may inspect history variable: >> my-history =E2=87=92 ("a") >> >> 4) Now you may inspect the file (find-file "~/.emacs.d/history") >> 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). >> > > Good summary. Some more: > > 1. If you don't pass a value as the HIST arg to > minibuffer-reading functions such as `completing-read' > then the implied, general history variable is used: > `minibuffer-history'. > > IOW, your minibuffer-input history is always > recorded in a history variable, whether or not you > pass a HIST variable. > > If you want to keep a separate history list for some > interactions then pass a separate history variable. > If you don't care about keeping a separate list for > some inputs then don't pass an explicit HIST. > > 2. How do you make use of the history list currently > available during a read from the minibuffer? As > Jean mentioned, use `M-p' and `M-n' to cycle among > historical inputs. Or use `M-r' and `M-s' to access > them directly by matching regexps. > > 3. Ask Emacs! > > `C-h r', `i histor TAB', choose a candidate such as > `history of minibuffer input'. That takes you to > node `Minibuffer History' in the Emacs manual: > > https://www.gnu.org/software/emacs/manual/html_node/emacs/Minibuffer-Hist= ory.html > > `C-h i m el', `i histor TAB', choose a candidate > such as `history list'. That takes you to node > `Minibuffer History' in the Elisp manual: > > https://www.gnu.org/software/emacs/manual/html_node/elisp/Minibuffer-Hist= ory.html > > Emacs answers your questions. And by asking Emacs > you learn to converse with Emacs, i.e., to ask it > better, posing your questions using terms that > Emacs understands best. (And those terms are also > those best understood by the Emacs community, if > you do ask outside Emacs itself.) > > Do yourself a favor and learn to communicate with > Emacs more fluently. There are many levels/layers > to explore & learn, and each opens doors to others. > > Learning how to talk with Emacs is more productive > than posing lots of one-off questions here and > there. And if you do pose questions about Emacs > outside Emacs then the most helpful questions will > be about ways how to converse with Emacs (asking > about asking Emacs). >