Commit a5dcc929 authored by Juri Linkov's avatar Juri Linkov
Browse files

* lisp/simple.el (goto-line): Don't display default line number in the

prompt because it should be displayed by `read-number' (bug#9952).
Add the current line number to the defaults of `goto-line' to
allow its easier modification by users with `M-n' (bug#9201).

* lisp/subr.el (read-number): Support multiple default values like in
other minibuffer reading functions.  Replace `read' with
`string-to-number' for consistency with `number-to-string'.
parent 7f259ae6
2012-07-29 Juri Linkov <juri@jurta.org>
* simple.el (goto-line): Don't display default line number in the
prompt because it should be displayed by `read-number' (bug#9952).
Add the current line number to the defaults of `goto-line' to
allow its easier modification by users with `M-n' (bug#9201).
* subr.el (read-number): Support multiple default values like in
other minibuffer reading functions. Replace `read' with
`string-to-number' for consistency with `number-to-string'.
2012-07-29 Paul Eggert <eggert@cs.ucla.edu> 2012-07-29 Paul Eggert <eggert@cs.ucla.edu>
   
deactive->inactive, inactivate->deactivate spelling fixes (Bug#10150) deactive->inactive, inactivate->deactivate spelling fixes (Bug#10150)
......
...@@ -948,11 +948,8 @@ rather than line counts." ...@@ -948,11 +948,8 @@ rather than line counts."
(concat " in " (buffer-name buffer)) (concat " in " (buffer-name buffer))
""))) "")))
;; Read the argument, offering that number (if any) as default. ;; Read the argument, offering that number (if any) as default.
(list (read-number (format (if default "Goto line%s (%s): " (list (read-number (format "Goto line%s: " buffer-prompt)
"Goto line%s: ") (list default (line-number-at-pos)))
buffer-prompt
default)
default)
buffer)))) buffer))))
;; Switch to the desired buffer, one way or another. ;; Switch to the desired buffer, one way or another.
(if buffer (if buffer
......
...@@ -2188,23 +2188,27 @@ by doing (clear-string STRING)." ...@@ -2188,23 +2188,27 @@ by doing (clear-string STRING)."
"Read a numeric value in the minibuffer, prompting with PROMPT. "Read a numeric value in the minibuffer, prompting with PROMPT.
DEFAULT specifies a default value to return if the user just types RET. DEFAULT specifies a default value to return if the user just types RET.
The value of DEFAULT is inserted into PROMPT." The value of DEFAULT is inserted into PROMPT."
(let ((n nil)) (let ((n nil)
(when default (default1 (if (consp default) (car default) default)))
(when default1
(setq prompt (setq prompt
(if (string-match "\\(\\):[ \t]*\\'" prompt) (if (string-match "\\(\\):[ \t]*\\'" prompt)
(replace-match (format " (default %s)" default) t t prompt 1) (replace-match (format " (default %s)" default1) t t prompt 1)
(replace-regexp-in-string "[ \t]*\\'" (replace-regexp-in-string "[ \t]*\\'"
(format " (default %s) " default) (format " (default %s) " default1)
prompt t t)))) prompt t t))))
(while (while
(progn (progn
(let ((str (read-from-minibuffer prompt nil nil nil nil (let ((str (read-from-minibuffer
(and default prompt nil nil nil nil
(number-to-string default))))) (when default
(if (consp default)
(mapcar 'number-to-string (delq nil default))
(number-to-string default))))))
(condition-case nil (condition-case nil
(setq n (cond (setq n (cond
((zerop (length str)) default) ((zerop (length str)) default1)
((stringp str) (read str)))) ((stringp str) (string-to-number str))))
(error nil))) (error nil)))
(unless (numberp n) (unless (numberp n)
(message "Please enter a number.") (message "Please enter a number.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment