diff options
| author | Richard M. Stallman | 1996-08-07 18:28:03 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-08-07 18:28:03 +0000 |
| commit | 18fef1118abe792aa6b81aebba31e7ef33363a19 (patch) | |
| tree | 26b1e214aef33edefb24ec2c254f2abad5c657a7 /src | |
| parent | dea5efcbe3af1c2f19e7983c3276cd9ad25bc5b4 (diff) | |
| download | emacs-18fef1118abe792aa6b81aebba31e7ef33363a19.tar.gz emacs-18fef1118abe792aa6b81aebba31e7ef33363a19.zip | |
(Fread_from_minibuffer): Make position 0 in the initial
input mean the beginning.
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index d0e86ea3195..0d107f97b1b 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -493,7 +493,7 @@ DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, | |||
| 493 | If optional second arg INITIAL-CONTENTS is non-nil, it is a string\n\ | 493 | If optional second arg INITIAL-CONTENTS is non-nil, it is a string\n\ |
| 494 | to be inserted into the minibuffer before reading input.\n\ | 494 | to be inserted into the minibuffer before reading input.\n\ |
| 495 | If INITIAL-CONTENTS is (STRING . POSITION), the initial input\n\ | 495 | If INITIAL-CONTENTS is (STRING . POSITION), the initial input\n\ |
| 496 | is STRING, but point is placed POSITION characters into the string.\n\ | 496 | is STRING, but point is placed at position POSITION in the minibuffer.\n\ |
| 497 | Third arg KEYMAP is a keymap to use whilst reading;\n\ | 497 | Third arg KEYMAP is a keymap to use whilst reading;\n\ |
| 498 | if omitted or nil, the default is `minibuffer-local-map'.\n\ | 498 | if omitted or nil, the default is `minibuffer-local-map'.\n\ |
| 499 | If fourth arg READ is non-nil, then interpret the result as a lisp object\n\ | 499 | If fourth arg READ is non-nil, then interpret the result as a lisp object\n\ |
| @@ -531,7 +531,11 @@ DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, | |||
| 531 | { | 531 | { |
| 532 | CHECK_NUMBER (position, 0); | 532 | CHECK_NUMBER (position, 0); |
| 533 | /* Convert to distance from end of input. */ | 533 | /* Convert to distance from end of input. */ |
| 534 | pos = XINT (position) - 1 - XSTRING (initial_contents)->size; | 534 | if (XINT (position) < 1) |
| 535 | /* A number too small means the beginning of the string. */ | ||
| 536 | pos = - XSTRING (initial_contents)->size; | ||
| 537 | else | ||
| 538 | pos = XINT (position) - 1 - XSTRING (initial_contents)->size; | ||
| 535 | } | 539 | } |
| 536 | } | 540 | } |
| 537 | 541 | ||