emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109271: * lisp/simple.el (goto-line)


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109271: * lisp/simple.el (goto-line): Don't display default line number in the
Date: Sun, 29 Jul 2012 21:11:42 +0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109271
fixes bug: http://debbugs.gnu.org/9952
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Sun 2012-07-29 21:11:42 +0300
message:
  * 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'.
modified:
  lisp/ChangeLog
  lisp/simple.el
  lisp/subr.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-07-29 16:29:23 +0000
+++ b/lisp/ChangeLog    2012-07-29 18:11:42 +0000
@@ -1,3 +1,14 @@
+2012-07-29  Juri Linkov  <address@hidden>
+
+       * 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  <address@hidden>
 
        deactive->inactive, inactivate->deactivate spelling fixes (Bug#10150)

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2012-07-29 04:45:48 +0000
+++ b/lisp/simple.el    2012-07-29 18:11:42 +0000
@@ -948,11 +948,8 @@
                 (concat " in " (buffer-name buffer))
               "")))
        ;; Read the argument, offering that number (if any) as default.
-       (list (read-number (format (if default "Goto line%s (%s): "
-                                    "Goto line%s: ")
-                                  buffer-prompt
-                                  default)
-                          default)
+       (list (read-number (format "Goto line%s: " buffer-prompt)
+                          (list default (line-number-at-pos)))
             buffer))))
   ;; Switch to the desired buffer, one way or another.
   (if buffer

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2012-07-26 01:27:33 +0000
+++ b/lisp/subr.el      2012-07-29 18:11:42 +0000
@@ -2188,23 +2188,27 @@
   "Read a numeric value in the minibuffer, prompting with PROMPT.
 DEFAULT specifies a default value to return if the user just types RET.
 The value of DEFAULT is inserted into PROMPT."
-  (let ((n nil))
-    (when default
+  (let ((n nil)
+       (default1 (if (consp default) (car default) default)))
+    (when default1
       (setq 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]*\\'"
-                                       (format " (default %s) " default)
+                                       (format " (default %s) " default1)
                                        prompt t t))))
     (while
        (progn
-         (let ((str (read-from-minibuffer prompt nil nil nil nil
-                                          (and default
-                                               (number-to-string default)))))
+         (let ((str (read-from-minibuffer
+                     prompt nil nil nil nil
+                     (when default
+                       (if (consp default)
+                           (mapcar 'number-to-string (delq nil default))
+                         (number-to-string default))))))
            (condition-case nil
                (setq n (cond
-                        ((zerop (length str)) default)
-                        ((stringp str) (read str))))
+                        ((zerop (length str)) default1)
+                        ((stringp str) (string-to-number str))))
              (error nil)))
          (unless (numberp n)
            (message "Please enter a number.")


reply via email to

[Prev in Thread] Current Thread [Next in Thread]