all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Operating the HIST feature of completing-read
@ 2022-07-11  0:22 carlmarcos--- via Users list for the GNU Emacs text editor
  2022-07-11 22:43 ` Jean Louis
       [not found] ` <YsynnWwOd/93Lz5Q@protected.localdomain-N6jRHVs----2>
  0 siblings, 2 replies; 15+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-07-11  0:22 UTC (permalink / raw)
  To: Help Gnu Emacs

How does HIST work when using completing-read?  Any examples that would help me with this?



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Operating the HIST feature of completing-read
  2022-07-11  0:22 Operating the HIST feature of completing-read carlmarcos--- via Users list for the GNU Emacs text editor
@ 2022-07-11 22:43 ` Jean Louis
       [not found] ` <YsynnWwOd/93Lz5Q@protected.localdomain-N6jRHVs----2>
  1 sibling, 0 replies; 15+ messages in thread
From: Jean Louis @ 2022-07-11 22:43 UTC (permalink / raw)
  To: carlmarcos; +Cc: Help Gnu Emacs

* 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.

(defun rcd-symbol-if-not-exist (variable &optional value description)
  "Return symbol for VARIABLE. 

It will generate new VARIABLE if it does not exist."
  (let* ((variable (replace-regexp-in-string "[^[:alnum:]]" "-" (downcase variable)))
	 (rcd-symbol (intern variable))
	 (description (or description (format "Generated variable `%s'" variable))))
    (if (boundp rcd-symbol)
	rcd-symbol
      (eval (list 'defvar rcd-symbol value description)))))

(defun rcd-ask-history-variable (prompt)
  "Generate history variable for PROMPT."
  (let* ((description (format "History for `%s' prompt." prompt)))
    (rcd-symbol-if-not-exist (concat "rcd-" prompt "-history") nil description)))

Then there is my wrapper function for `completing-read`:

(defun rcd-choose (list &optional prompt predicate initial-input def)
  "Ask user for LIST of choices.
If only one element, function `y-or-n-p' will be used.
For multiple elements `completing-read' is used.

If nothing chosen it will return empty string."
  (let* ((completion-ignore-case t)
	 (prompt (or prompt "Choose: "))
	 (description (format "History for `%s' completion prompt." prompt))
	 (history (rcd-symbol-if-not-exist (concat "rcd-" prompt "-history") nil description))
	 (input (cond ((length= list 1) (if (y-or-n-p (nth 0 list)) (nth 0 list) ""))
		      (t (rcd-repeat-until-not-empty-string 'completing-read prompt list predicate t initial-input history def t)))))
    input))

That generates history variables automatically in the line, based on
the prompt:

(history (rcd-symbol-if-not-exist (concat "rcd-" prompt "-history") nil description))

Then this below would use history variable: rcd-choose---history

(rcd-choose '("One" "Two" "Three"))

because following evaluates to that symbol:

(rcd-symbol-if-not-exist (concat "rcd-" "Choose: " "-history") nil "History for `Choose: ' completion prompt.") ⇒ rcd-choose---history

However, any other prompt would yield automatically with a different
history variable based on its prompt like "Choose a number: "

(rcd-choose '("One" "Two" "Three") "Choose a number: ") ⇒ "One"


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Operating the HIST feature of completing-read
       [not found] ` <YsynnWwOd/93Lz5Q@protected.localdomain-N6jRHVs----2>
@ 2022-07-12  0:13   ` carlmarcos--- via Users list for the GNU Emacs text editor
  2022-07-12  8:52     ` Jean Louis
  0 siblings, 1 reply; 15+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-07-12  0:13 UTC (permalink / raw)
  To: Jean Louis; +Cc: Help Gnu Emacs

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.


> (defun rcd-symbol-if-not-exist (variable &optional value description)
>  "Return symbol for VARIABLE. 
>
> It will generate new VARIABLE if it does not exist."
>  (let* ((variable (replace-regexp-in-string "[^[:alnum:]]" "-" (downcase variable)))
>  (rcd-symbol (intern variable))
>  (description (or description (format "Generated variable `%s'" variable))))
>  (if (boundp rcd-symbol)
>  rcd-symbol
>  (eval (list 'defvar rcd-symbol value description)))))
>
> (defun rcd-ask-history-variable (prompt)
>  "Generate history variable for PROMPT."
>  (let* ((description (format "History for `%s' prompt." prompt)))
>  (rcd-symbol-if-not-exist (concat "rcd-" prompt "-history") nil description)))
>
> Then there is my wrapper function for `completing-read`:
>
> (defun rcd-choose (list &optional prompt predicate initial-input def)
>  "Ask user for LIST of choices.
> If only one element, function `y-or-n-p' will be used.
> For multiple elements `completing-read' is used.
>
> If nothing chosen it will return empty string."
>  (let* ((completion-ignore-case t)
>  (prompt (or prompt "Choose: "))
>  (description (format "History for `%s' completion prompt." prompt))
>  (history (rcd-symbol-if-not-exist (concat "rcd-" prompt "-history") nil description))
>  (input (cond ((length= list 1) (if (y-or-n-p (nth 0 list)) (nth 0 list) ""))
>  (t (rcd-repeat-until-not-empty-string 'completing-read prompt list predicate t initial-input history def t)))))
>  input))
>
> That generates history variables automatically in the line, based on
> the prompt:
>
> (history (rcd-symbol-if-not-exist (concat "rcd-" prompt "-history") nil description))
>
> Then this below would use history variable: rcd-choose---history
>
> (rcd-choose '("One" "Two" "Three"))
>
> because following evaluates to that symbol:
>
> (rcd-symbol-if-not-exist (concat "rcd-" "Choose: " "-history") nil "History for `Choose: ' completion prompt.") ⇒ rcd-choose---history
>
> However, any other prompt would yield automatically with a different
> history variable based on its prompt like "Choose a number: "
>
> (rcd-choose '("One" "Two" "Three") "Choose a number: ") ⇒ "One"
>
>
> -- 
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> In support of Richard M. Stallman
> https://stallmansupport.org/
>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Operating the HIST feature of completing-read
  2022-07-12  0:13   ` carlmarcos--- via Users list for the GNU Emacs text editor
@ 2022-07-12  8:52     ` Jean Louis
  2022-07-12 14:28       ` [External] : " Drew Adams
       [not found]       ` <SJ0PR10MB5488F286DDB15D2F9DC59981F3869@SJ0PR10MB5488.namprd10.prod.outlook.com-N6n2IGP--7-2>
  0 siblings, 2 replies; 15+ messages in thread
From: Jean Louis @ 2022-07-12  8:52 UTC (permalink / raw)
  To: carlmarcos; +Cc: Help Gnu Emacs

* 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/



^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [External] : Re: Operating the HIST feature of completing-read
  2022-07-12  8:52     ` Jean Louis
@ 2022-07-12 14:28       ` Drew Adams
  2022-07-12 16:20         ` carlmarcos--- via Users list for the GNU Emacs text editor
       [not found]       ` <SJ0PR10MB5488F286DDB15D2F9DC59981F3869@SJ0PR10MB5488.namprd10.prod.outlook.com-N6n2IGP--7-2>
  1 sibling, 1 reply; 15+ messages in thread
From: Drew Adams @ 2022-07-12 14:28 UTC (permalink / raw)
  To: Jean Louis, carlmarcos@tutanota.com; +Cc: Help Gnu Emacs

> Here is practically how history works:
> 
> 1) First you define history variable:
> (defvar my-history nil "...previous inputs.") ⇒ my-history
> 
> 2) You use the history variable:
> (completing-read "X: " '("a" "b") nil nil nil 'my-history) ⇒ "a"
> 
> 3) Now you may inspect history variable:
> my-history ⇒ ("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-History.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-History.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).

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [External] : Re: Operating the HIST feature of completing-read
  2022-07-12 14:28       ` [External] : " Drew Adams
@ 2022-07-12 16:20         ` carlmarcos--- via Users list for the GNU Emacs text editor
  2022-07-12 16:40           ` Drew Adams
       [not found]           ` <SJ0PR10MB5488AF0AFC27B5DDA0FD6937F3869@SJ0PR10MB5488.namprd10.prod.outlook.com-N6nHMGc--3-2>
  0 siblings, 2 replies; 15+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-07-12 16:20 UTC (permalink / raw)
  To: Drew Adams; +Cc: Jean Louis, Help Gnu Emacs


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.") ⇒ my-history
>>
>> 2) You use the history variable:
>> (completing-read "X: " '("a" "b") nil nil nil 'my-history) ⇒ "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 ⇒ ("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-History.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-History.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).
>



^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [External] : Re: Operating the HIST feature of completing-read
  2022-07-12 16:20         ` carlmarcos--- via Users list for the GNU Emacs text editor
@ 2022-07-12 16:40           ` Drew Adams
       [not found]           ` <SJ0PR10MB5488AF0AFC27B5DDA0FD6937F3869@SJ0PR10MB5488.namprd10.prod.outlook.com-N6nHMGc--3-2>
  1 sibling, 0 replies; 15+ messages in thread
From: Drew Adams @ 2022-07-12 16:40 UTC (permalink / raw)
  To: carlmarcos@tutanota.com; +Cc: Jean Louis, Help Gnu Emacs

> Does the history remember the user input associated
> with each specific completing-read call?

Only each specific history variable.

If each `completing-read' (or `read-from-minibuffer'
or whatever) call used a different history variable
then the answer to your question would be yes.
___

[Why not use plain-text email?  Why quote everything
and just add a one-liner question in the middle?]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [External] : Re: Operating the HIST feature of completing-read
       [not found]           ` <SJ0PR10MB5488AF0AFC27B5DDA0FD6937F3869@SJ0PR10MB5488.namprd10.prod.outlook.com-N6nHMGc--3-2>
@ 2022-07-12 17:00             ` carlmarcos--- via Users list for the GNU Emacs text editor
  2022-07-13  1:16             ` carlmarcos--- via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 15+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-07-12 17:00 UTC (permalink / raw)
  To: Drew Adams; +Cc: Jean Louis, Help Gnu Emacs


Jul 12, 2022, 16:40 by drew.adams@oracle.com:

>> Does the history remember the user input associated
>> with each specific completing-read call?
>>
>
> Only each specific history variable.
>
> If each `completing-read' (or `read-from-minibuffer'
> or whatever) call used a different history variable
> then the answer to your question would be yes.
> ___
>
> [Why not use plain-text email?  Why quote everything
> and just add a one-liner question in the middle?]
>
Will see if there are settings to do that. 



^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [External] : Re: Operating the HIST feature of completing-read
       [not found]       ` <SJ0PR10MB5488F286DDB15D2F9DC59981F3869@SJ0PR10MB5488.namprd10.prod.outlook.com-N6n2IGP--7-2>
@ 2022-07-13  0:41         ` carlmarcos--- via Users list for the GNU Emacs text editor
  2022-07-13 15:09           ` Drew Adams
  0 siblings, 1 reply; 15+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-07-13  0:41 UTC (permalink / raw)
  To: Drew Adams; +Cc: Jean Louis, Help Gnu Emacs


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.") ⇒ my-history
>>
The history is not described very well in the documentation of completing-read.




^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [External] : Re: Operating the HIST feature of completing-read
       [not found]           ` <SJ0PR10MB5488AF0AFC27B5DDA0FD6937F3869@SJ0PR10MB5488.namprd10.prod.outlook.com-N6nHMGc--3-2>
  2022-07-12 17:00             ` carlmarcos--- via Users list for the GNU Emacs text editor
@ 2022-07-13  1:16             ` carlmarcos--- via Users list for the GNU Emacs text editor
  2022-07-13  2:04               ` Jean Louis
                                 ` (3 more replies)
  1 sibling, 4 replies; 15+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-07-13  1:16 UTC (permalink / raw)
  To: Drew Adams; +Cc: Jean Louis, Help Gnu Emacs


Jul 12, 2022, 16:40 by drew.adams@oracle.com:

>> Does the history remember the user input associated
>> with each specific completing-read call?
>>
>
> Only each specific history variable.
>
> If each `completing-read' (or `read-from-minibuffer'
> or whatever) call used a different history variable
> then the answer to your question would be yes.
>

Have done as suggested 

(defvar myhist nil
  "Stores previous minibuffer inputs so the user can reuse them.")

  (let* ( (cseq '("bracemk" "expression" "extended" "mixed" "hlsexp" "disable"))
          (csel  (completing-read "Glowvis: " cseq nil t "mixed" myhist "extended"))

When I go through the list in the minibuffer I am also getting the variable myhist
showing up but its value stays nil.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [External] : Re: Operating the HIST feature of completing-read
  2022-07-13  1:16             ` carlmarcos--- via Users list for the GNU Emacs text editor
@ 2022-07-13  2:04               ` Jean Louis
  2022-07-13  6:52               ` Yuri Khan
                                 ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Jean Louis @ 2022-07-13  2:04 UTC (permalink / raw)
  To: carlmarcos; +Cc: Drew Adams, Help Gnu Emacs

* carlmarcos@tutanota.com <carlmarcos@tutanota.com> [2022-07-13 04:16]:
> 
> Jul 12, 2022, 16:40 by drew.adams@oracle.com:
> 
> >> Does the history remember the user input associated
> >> with each specific completing-read call?
> >>
> >
> > Only each specific history variable.
> >
> > If each `completing-read' (or `read-from-minibuffer'
> > or whatever) call used a different history variable
> > then the answer to your question would be yes.
> >
> 
> Have done as suggested 
> 
> (defvar myhist nil
>   "Stores previous minibuffer inputs so the user can reuse them.")
> 
>   (let* ( (cseq '("bracemk" "expression" "extended" "mixed" "hlsexp" "disable"))
>           (csel  (completing-read "Glowvis: " cseq nil t "mixed" myhist "extended"))
> nn
> When I go through the list in the minibuffer I am also getting the variable myhist
> showing up but its value stays nil.

It should be 'myhist instead of myhist in completing-read


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [External] : Re: Operating the HIST feature of completing-read
  2022-07-13  1:16             ` carlmarcos--- via Users list for the GNU Emacs text editor
  2022-07-13  2:04               ` Jean Louis
@ 2022-07-13  6:52               ` Yuri Khan
       [not found]               ` <Ys4oPraxx7rSD+OQ@protected.localdomain-N6qVVuQ----2>
  2022-07-13 15:11               ` Drew Adams
  3 siblings, 0 replies; 15+ messages in thread
From: Yuri Khan @ 2022-07-13  6:52 UTC (permalink / raw)
  To: carlmarcos; +Cc: Drew Adams, Jean Louis, Help Gnu Emacs

On Wed, 13 Jul 2022 at 08:16, carlmarcos--- via Users list for the GNU
Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> Have done as suggested
>
> (defvar myhist nil
>   "Stores previous minibuffer inputs so the user can reuse them.")
>
>   (let* ( (cseq '("bracemk" "expression" "extended" "mixed" "hlsexp" "disable"))
>           (csel  (completing-read "Glowvis: " cseq nil t "mixed" myhist "extended"))

You should pass the symbol of the variable ('myhist), not the value (myhist).



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [External] : Re: Operating the HIST feature of completing-read
       [not found]               ` <Ys4oPraxx7rSD+OQ@protected.localdomain-N6qVVuQ----2>
@ 2022-07-13  8:01                 ` carlmarcos--- via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 15+ messages in thread
From: carlmarcos--- via Users list for the GNU Emacs text editor @ 2022-07-13  8:01 UTC (permalink / raw)
  To: Jean Louis; +Cc: Drew Adams, Help Gnu Emacs


Jul 13, 2022, 02:04 by bugs@gnu.support:

> * carlmarcos@tutanota.com <carlmarcos@tutanota.com> [2022-07-13 04:16]:
>
>>
>> Jul 12, 2022, 16:40 by drew.adams@oracle.com:
>>
>> >> Does the history remember the user input associated
>> >> with each specific completing-read call?
>> >>
>> >
>> > Only each specific history variable.
>> >
>> > If each `completing-read' (or `read-from-minibuffer'
>> > or whatever) call used a different history variable
>> > then the answer to your question would be yes.
>> >
>>
>> Have done as suggested 
>>
>> (defvar myhist nil
>>   "Stores previous minibuffer inputs so the user can reuse them.")
>>
>>   (let* ( (cseq '("bracemk" "expression" "extended" "mixed" "hlsexp" "disable"))
>>           (csel  (completing-read "Glowvis: " cseq nil t "mixed" myhist "extended"))
>> nn
>> When I go through the list in the minibuffer I am also getting the variable myhist
>> showing up but its value stays nil.
>>
>
> It should be 'myhist instead of myhist in completing-read
>
> Jean
>

Thanks Jean.  After doing that I am quite unsure how to figure out whether I am seeing the completing list or the history entries.  




^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [External] : Re: Operating the HIST feature of completing-read
  2022-07-13  0:41         ` carlmarcos--- via Users list for the GNU Emacs text editor
@ 2022-07-13 15:09           ` Drew Adams
  0 siblings, 0 replies; 15+ messages in thread
From: Drew Adams @ 2022-07-13 15:09 UTC (permalink / raw)
  To: carlmarcos@tutanota.com; +Cc: Jean Louis, Help Gnu Emacs

> 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.") ⇒ my-history
> >>
> The history is not described very well in the documentation of
> completing-read.

Your msg gives the impression that you're quoting me.
But I didn't write any of what you quoted - Jean did.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [External] : Re: Operating the HIST feature of completing-read
  2022-07-13  1:16             ` carlmarcos--- via Users list for the GNU Emacs text editor
                                 ` (2 preceding siblings ...)
       [not found]               ` <Ys4oPraxx7rSD+OQ@protected.localdomain-N6qVVuQ----2>
@ 2022-07-13 15:11               ` Drew Adams
  3 siblings, 0 replies; 15+ messages in thread
From: Drew Adams @ 2022-07-13 15:11 UTC (permalink / raw)
  To: carlmarcos@tutanota.com; +Cc: Jean Louis, Help Gnu Emacs

> (defvar myhist nil
>   "Stores previous minibuffer inputs so the user can reuse them.")
> 
>   (let* ( (cseq '("bracemk" "expression" "extended" "mixed" "hlsexp"
> "disable"))
>           (csel  (completing-read "Glowvis: " cseq nil t "mixed" myhist
> "extended"))
> 
> When I go through the list in the minibuffer I am also getting the
> variable myhist
> showing up but its value stays nil.

The value of your global variable is nil.
The `let' sexp returns the result of evaluating its body.
Its body is empty - the `let' returns nil.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-07-13 15:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-11  0:22 Operating the HIST feature of completing-read carlmarcos--- via Users list for the GNU Emacs text editor
2022-07-11 22:43 ` Jean Louis
     [not found] ` <YsynnWwOd/93Lz5Q@protected.localdomain-N6jRHVs----2>
2022-07-12  0:13   ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-07-12  8:52     ` Jean Louis
2022-07-12 14:28       ` [External] : " Drew Adams
2022-07-12 16:20         ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-07-12 16:40           ` Drew Adams
     [not found]           ` <SJ0PR10MB5488AF0AFC27B5DDA0FD6937F3869@SJ0PR10MB5488.namprd10.prod.outlook.com-N6nHMGc--3-2>
2022-07-12 17:00             ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-07-13  1:16             ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-07-13  2:04               ` Jean Louis
2022-07-13  6:52               ` Yuri Khan
     [not found]               ` <Ys4oPraxx7rSD+OQ@protected.localdomain-N6qVVuQ----2>
2022-07-13  8:01                 ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-07-13 15:11               ` Drew Adams
     [not found]       ` <SJ0PR10MB5488F286DDB15D2F9DC59981F3869@SJ0PR10MB5488.namprd10.prod.outlook.com-N6n2IGP--7-2>
2022-07-13  0:41         ` carlmarcos--- via Users list for the GNU Emacs text editor
2022-07-13 15:09           ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.