Subject: bug#56532: 27.2; Ido C-f in read-file-name inserts twice the initial name

From: Tobias Bora <[email-masked]>
Date: Wed, 13 Jul 2022 11:27:11 +0200

Dear maintainers,

If you enable ido with (setq ido-auto-merge-work-directories-length -1)
and evaluate:

(read-file-name  "Picture name:" "/tmp" nil nil "defaultname.png")

and go at the end of the buffer with C-e (not sure why the cursor is not
there by default), and press C-f to come back to a normal file prompt
(not using ido), then the initial text is written one more time, so the
prompt is now:

/tmp/defaultname.png*defaultname.png

where * is the position of the cursor. I would expect C-f in that case
to just prompt /tmp/defaultname.png.

Thanks!

In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, 
cairo version 1.16.0)
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: NixOS 22.05 (Quokka)

Recent messages:
Mark set
"/tmp/KRITA_SWAP_FILE_MWZMdW"
user-error: No window left from selected window
user-error: No window right from selected window
Quit
"/tmp/"
Delete /tmp/a.pdf? (y or n) n [2 times]
Quit [5 times]
Mark set
M-s-w is undefined

Configured using:
  'configure
  --prefix=/nix/store/88i1c5xv4cznlwwxvygd5m3w8m1g8czw-emacs-27.2
  --disable-build-details --with-modules --with-x-toolkit=gtk3 --with-xft
  --with-cairo'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY
INOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER GMP

Important settings:
   value of $EMACSLOADPATH:
   value of $LANG: fr_FR.UTF-8
   value of $XMODIFIERS: @im=ibus
   locale-coding-system: utf-8

Major mode: Text

Minor modes in effect:
   dap-tooltip-mode: t
   dap-ui-many-windows-mode: t
   dap-ui-controls-mode: t
   dap-ui-mode: t
   dap-auto-configure-mode: t
   dap-mode: t
   treemacs-filewatch-mode: t
   treemacs-follow-mode: t
   treemacs-git-mode: t
   treemacs-fringe-indicator-mode: t
   which-key-mode: t
   async-bytecomp-package-mode: t
   shell-dirtrack-mode: t
   yas-global-mode: t
   yas-minor-mode: t
   TeX-PDF-mode: t
   TeX-source-correlate-mode: t
   ido-ubiquitous-mode: t
   ido-everywhere: t
   show-paren-mode: t
   global-undo-tree-mode: t
   undo-tree-mode: t
   recentf-mode: t
   delete-selection-mode: t
   minions-mode: t
   override-global-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   global-visual-line-mode: t
   visual-line-mode: t
   transient-mark-mode: t

Load-path shadows:
/home/leo/.nix-profile/share/emacs/site-lisp/site-start hides 
/run/current-system/sw/share/emacs/site-lisp/site-start
/home/leo/.nix-profile/share/emacs/site-lisp/site-start hides 
/nix/store/hlvi7jg87pr89j4d3xli0bjb21gj7pyr-emacs-packages-deps/share/emacs/site-lisp/site-start
/home/leo/.nix-profile/share/emacs/site-lisp/site-start hides 
/nix/store/88i1c5xv4cznlwwxvygd5m3w8m1g8czw-emacs-27.2/share/emacs/site-lisp/site-start

Features:
(shadow sort mail-extr emacsbug sendmail eieio-opt winner helm-mode
helm-files helm-buffers helm-occur helm-tags helm-locate helm-grep
helm-regexp helm-misc helm-types help-fns radix-tree cl-print debug
backtrace reftex-sel cursor-sensor reftex-ref reftex-parse reftex-toc
vc-git diff-mode misearch multi-isearch server texmathp preview
prv-emacs reftex-dcr tex-bar toolbar-x font-latex tex-mode latexenc smex
helm-lsp helm-imenu dap-mouse dap-ui bui bui-list bui-info bui-entry
bui-core bui-history bui-button bui-utils lsp-lens dap-java dap-mode
dap-launch posframe dap-overlays lsp-java request autorevert
lsp-treemacs lsp-treemacs-themes treemacs treemacs-header-line
treemacs-compatibility treemacs-mode treemacs-bookmarks
treemacs-interface treemacs-extensions treemacs-mouse-interface
treemacs-tags treemacs-persistence treemacs-filewatch-mode
treemacs-follow-mode treemacs-rendering treemacs-annotations
treemacs-async treemacs-workspaces treemacs-dom treemacs-visuals
treemacs-fringe-indicator treemacs-scope pulse treemacs-faces
treemacs-icons treemacs-themes treemacs-core-utils pfuture
treemacs-logging treemacs-customization treemacs-macros which-key lsp-ui
lsp-ui-doc goto-addr lsp-ui-imenu lsp-ui-peek lsp-ui-sideline lsp-mode
spinner network-stream markdown-mode color inline ewoc lsp-ui-util
lsp-protocol ht projectile lisp-mnt grep ibuf-ext ibuffer
ibuffer-loaddefs adoc-mode tempo markup-faces yaml-mode flyspell ispell
gdb-mi bindat gud lua-mode tuareg speedbar sb-image ezimage dframe
tuareg-opam smie caml-help caml-types caml-emacs find-file csharp-mode
cc-langs imenu cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs org-ref org-ref-helm-bibtex
org-ref-helm helm-utils helm-bibtex bibtex-completion filenotify biblio
biblio-download biblio-dissemin biblio-ieee biblio-hal biblio-dblp
biblio-crossref biblio-arxiv biblio-doi biblio-core let-alist url-queue
hl-line helm-net helm-help helm helm-source eieio-compat
helm-multi-match helm-lib helm-config helm-easymenu async-bytecomp async
org-ref-core reftex-cite reftex reftex-loaddefs reftex-vars parsebib
ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn
nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex ox-icalendar
ox-html table ox-ascii ox-publish ox org-ref-glossary org-ref-bibtex
org-ref-citeproc message rfc822 mml mml-sec epa epg epg-config gnus-util
rmail rmail-loaddefs mm-decode mm-bodies mm-encode mailabbrev mail-utils
gmm-utils mailheader key-chord hydra lv doi-utils org-ref-utils
org-ref-pdf ol-bibtex bibtex htmlize cl f s dash haskell-mode
haskell-cabal haskell-utils haskell-font-lock haskell-indentation
haskell-string haskell-sort-imports haskell-lexeme haskell-align-imports
haskell-complete-module haskell-ghc-support etags fileloop xref project
dabbrev haskell-customize shell eaf derived eaf-interleave org-noter
org-element avl-tree generator org ob ob-tangle ob-ref ob-lob ob-table
ob-exp org-macro org-footnote org-src ob-comint org-pcomplete pcomplete
org-list org-faces org-entities time-date noutline outline org-version
ob-emacs-lisp ob-core ob-eval org-table ol org-keys org-compat org-macs
org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs
eaf-mindmap bookmark text-property-search pp yasnippet-snippets
yasnippet validate auctex-latexmk tex-buf latex latex-flymake
flymake-proc flymake compile comint ansi-color ring warnings thingatpt
tex-ispell tex-style tex dbus crm advice company-nixos-options company
nixos-options dired dired-loaddefs ido-completing-read+ memoize cus-edit
cus-start cus-load minibuf-eldef ido debpaste xml-rpc timezone url-http
url url-proxy url-privacy url-expand url-methods url-history mailcap
url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr url-cookie url-domsuf url-util url-gw nsm rmc puny xml
re-builder rx paren undo-tree diff windmove recentf tree-widget wid-edit
aggressive-indent edmacro kmacro delsel minions moody
doom-themes-ext-org doom-themes-ext-visual-bell face-remap
doom-nord-light-theme pcase doom-themes doom-themes-base cl-extra
help-mode use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core finder-inf tex-site info package easymenu browse-url
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib chemacs tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win
x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 1101562 135164)
  (symbols 48 60227 2)
  (strings 32 426576 20010)
  (string-bytes 1 11344777)
  (vectors 16 131038)
  (vector-slots 8 2144825 163904)
  (floats 8 912 893)
  (intervals 56 10876 1625)
  (buffers 1000 27))