help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Operating the HIST feature of completing-read


From: Jean Louis
Subject: Re: Operating the HIST feature of completing-read
Date: Tue, 12 Jul 2022 11:52:07 +0300
User-agent: Mutt/+ () (2022-06-11)

* carlmarcos--- via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> [2022-07-12 03:14]:
> Jul 11, 2022, 22:43 by bugs@gnu.support:
> 
> > * carlmarcos--- via Users list for the GNU Emacs text editor 
> > <help-gnu-emacs@gnu.org> [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/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]