;; minibuffer, this is at the end of the prompt.
(goto-char (minibuffer-prompt-end)))
\f
-
;; Counting lines, one way or another.
(defvar goto-line-history nil
(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)
(push (cons t read) unread-command-events)
nil))))))
+(defun goto-char--read-natnum-interactive (prompt)
+ "Get a natural number argument, optionally prompting with PROMPT.
+If there is a natural number at point, use it as default."
+ (if (and current-prefix-arg (not (consp current-prefix-arg)))
+ (list (prefix-numeric-value current-prefix-arg))
+ (let* ((number (number-at-point))
+ (default (and (natnump number) number)))
+ (list (read-number prompt (list default (point)))))))
+
\f
(defvar read-char-history nil
"The default history for the `read-char-from-minibuffer' function.")
(message "%s%s" prompt (char-to-string char))
char))
-(defun goto-char--read-natnum-interactive (prompt)
- "Get a natural number argument, optionally prompting with PROMPT.
-If there is a natural number at point, use it as default."
- (if (and current-prefix-arg (not (consp current-prefix-arg)))
- (list (prefix-numeric-value current-prefix-arg))
- (let* ((number (number-at-point))
- (default (and (natnump number) number)))
- (list (read-number prompt default)))))
-
\f
;; Behind display-popup-menus-p test.
(declare-function x-popup-dialog "menu.c" (position contents &optional header))