* Ido: let C-d open a dired buffer for commands other than ido-find-file
@ 2021-02-22 18:20 Andrea Greselin
0 siblings, 0 replies; only message in thread
From: Andrea Greselin @ 2021-02-22 18:20 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
Hi everyone,
I use ‘(setq ido-everywhere t)’, so ‘find-file-at-point’ uses Ido's
completion. I'd like ‘ido-magic-delete-char’ (C-d) to open the
candidate directory in a Dired buffer, like it does when entering Ido
with ‘ido-find-file’, also for ‘find-file-at-point’.
Here's the (abridged) definition of ‘ido-magic-delete-char’:
(defun ido-magic-delete-char (arg)
…
(cond
((or arg (not (eobp)))
(delete-char (min (prefix-numeric-value arg)
(- (point-max) (point)))))
(ido-context-switch-command
nil)
((memq ido-cur-item '(file dir))
(ido-enter-dired))))
The problem lies in the fact that ‘ido-context-switch-command’ is
always non-nil when I hit C-d from a ‘find-file-at-point’ prompt, and
so the second condition kicks in in place of ‘ido-enter-dired’.
I know I could use something like this
(define-advice ido-magic-delete-char
(:around (orig-fn &rest args) dired-everywhere)
"Let ‘ido-magic-delete-char’ open ‘dired’ in the candidate
directory."
(let ((ido-context-switch-command nil))
(apply orig-fn args)))
but I don't know the workings of ‘ido-context-switch-command’ and
‘ido-cur-item’ so now I wonder what could go wrong with this thing.
Can you tell me if there are contraindication with it?
Andrea
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-02-22 18:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-22 18:20 Ido: let C-d open a dired buffer for commands other than ido-find-file Andrea Greselin
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.