unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Guillaume Salagnac <guillaume.salagnac@gmail.com>, 28513@debbugs.gnu.org
Subject: bug#28513: 25.1; ido insists on guessing the wrong directory
Date: Sun, 13 Dec 2020 14:12:01 +0100	[thread overview]
Message-ID: <87o8ix4zq6.fsf@gnus.org> (raw)
In-Reply-To: <88f8e8d4-581b-85f8-92e6-8607d533cd77@yandex.ru> (Dmitry Gutov's message of "Sun, 13 Dec 2020 03:11:41 +0200")

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 12.12.2020 14:10, Lars Ingebrigtsen wrote:
>> I don't use ido-mode for files normally -- are there any ido users here
>> that do?  If so, does this seem like expected behaviour to you?
>
> Looks like a bug, yes.
>
> The scenario looks pretty specific, though, that's probably why it
> hasn't come up before.

I have a slightly simpler reproduction case:

emacs -Q -f ido-mode lisp/abbrev.el
C-x C-w RET C-f RET

This should write the file to calc/abbrev.el, but prompts for
overwriting.

Here's the backtrace with debug-on-quit:

Debugger entered--Lisp error: (quit)
  read-from-minibuffer("File ‘~/src/emacs/trunk/lisp/abbrev.el’ exists; ov.
  y-or-n-p("File ‘~/src/emacs/trunk/lisp/abbrev.el’ exists; ov...")
  write-file("~/src/emacs/trunk/lisp/abbrev.el" t)
  funcall-interactively(write-file "~/src/emacs/trunk/lisp/abbrev.el" t)
  call-interactively(write-file)
  ido-file-internal(write write-file nil "Write file: " nil nil ignore)
  ido-write-file()

I was momentarily puzzled about why that call-interactively to
write-file didn't re-prompt about the location, but:

       ((eq ido-exit 'fallback)
	;; Need to guard setting of default-directory here, since
	;; we don't want to change directory of current buffer.
	(let ((default-directory ido-current-directory)
	      (read-file-name-function nil))
	  (setq this-command (or ido-fallback fallback 'find-file))
	  (run-hook-with-args 'ido-before-fallback-functions this-command)
	  (call-interactively this-command)))

So hitting `C-f' makes ido go into `fallback' mode?  Yes!

    (define-key map "\C-f" 'ido-magic-forward-char)

(defun ido-magic-forward-char (arg)
  "Move forward in user input or perform magic action.
If no user input is present, or at end of input, perform magic actions:
C-x C-b ... C-f  switch to `ido-find-file'.
C-x C-f ... C-f  fallback to non-Ido `find-file'.
C-x C-d ... C-f  fallback to non-Ido brief `dired'.
C-x d ... C-f    fallback to non-Ido `dired'."
  (interactive "P")
  (cond
   ((or arg (not (eobp)))
    (forward-char (min (prefix-numeric-value arg)
		       (- (point-max) (point)))))
   ((memq ido-cur-item '(file dir))
    (ido-fallback-command))

So...  this is apparently a feature?  Hitting `C-f' disables ido and
calls the fallback command, which is `write-region' in this case.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2020-12-13 13:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 15:03 bug#28513: 25.1; ido insists on guessing the wrong directory Guillaume Salagnac
2020-12-12 12:10 ` Lars Ingebrigtsen
2020-12-13  1:11   ` Dmitry Gutov
2020-12-13 13:12     ` Lars Ingebrigtsen [this message]
2020-12-14  2:24       ` Dmitry Gutov
2020-12-14 16:42         ` Lars Ingebrigtsen
2020-12-15  2:23           ` Dmitry Gutov
2020-12-15  6:42             ` Lars Ingebrigtsen
2020-12-17 11:33               ` Lars Ingebrigtsen
2020-12-17 11:54                 ` Dmitry Gutov
2021-01-01 21:51 ` bug#28513: Ryan C. Thompson
2021-01-10 23:07   ` bug#19412: bug#28513 Ryan C. Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o8ix4zq6.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=28513@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=guillaume.salagnac@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).