all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Read-string with pointer at start of initial value
@ 2018-01-26 22:58 Whitfield Diffie
  2018-01-26 23:56 ` Michael Heerdegen
       [not found] ` <mailman.8056.1517011017.27995.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Whitfield Diffie @ 2018-01-26 22:58 UTC (permalink / raw)
  To: help-gnu-emacs

    I want to call read-string with the pointer at the start of the
initial value so that I can delete it and type something else if it is
not right.  I am able to do something like this with read-file-name
because

(read-filename "PROMPT: " "~/" "DEFAULT-FILENAME" nil "INITIAL")

puts the mark after "~/" and before the initial input but I have found
no way of doing anything similar with read-string.


                                   Whit



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

* Re: Read-string with pointer at start of initial value
       [not found] <mailman.8055.1517009596.27995.help-gnu-emacs@gnu.org>
@ 2018-01-26 23:43 ` Emanuel Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2018-01-26 23:43 UTC (permalink / raw)
  To: help-gnu-emacs

Whitfield Diffie wrote:

> I want to call read-string with the pointer
> at the start of the initial value so that
> I can delete it and type something else if it
> is not right.

Try

    (read-string "enter a string: " "suggestion")

Here, you can hit M-DEL for `backward-kill-word'
to delete "suggestion" just as fast as you
would if point was at the first letter (that'd
instead be M-d for `kill-word').

-- 
underground experts united
http://user.it.uu.se/~embe8573


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

* Re: Read-string with pointer at start of initial value
  2018-01-26 22:58 Whitfield Diffie
@ 2018-01-26 23:56 ` Michael Heerdegen
       [not found] ` <mailman.8056.1517011017.27995.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Heerdegen @ 2018-01-26 23:56 UTC (permalink / raw)
  To: Whitfield Diffie; +Cc: help-gnu-emacs

Whitfield Diffie <whitfield.diffie@gmail.com> writes:

> I want to call read-string with the pointer at the start of the
> initial value [...]

(read-from-minibuffer "String: " (cons "Test" 1))

`read-string' does also accept a cons as INITIAL-INPUT to specify the
cursor position, so the following also works:

(read-string "String: " (cons "Test" 1))

but the docstring discourages its use.


Michael.



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

* Re: Read-string with pointer at start of initial value
       [not found] ` <mailman.8056.1517011017.27995.help-gnu-emacs@gnu.org>
@ 2018-01-27  0:20   ` Emanuel Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2018-01-27  0:20 UTC (permalink / raw)
  To: help-gnu-emacs

Michael Heerdegen wrote:

> (read-from-minibuffer "String: " (cons "Test"
> 1))
>
> `read-string' does also accept a cons as
> INITIAL-INPUT to specify the cursor position,
> so the following also works:
>
> (read-string "String: " (cons "Test" 1))
>
> but the docstring discourages its use.

In this case, I don't think there is any need
for it because finger-habits, especially
generic commands to move point etc., are
ultimately very fast.

But is this the reason why it is disencouraged
or is there another/other reasons?

As for the docstring, it says

  This argument has been superseded by
  DEFAULT-VALUE and should normally be nil in
  new code. It behaves as INITIAL-CONTENTS in
  `read-from-minibuffer' (which see).

What does "which see" mean?

GNU Emacs 24.4.1 (arm-unknown-linux-gnueabihf,
GTK+ Version 3.14.5) of 2015-03-10 on bm-wb-01,
modified by Debian

-- 
underground experts united
http://user.it.uu.se/~embe8573


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

end of thread, other threads:[~2018-01-27  0:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.8055.1517009596.27995.help-gnu-emacs@gnu.org>
2018-01-26 23:43 ` Read-string with pointer at start of initial value Emanuel Berg
2018-01-26 22:58 Whitfield Diffie
2018-01-26 23:56 ` Michael Heerdegen
     [not found] ` <mailman.8056.1517011017.27995.help-gnu-emacs@gnu.org>
2018-01-27  0:20   ` Emanuel Berg

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.