]> git.eshelyaron.com Git - emacs.git/commitdiff
New command 'minibuffer-toggle-completion-ignore-case'
authorEshel Yaron <me@eshelyaron.com>
Fri, 2 Feb 2024 18:03:21 +0000 (19:03 +0100)
committerEshel Yaron <me@eshelyaron.com>
Fri, 2 Feb 2024 18:03:21 +0000 (19:03 +0100)
* lisp/minibuffer.el (completion-all-sorted-completions): New command.
(minibuffer-local-completion-map): Bind it to 'C-A'.

* doc/emacs/mini.texi (Completion Commands):
* doc/lispref/minibuf.texi (Completion Commands): Document it.

* etc/NEWS: Announce it.

doc/emacs/mini.texi
doc/lispref/minibuf.texi
etc/NEWS
lisp/minibuffer.el

index 9c13bc3a557db2e809ec033f1beaf47e165b4940..89f563ac17a09ad6918fad7066640a5654a27b65 100644 (file)
@@ -365,6 +365,9 @@ Cycle minibuffer input among possible completion candidates
 Restore the minibuffer input that Emacs used to compute the current
 set of completion candidates
 (@code{minibuffer-restore-completion-input}).
+@item C-A
+Toggle completion case-sensitivity for the current minibuffer
+(@code{minibuffer-toggle-completion-ignore-case}).
 @item C-x C-v
 Change the order of the list of possible completions
 (@code{minibuffer-sort-completions}).
@@ -443,6 +446,14 @@ For example, if you type @kbd{M-x bar} and start cycling with
 the minibuffer input to @samp{bar}, change it to @samp{baz} and
 complete again.
 
+@kindex C-A @r{(completion)}
+@kindex C-S-a @r{(completion)}
+@findex minibuffer-toggle-completion-ignore-case
+  @kbd{C-A} (@code{minibuffer-toggle-completion-ignore-case}) toggles
+completion case-sensitivity for the current minibuffer.  If completion
+is currently case-sensitive, after typing @kbd{C-A} it becomes
+case-insensitive, and vice versa.
+
 @anchor{Sort Completions}
 @cindex sort completions
 @cindex completions sort order
index eff81be37cff5f7cec80f37ac42fd5f8de75ac66..86fe44b90dc519bfacab25a7dd3d961c0c061f2b 100644 (file)
@@ -1342,6 +1342,12 @@ This function restores the last input that a completion command, such
 as @code{minibuffer-complete}, expanded in the current minibuffer.
 @end deffn
 
+@deffn Command minibuffer-toggle-completion-ignore-case
+This function toggles the completion case-sensitivity for the current
+minibuffer.  This works by setting the buffer-local value of
+@code{completion-ignore-case}.  @xref{Basic Completion}.
+@end deffn
+
 @deffn Command minibuffer-complete-and-exit
 This function completes the minibuffer contents, and exits if
 confirmation is not required, i.e., if
@@ -1468,6 +1474,9 @@ keymap makes the following bindings:
 @item C-l
 @code{minibuffer-restore-completion-input}
 
+@item C-A
+@code{minibuffer-toggle-completion-ignore-case}
+
 @item C-x C-v
 @code{minibuffer-sort-completions}
 
index 6d280aa2fde0290c32aee487365b40073fab0c89..b2cd80b15057d74611fbccc147f1d49c256abb4c 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -821,10 +821,15 @@ of 'completion-cycle-threshold' and the number of completion
 candidates.
 
 +++
-*** New command 'minibuffer-restore-completion-input.
+*** New command 'minibuffer-restore-completion-input'.
 This command, bound to 'C-l' in the minibuffer, restores the (partial)
 input that you last used for completion in the current minibuffer.
 
++++
+*** New command 'minibuffer-toggle-completion-ignore-case'.
+This command, bound to 'C-A' in the minibuffer, toggles completion
+case-sensitivity for the current minibuffer.
+
 *** New minor mode 'completions-auto-update-mode'.
 This global minor mode automatically updates the *Completions* buffer
 as you type in the minibuffer.
index 34d46c65b436fb093b0fa42829ed81235fe57326..b33c3ece11edc57c8eec005b3b95e0cf34bc6a5e 100644 (file)
@@ -1928,6 +1928,13 @@ include as `display-sort-function' in completion metadata."
           (completion--cache-all-sorted-completions
            start end (nconc all base-size))))))
 
+(defun minibuffer-toggle-completion-ignore-case ()
+  "Toggle completion case-sensitively for the current minibuffer."
+  (interactive "" minibuffer-mode)
+  (setq-local completion-ignore-case (not completion-ignore-case))
+  (minibuffer-message "Completion is now case-%ssensitive"
+                      (if completion-ignore-case "in" "")))
+
 (defun minibuffer-force-complete-and-exit ()
   "Exit the minibuffer with the first matching completion.
 
@@ -3456,6 +3463,7 @@ The completion method is determined by `completion-at-point-functions'."
   "<backtab>" #'minibuffer-complete
   "C-o"       #'minibuffer-cycle-completion
   "C-l"       #'minibuffer-restore-completion-input
+  "C-S-a"     #'minibuffer-toggle-completion-ignore-case
   "SPC"       #'minibuffer-complete-word
   "?"         #'minibuffer-completion-help
   "<prior>"   #'switch-to-completions