summaryrefslogtreecommitdiff
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2020-12-20 22:05:51 +0200
committerJuri Linkov <juri@linkov.net>2020-12-20 22:05:51 +0200
commit1a7033f1f3de4ad8c1bfd68b54e6c9d8444a3bcc (patch)
treec00b75bf5a22e63f5ac7fa843a01bd66b7a9e231 /lisp/simple.el
parentecb5ebf156280be1859f181208306e4c55af3e80 (diff)
downloademacs-1a7033f1f3de4ad8c1bfd68b54e6c9d8444a3bcc.tar.gz
emacs-1a7033f1f3de4ad8c1bfd68b54e6c9d8444a3bcc.tar.bz2
emacs-1a7033f1f3de4ad8c1bfd68b54e6c9d8444a3bcc.zip
* lisp/simple.el (goto-line-read-args): Use number-at-point (bug#45199)
* lisp/subr.el (goto-char--read-natnum-interactive): Add the value of point to the end of default values, and move function slightly higher.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el12
1 files changed, 2 insertions, 10 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index b1c949d7c6d..2b13a0d4867 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1264,7 +1264,6 @@ that uses or sets the mark."
;; minibuffer, this is at the end of the prompt.
(goto-char (minibuffer-prompt-end)))
-
;; Counting lines, one way or another.
(defvar goto-line-history nil
@@ -1276,15 +1275,8 @@ that uses or sets the mark."
(if (and current-prefix-arg (not (consp current-prefix-arg)))
(list (prefix-numeric-value current-prefix-arg))
;; Look for a default, a number in the buffer at point.
- (let* ((default
- (save-excursion
- (skip-chars-backward "0-9")
- (if (looking-at "[0-9]")
- (string-to-number
- (buffer-substring-no-properties
- (point)
- (progn (skip-chars-forward "0-9")
- (point)))))))
+ (let* ((number (number-at-point))
+ (default (and (natnump number) number))
;; Decide if we're switching buffers.
(buffer
(if (consp current-prefix-arg)