aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2012-07-29 21:11:42 +0300
committerJuri Linkov2012-07-29 21:11:42 +0300
commita5dcc929862f6727c71db5e45d8750f8c322c53b (patch)
tree3b90ef0f2fa1744cb28d8462b2b900cceac08dd2
parent7f259ae657fd3df9f7aef276fe0d83c2277d61bc (diff)
downloademacs-a5dcc929862f6727c71db5e45d8750f8c322c53b.tar.gz
emacs-a5dcc929862f6727c71db5e45d8750f8c322c53b.zip
* 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'.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/simple.el7
-rw-r--r--lisp/subr.el22
3 files changed, 26 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 81afe67fd5b..61ae993319a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12012-07-29 Juri Linkov <juri@jurta.org>
2
3 * simple.el (goto-line): Don't display default line number in the
4 prompt because it should be displayed by `read-number' (bug#9952).
5 Add the current line number to the defaults of `goto-line' to
6 allow its easier modification by users with `M-n' (bug#9201).
7
8 * subr.el (read-number): Support multiple default values like in
9 other minibuffer reading functions. Replace `read' with
10 `string-to-number' for consistency with `number-to-string'.
11
12012-07-29 Paul Eggert <eggert@cs.ucla.edu> 122012-07-29 Paul Eggert <eggert@cs.ucla.edu>
2 13
3 deactive->inactive, inactivate->deactivate spelling fixes (Bug#10150) 14 deactive->inactive, inactivate->deactivate spelling fixes (Bug#10150)
diff --git a/lisp/simple.el b/lisp/simple.el
index 4b6d6c7a73b..e1d6760e72b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -948,11 +948,8 @@ rather than line counts."
948 (concat " in " (buffer-name buffer)) 948 (concat " in " (buffer-name buffer))
949 ""))) 949 "")))
950 ;; Read the argument, offering that number (if any) as default. 950 ;; Read the argument, offering that number (if any) as default.
951 (list (read-number (format (if default "Goto line%s (%s): " 951 (list (read-number (format "Goto line%s: " buffer-prompt)
952 "Goto line%s: ") 952 (list default (line-number-at-pos)))
953 buffer-prompt
954 default)
955 default)
956 buffer)))) 953 buffer))))
957 ;; Switch to the desired buffer, one way or another. 954 ;; Switch to the desired buffer, one way or another.
958 (if buffer 955 (if buffer
diff --git a/lisp/subr.el b/lisp/subr.el
index 76fec5dd5ac..73bc1d99e05 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2188,23 +2188,27 @@ by doing (clear-string STRING)."
2188 "Read a numeric value in the minibuffer, prompting with PROMPT. 2188 "Read a numeric value in the minibuffer, prompting with PROMPT.
2189DEFAULT specifies a default value to return if the user just types RET. 2189DEFAULT specifies a default value to return if the user just types RET.
2190The value of DEFAULT is inserted into PROMPT." 2190The value of DEFAULT is inserted into PROMPT."
2191 (let ((n nil)) 2191 (let ((n nil)
2192 (when default 2192 (default1 (if (consp default) (car default) default)))
2193 (when default1
2193 (setq prompt 2194 (setq prompt
2194 (if (string-match "\\(\\):[ \t]*\\'" prompt) 2195 (if (string-match "\\(\\):[ \t]*\\'" prompt)
2195 (replace-match (format " (default %s)" default) t t prompt 1) 2196 (replace-match (format " (default %s)" default1) t t prompt 1)
2196 (replace-regexp-in-string "[ \t]*\\'" 2197 (replace-regexp-in-string "[ \t]*\\'"
2197 (format " (default %s) " default) 2198 (format " (default %s) " default1)
2198 prompt t t)))) 2199 prompt t t))))
2199 (while 2200 (while
2200 (progn 2201 (progn
2201 (let ((str (read-from-minibuffer prompt nil nil nil nil 2202 (let ((str (read-from-minibuffer
2202 (and default 2203 prompt nil nil nil nil
2203 (number-to-string default))))) 2204 (when default
2205 (if (consp default)
2206 (mapcar 'number-to-string (delq nil default))
2207 (number-to-string default))))))
2204 (condition-case nil 2208 (condition-case nil
2205 (setq n (cond 2209 (setq n (cond
2206 ((zerop (length str)) default) 2210 ((zerop (length str)) default1)
2207 ((stringp str) (read str)))) 2211 ((stringp str) (string-to-number str))))
2208 (error nil))) 2212 (error nil)))
2209 (unless (numberp n) 2213 (unless (numberp n)
2210 (message "Please enter a number.") 2214 (message "Please enter a number.")