emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/fido-mode 2b0f589: Document fido-mode


From: Joo Tvora
Subject: scratch/fido-mode 2b0f589: Document fido-mode
Date: Tue, 5 Nov 2019 13:05:03 -0500 (EST)

branch: scratch/fido-mode
commit 2b0f589134d9427a96ab8cf0d8473715740984ef
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    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.
---
 doc/emacs/buffers.texi | 16 ++++++++++++++++
 etc/NEWS               |  9 +++++++++
 lisp/icomplete.el      | 18 +++++++++++-------
 3 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi
index 74e6211..b5a1741 100644
--- a/doc/emacs/buffers.texi
+++ b/doc/emacs/buffers.texi
@@ -725,6 +725,22 @@ of directories.
 the variable @code{icomplete-mode} to @code{t} (@pxref{Easy
 Customization}).
 
+@findex fido-mode
+@cindex fido mode
+
+  An alternative to Icomplete mode is Fido mode.  This is very similar
+to Icomplete mode, but retains some functionality from a popular
+extension called Ido mode (in fact the name is derived from ``Fake
+Ido'').  Among other things, in Fido mode, @kbd{C-s} and @kbd{C-r} are
+also used to rotate the completions list, @kbd{C-k} can be used to
+delete files and kill buffers in-list.  Another noteworthy aspect is
+that @code{flex} is used as the default completion style
+(@pxref{Completion Styles}).
+
+  To enable Fido mode, type @kbd{M-x fido-mode}, or customize
+the variable @code{fido-mode} to @code{t} (@pxref{Easy
+Customization}).
+
 @node Buffer Menus
 @subsection Customizing Buffer Menus
 
diff --git a/etc/NEWS b/etc/NEWS
index 033cb48..78ec85c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1181,6 +1181,15 @@ A new command 'xref-revert-buffer' is bound to 'g'.
 ---
 *** Imenu support has been added to 'xref--xref-buffer-mode'.
 
+** Icomplete
+
++++
+*** A new minor mode based on Icomplete, Fido mode, is made available.
+The point of this mode, named after "Fake Ido", is to recover much of
+the functionality that still separated the popular ido-mode from
+Icomplete, while still cooperating fully with all of Emacs's
+completion facilities.
+
 ** Ecomplete
 
 *** The ecomplete sorting has changed to a decay-based algorithm.
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 777fdce..40f4f0b 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -273,20 +273,22 @@ require user confirmation."
       (exit-minibuffer))))
 
 (defun icomplete-magic-ido-ret ()
-  "Exit forcing completion or enter directory, like `ido-mode'."
+  "Exit minibuffer or enter directory, like `ido-mode'."
   (interactive)
   (let* ((beg (icomplete--field-beg))
          (md (completion--field-metadata beg))
          (category (alist-get 'category (cdr md)))
          (dir (and (eq category 'file)
                    (file-name-directory (icomplete--field-string))))
-         (current (and dir
-                       (car (completion-all-sorted-completions))))
-         (probe (and current
+         (current (car (completion-all-sorted-completions)))
+         (probe (and dir current
                      (expand-file-name (directory-file-name current) dir))))
-    (if (and probe (file-directory-p probe) (not (string= current "./")))
-        (icomplete-force-complete)
-      (icomplete-force-complete-and-exit))))
+    (cond ((and probe (file-directory-p probe) (not (string= current "./")))
+           (icomplete-force-complete))
+          (current
+           (icomplete-force-complete-and-exit))
+          (t
+           (exit-minibuffer)))))
 
 (defun icomplete-magic-ido-backward-updir ()
   "Delete char before or go up directory, like `ido-mode'."
@@ -330,6 +332,7 @@ more like `ido-mode' than regular `icomplete-mode'."
   (remove-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup)
   (remove-hook 'minibuffer-setup-hook #'icomplete--fido-mode-setup)
   (when fido-mode
+    (icomplete-mode -1)
     (setq icomplete-mode t)
     (add-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup)
     (add-hook 'minibuffer-setup-hook #'icomplete--fido-mode-setup)))
@@ -355,6 +358,7 @@ completions:
   (remove-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup)
   (remove-hook 'completion-in-region-mode-hook #'icomplete--in-region-setup)
   (when icomplete-mode
+    (fido-mode -1)
     (when icomplete-in-buffer
       (add-hook 'completion-in-region-mode-hook #'icomplete--in-region-setup))
     (add-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]