emacs-diffs
[Top][All Lists]
Advanced

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

master f1794a17b62: New user option 'completion-preview-ignore-case'


From: Eshel Yaron
Subject: master f1794a17b62: New user option 'completion-preview-ignore-case'
Date: Tue, 17 Sep 2024 14:51:04 -0400 (EDT)

branch: master
commit f1794a17b629f8ad2a85dbf9877e17dcdd9b9ee7
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>

    New user option 'completion-preview-ignore-case'
    
    Completion Preview mode implicitly assumed that
    'completion-ignore-case' is nil, and while it can also work
    with 'completion-ignore-case' non-nil, the results are a bit
    different than what you get with 'completion-at-point'.  Add
    an option that controls case sensitivity explicitly and
    specifically for Completion Preview mode, and clarify the
    behavior when case differences are ignored.  (Bug#73234)
    
    * lisp/completion-preview.el
    (completion-preview-ignore-case): New user option.
---
 lisp/completion-preview.el | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el
index fd55a1009f6..d379b3a1fa6 100644
--- a/lisp/completion-preview.el
+++ b/lisp/completion-preview.el
@@ -173,6 +173,24 @@ If this is nil, display the completion preview without 
delay."
                  (const :tag "No delay" nil))
   :version "30.1")
 
+(defcustom completion-preview-ignore-case nil
+  "Whether Completion Preview mode ignores case differences.
+
+By default this option is nil, which says that case is significant, so a
+completion candidate \"FooBar\" matches prefix \"Foo\", but not \"foo\".
+If you set it to non-nil, then Completion Preview mode also suggests
+completions that differ in case from the prefix that you type; for
+example, it may suggest completing \"foo\" with the suffix \"Bar\" when
+there's an available completion candidate \"FooBar\".  Note that in this
+case, when you insert the completion (with `completion-preview-insert'),
+Completion Preview mode does not update the completed prefix according
+to the capitalization of the completion candidate, instead it simply
+ignores such case differences, so the resulting string is \"fooBar\".
+
+See also `completion-ignore-case'."
+  :type 'boolean
+  :version "31.1")
+
 (defvar completion-preview-sort-function #'minibuffer--sort-by-length-alpha
   "Sort function to use for choosing a completion candidate to preview.")
 
@@ -345,6 +363,7 @@ candidates or if there are multiple matching completions and
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   (let* ((pred (plist-get props :predicate))
          (string (buffer-substring beg end))
+         (completion-ignore-case completion-preview-ignore-case)
          (md (completion-metadata string table pred))
          (sort-fn (or (completion-metadata-get md 'cycle-sort-function)
                       (completion-metadata-get md 'display-sort-function)



reply via email to

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