bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Lars Ingebrigtsen
Subject: bug#45199: 28.0.50; [PATCH] Make goto-char offer the number at point as default
Date: Sat, 12 Dec 2020 20:05:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Daniel Martín <mardani29@yahoo.es> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]