unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Sam Halliday <sam.halliday@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: ido-find-file
Date: Sat, 26 Dec 2015 15:27:38 -0800 (PST)	[thread overview]
Message-ID: <32558752-9f6e-45ea-b953-099d8fc5daf7@googlegroups.com> (raw)
In-Reply-To: <eba9bd54-403a-466d-b55a-4a1fcc293ddc@googlegroups.com>

On Saturday, 26 December 2015 23:20:00 UTC, Sam Halliday  wrote:
> Dear Emacs users,
> 
> I have been trying out ido-find-file as a replacement for find-file and it was going really well until I tried to open a directory in dired.
> 
> The default in normal find-file is for RET to open a directory in dired, but with ido-find-file, RET will open a (useless) buffer containing the name of the files in that directory and C-d is needed to open the directory in dired.
> 
> There is no way I'm going to be able to retrain my fingers to do that, and it is also undesirable behaviour. Is there any way to get ido-find-file to DWIM?


I found this hack from JohnWiegley http://www.emacswiki.org/emacs/InteractivelyDoThings#toc29 which does the job but is really quite ugly/long. It would be good if this was in the mainline and possible the default.

 (defun ido-smart-select-text ()
    "Select the current completed item.  Do NOT descend into directories."
    (interactive)
    (when (and (or (not ido-require-match)
                   (if (memq ido-require-match
                             '(confirm confirm-after-completion))
                       (if (or (eq ido-cur-item 'dir)
                               (eq last-command this-command))
                           t
                         (setq ido-show-confirm-message t)
                         nil))
                   (ido-existing-item-p))
               (not ido-incomplete-regexp))
      (when ido-current-directory
        (setq ido-exit 'takeprompt)
        (unless (and ido-text (= 0 (length ido-text)))
          (let ((match (ido-name (car ido-matches))))
            (throw 'ido
                   (setq ido-selected
                         (if match
                             (replace-regexp-in-string "/\\'" "" match)
                           ido-text)
                         ido-text ido-selected
                         ido-final-text ido-text)))))
      (exit-minibuffer)))
  
  (eval-after-load "ido"
    '(define-key ido-common-completion-map "\C-m" 'ido-smart-select-text))


  reply	other threads:[~2015-12-26 23:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-26 23:19 ido-find-file Sam Halliday
2015-12-26 23:27 ` Sam Halliday [this message]
2015-12-26 23:48   ` ido-find-file Sam Halliday
2015-12-26 23:51     ` ido-find-file Sam Halliday
2015-12-27  0:00     ` ido-find-file Sam Halliday
2015-12-26 23:35 ` ido-find-file Dmitry Gutov

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=32558752-9f6e-45ea-b953-099d8fc5daf7@googlegroups.com \
    --to=sam.halliday@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).