Subject: bug#45199: 28.0.50; [PATCH] Make goto-char offer the number at point as default

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 12 Dec 2020 20:05:42 +0100

Daniel Martín <[email-masked]> writes:

> * src/editfns.c (Fgoto_char): Expand the interactive definition of
> goto-char to offer the number at point as default.

I think this makes sense, but:

> -DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ",
> +DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1,
> +         "(if (and current-prefix-arg (not (consp current-prefix-arg)))\
> +              (list (prefix-numeric-value current-prefix-arg))\
> +            (let* ((default\
> +	             (save-excursion\
> +	               (skip-chars-backward \"0-9\")\
> +	               (if (looking-at-p \"[0-9]\")\
> +	                   (string-to-number\
> +	                   (buffer-substring-no-properties\
> +	                   (point)\
> +	                   (progn (skip-chars-forward \"0-9\")\
> +		                  (point))))))))\
> +              (list (read-number \"Goto char: \" default))))",

I think it would be better to put this in a helper function in subr.el,
for instance.

And there's also `number-at-point', could perhaps be used here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no