diff options
| author | Daniel MartÃn | 2020-12-14 17:16:00 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-12-14 17:16:00 +0100 |
| commit | 0dd8d53344a822842660d2ac75108f40ba9ff0f4 (patch) | |
| tree | 8407f41d59ccff3c02acf9d90f3776999b00aa6e /src | |
| parent | 10bc4eac5bb2e7e4b520628286a52f0508332119 (diff) | |
| download | emacs-0dd8d53344a822842660d2ac75108f40ba9ff0f4.tar.gz emacs-0dd8d53344a822842660d2ac75108f40ba9ff0f4.zip | |
Make goto-char offer the number at point as default
* lisp/subr.el (read-natnum-interactive): New function to read natural
numbers for interactive functions.
* src/editfns.c (Fgoto_char): Call read-natnum-interactive from the
interactive definition of goto-char to offer the number at point as
default. Also expand the docstring to document this new interactive
behavior.
* doc/emacs/basic.texi (Moving Point): Expand the Emacs manual to
document this new behavior.
* etc/NEWS: And announce it (bug#45199).
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/editfns.c b/src/editfns.c index 4104edd77fd..e4c4141ef5e 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -188,11 +188,16 @@ DEFUN ("point-marker", Fpoint_marker, Spoint_marker, 0, 0, 0, | |||
| 188 | return build_marker (current_buffer, PT, PT_BYTE); | 188 | return build_marker (current_buffer, PT, PT_BYTE); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", | 191 | DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, |
| 192 | "(goto-char--read-natnum-interactive \"Go to char: \")", | ||
| 192 | doc: /* Set point to POSITION, a number or marker. | 193 | doc: /* Set point to POSITION, a number or marker. |
| 193 | Beginning of buffer is position (point-min), end is (point-max). | 194 | Beginning of buffer is position (point-min), end is (point-max). |
| 194 | 195 | ||
| 195 | The return value is POSITION. */) | 196 | The return value is POSITION. |
| 197 | |||
| 198 | If called interactively, a numeric prefix argument specifies | ||
| 199 | POSITION; without a numeric prefix argument, read POSITION from the | ||
| 200 | minibuffer. The default value is the number at point (if any). */) | ||
| 196 | (register Lisp_Object position) | 201 | (register Lisp_Object position) |
| 197 | { | 202 | { |
| 198 | if (MARKERP (position)) | 203 | if (MARKERP (position)) |