emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/company ff6107bde3 04/30: company-inhibit-inside-symbol


From: ELPA Syncer
Subject: [elpa] externals/company ff6107bde3 04/30: company-inhibit-inside-symbols: New option
Date: Sat, 13 Jul 2024 00:57:49 -0400 (EDT)

branch: externals/company
commit ff6107bde343d9c16ae4cad3847af3705ea1c09c
Author: Dmitry Gutov <dmitry@gutov.dev>
Commit: Dmitry Gutov <dmitry@gutov.dev>

    company-inhibit-inside-symbols: New option
---
 NEWS.md    |  2 ++
 company.el | 13 ++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/NEWS.md b/NEWS.md
index 699d404ca3..fc883bc254 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -4,6 +4,8 @@
 
 * Completion works inside symbols
   (#[340](https://github.com/company-mode/company-mode/issues/340)).
+* New user option `company-inhibit-inside-symbols`. Set it to `t` to switch
+  closer to the previous behavior.
 * `company-elisp` has been removed.  It's not needed since Emacs 24.4, with all
   of its features having been incorporated into the built-in Elisp completion.
 * `company-files` shows shorter completions.  Previously, the popup spanned
diff --git a/company.el b/company.el
index b04ec86976..d62ae5c56a 100644
--- a/company.el
+++ b/company.el
@@ -674,6 +674,14 @@ happens.  The value of nil means no idle completion."
                  (const :tag "immediate (0)" 0)
                  (number :tag "seconds")))
 
+(defcustom company-inhibit-inside-symbols nil
+  "Non-nil to inhibit idle completion when typing in the middle of a symbol.
+The symbol is in a generalized sense, indicated by the `prefix' backend
+action returning a non-empty SUFFIX element.  When this variable is
+non-nil, completion inside symbol will onlytriggered by an explicit command
+invocation, such as \\[company-complete-common]."
+  :type 'boolean)
+
 (defcustom company-begin-commands '(self-insert-command
                                     org-self-insert-command
                                     orgtbl-self-insert-command
@@ -2289,7 +2297,10 @@ For more details see `company-insertion-on-trigger' and
                     (company-call-backend 'prefix)))
               (company--multi-backend-adapter backend 'prefix)))
       (when entity
-        (when (company--good-prefix-p entity min-prefix)
+        (when (and (company--good-prefix-p entity min-prefix)
+                   (or (not company-inhibit-inside-symbols)
+                       company--manual-action
+                       (zerop (length (company--suffix-str entity)))))
           (let ((ignore-case (company-call-backend 'ignore-case)))
             ;; Keep this undocumented, esp. while only 1 backend needs it.
             (company-call-backend 'set-min-prefix min-prefix)



reply via email to

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