Skip to content

Commit 213643a

Browse files
committed
Document fido-mode
* doc/emacs/buffers.texi (Icomplete): Document Fido Mode. * etc/NEWS: Mention Fido Mode. * lisp/icomplete.el (icomplete-mode): Ensure fido-mode is off. (fido-mode): Ensure icomplete-mode is off. (icomplete-magic-ido-ret): Don't force completions if no completions.
1 parent e1d24f3 commit 213643a

File tree

3 files changed

+36
-7
lines changed

3 files changed

+36
-7
lines changed

doc/emacs/buffers.texi

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,22 @@ of directories.
725725
the variable @code{icomplete-mode} to @code{t} (@pxref{Easy
726726
Customization}).
727727

728+
@findex fido-mode
729+
@cindex fido mode
730+
731+
An alternative to Icomplete mode is Fido mode. This is very similar
732+
to Icomplete mode, but retains some functionality from a popular
733+
extension called Ido mode (in fact the name is derived from ``Fake
734+
Ido''). Among other things, in Fido mode, @kbd{C-s} and @kbd{C-r} are
735+
also used to rotate the completions list, @kbd{C-k} can be used to
736+
delete files and kill buffers in-list. Another noteworthy aspect is
737+
that @code{flex} is used as the default completion style
738+
(@pxref{Completion Styles}).
739+
740+
To enable Fido mode, type @kbd{M-x fido-mode}, or customize
741+
the variable @code{fido-mode} to @code{t} (@pxref{Easy
742+
Customization}).
743+
728744
@node Buffer Menus
729745
@subsection Customizing Buffer Menus
730746

etc/NEWS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,15 @@ A new command 'xref-revert-buffer' is bound to 'g'.
11921192
---
11931193
*** Imenu support has been added to 'xref--xref-buffer-mode'.
11941194

1195+
** Icomplete
1196+
1197+
+++
1198+
*** A new minor mode based on Icomplete, Fido mode, is made available.
1199+
The point of this mode, named after "Fake Ido", is to recover much of
1200+
the functionality that still separated the popular ido-mode from
1201+
Icomplete, while still cooperating fully with all of Emacs's
1202+
completion facilities.
1203+
11951204
** Ecomplete
11961205

11971206
*** The ecomplete sorting has changed to a decay-based algorithm.

lisp/icomplete.el

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,20 +273,22 @@ require user confirmation."
273273
(exit-minibuffer))))
274274

275275
(defun icomplete-magic-ido-ret ()
276-
"Exit forcing completion or enter directory, like `ido-mode'."
276+
"Exit minibuffer or enter directory, like `ido-mode'."
277277
(interactive)
278278
(let* ((beg (icomplete--field-beg))
279279
(md (completion--field-metadata beg))
280280
(category (alist-get 'category (cdr md)))
281281
(dir (and (eq category 'file)
282282
(file-name-directory (icomplete--field-string))))
283-
(current (and dir
284-
(car (completion-all-sorted-completions))))
285-
(probe (and current
283+
(current (car (completion-all-sorted-completions)))
284+
(probe (and dir current
286285
(expand-file-name (directory-file-name current) dir))))
287-
(if (and probe (file-directory-p probe) (not (string= current "./")))
288-
(icomplete-force-complete)
289-
(icomplete-force-complete-and-exit))))
286+
(cond ((and probe (file-directory-p probe) (not (string= current "./")))
287+
(icomplete-force-complete))
288+
(current
289+
(icomplete-force-complete-and-exit))
290+
(t
291+
(exit-minibuffer)))))
290292

291293
(defun icomplete-magic-ido-backward-updir ()
292294
"Delete char before or go up directory, like `ido-mode'."
@@ -330,6 +332,7 @@ more like `ido-mode' than regular `icomplete-mode'."
330332
(remove-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup)
331333
(remove-hook 'minibuffer-setup-hook #'icomplete--fido-mode-setup)
332334
(when fido-mode
335+
(icomplete-mode -1)
333336
(setq icomplete-mode t)
334337
(add-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup)
335338
(add-hook 'minibuffer-setup-hook #'icomplete--fido-mode-setup)))
@@ -355,6 +358,7 @@ completions:
355358
(remove-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup)
356359
(remove-hook 'completion-in-region-mode-hook #'icomplete--in-region-setup)
357360
(when icomplete-mode
361+
(fido-mode -1)
358362
(when icomplete-in-buffer
359363
(add-hook 'completion-in-region-mode-hook #'icomplete--in-region-setup))
360364
(add-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup)))

0 commit comments

Comments
 (0)