]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix INITIAL-INPUT cons handling in ido-read-internal
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 15 Jul 2019 18:52:48 +0000 (20:52 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 15 Jul 2019 18:52:48 +0000 (20:52 +0200)
* lisp/ido.el (ido-read-internal): Is INITIAL-INPUT is a cons that
specifies cursor position, adjust the number to be palatable for
`read-for-minibuffer' (bug#27807).

lisp/ido.el

index bf2c74558ac166b7667b3862c9137ca6a112b6dc..e14f0151690a1fcc5d12cbe3cb709793f9b43610 100644 (file)
@@ -1905,7 +1905,14 @@ If INITIAL is non-nil, it specifies the initial input string."
        )
 
     (ido-setup-completion-map)
-    (setq ido-text-init initial)
+
+    (setq ido-text-init
+          (if (consp initial)
+              (cons (car initial)
+                    ;; `completing-read' uses 0-based index while
+                    ;; `read-from-minibuffer' uses 1-based index.
+                    (1+ (cdr initial)))
+            initial))
     (setq ido-input-stack nil)
 
     (run-hooks 'ido-setup-hook)