all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to travel into the future?
@ 2017-02-14  8:54 Marcin Borkowski
  2017-02-14  9:05 ` Yuri Khan
  2017-02-14 14:39 ` Drew Adams
  0 siblings, 2 replies; 3+ messages in thread
From: Marcin Borkowski @ 2017-02-14  8:54 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi list,

I'd like to use in my code the M-n facility in history to enable the
user to have access to a reasonable default value, as described in
  (info "(emacs) Minibuffer History").
How should I do it?  Should I use read-string?  If so, do I have to put
the default into the history variable and use the (HISTVAR . POSITION)
argument to read-string?  If so, should I then manually delete the
default (which might have been used or not by the user) from the history
variable afterwards?

Any pointers?

TIA,

--
Marcin Borkowski



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

* Re: How to travel into the future?
  2017-02-14  8:54 How to travel into the future? Marcin Borkowski
@ 2017-02-14  9:05 ` Yuri Khan
  2017-02-14 14:39 ` Drew Adams
  1 sibling, 0 replies; 3+ messages in thread
From: Yuri Khan @ 2017-02-14  9:05 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Help Gnu Emacs mailing list

On Tue, Feb 14, 2017 at 3:54 PM, Marcin Borkowski <mbork@mbork.pl> wrote:

> I'd like to use in my code the M-n facility in history to enable the
> user to have access to a reasonable default value, as described in
>   (info "(emacs) Minibuffer History").
> How should I do it?  Should I use read-string?  If so, do I have to put
> the default into the history variable and use the (HISTVAR . POSITION)
> argument to read-string?  If so, should I then manually delete the
> default (which might have been used or not by the user) from the history
> variable afterwards?

As far as I understand: (describe-function 'read-string)

 Fourth arg DEFAULT-VALUE is the default value or the list of default values.
 If non-nil, it is used for history commands, and as the value (or the first
 element of the list of default values) to return if the user enters the
 empty string.



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

* RE: How to travel into the future?
  2017-02-14  8:54 How to travel into the future? Marcin Borkowski
  2017-02-14  9:05 ` Yuri Khan
@ 2017-02-14 14:39 ` Drew Adams
  1 sibling, 0 replies; 3+ messages in thread
From: Drew Adams @ 2017-02-14 14:39 UTC (permalink / raw)
  To: Marcin Borkowski, Help Gnu Emacs mailing list

> I'd like to use in my code the M-n facility in history to enable the
> user to have access to a reasonable default value, as described in
>   (info "(emacs) Minibuffer History").
> How should I do it?  Should I use read-string?  If so, do I have to put
> the default into the history variable and use the (HISTVAR . POSITION)
> argument to read-string?  If so, should I then manually delete the
> default (which might have been used or not by the user) from the history
> variable afterwards?
> 
> Any pointers?

Just provide a list of default values (strings) as argument
DEFAULT to `completing-read', `read-string', or similar.

`C-h f read-string':

 Fourth arg DEFAULT-VALUE is the default value or the list of default values.
 If non-nil, it is used for history commands, and as the value (or the first
 element of the list of default values) to return if the user enters the
 empty string.



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

end of thread, other threads:[~2017-02-14 14:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-14  8:54 How to travel into the future? Marcin Borkowski
2017-02-14  9:05 ` Yuri Khan
2017-02-14 14:39 ` 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.