aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Martín2020-12-14 17:16:00 +0100
committerLars Ingebrigtsen2020-12-14 17:16:00 +0100
commit0dd8d53344a822842660d2ac75108f40ba9ff0f4 (patch)
tree8407f41d59ccff3c02acf9d90f3776999b00aa6e /src
parent10bc4eac5bb2e7e4b520628286a52f0508332119 (diff)
downloademacs-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.c9
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
191DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", 191DEFUN ("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.
193Beginning of buffer is position (point-min), end is (point-max). 194Beginning of buffer is position (point-min), end is (point-max).
194 195
195The return value is POSITION. */) 196The return value is POSITION.
197
198If called interactively, a numeric prefix argument specifies
199POSITION; without a numeric prefix argument, read POSITION from the
200minibuffer. 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))