GNU bug report logs - #45199
28.0.50; [PATCH] Make goto-char offer the number at point as default

Previous Next

Package: emacs;

Reported by: Daniel Martín <mardani29 <at> yahoo.es>

Date: Sat, 12 Dec 2020 18:21:02 UTC

Severity: normal

Tags: confirmed, fixed, patch

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Daniel Martín <mardani29 <at> yahoo.es>
Cc: 45199 <at> debbugs.gnu.org
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
Daniel Martín <mardani29 <at> 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




This bug report was last modified 4 years and 211 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.