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

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

[nongnu] elpa/bash-completion 0c77c64b50 174/313: Disable bash-completio


From: ELPA Syncer
Subject: [nongnu] elpa/bash-completion 0c77c64b50 174/313: Disable bash-completion-enable-caching if completion-table-with-cache
Date: Sat, 3 Dec 2022 10:59:28 -0500 (EST)

branch: elpa/bash-completion
commit 0c77c64b50f5241630d42a0e4b90fa0d7fccdd3e
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>

    Disable bash-completion-enable-caching if completion-table-with-cache
    is unavailable, such as on Emacs 24.1.
    
    Fallback to completion-table-dynamic in that case, to allow
    byte-compilation to work without errors.
---
 bash-completion.el | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/bash-completion.el b/bash-completion.el
index b3ee3ff259..a742d5ab18 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -202,8 +202,9 @@ to remove the extra space bash adds after a completion."
   :type 'boolean
   :group 'bash-completion)
 
-(defcustom bash-completion-enable-caching nil
-  "If non-nil, enable caching in `bash-completion-dynamic-complete-nocomint'.
+(if (fboundp 'completion-table-with-cache)
+    (defcustom bash-completion-enable-caching nil
+      "If non-nil, enable caching in 
`bash-completion-dynamic-complete-nocomint'.
 
 When caching is enabled,
 `bash-completion-dynamic-complete-nocomint' returns a function
@@ -212,8 +213,13 @@ improves performance because less calls will be made to
 `bash-completion-comm' which is an expensive function but it has
 one downside: wordbreak completion will not be attempted when a
 compspec returns no matches."
-  :type 'boolean
-  :group 'bash-completion)
+        :type 'boolean
+        :group 'bash-completion)
+  (defconst bash-completion-enable-caching nil))
+
+(defalias 'bash-completion--completion-table-with-cache
+  (if (fboundp 'completion-table-with-cache)
+      'completion-table-with-cache 'completion-table-dynamic))
 
 (defvar bash-completion-start-files
   '("~/.emacs_bash.sh" "~/.emacs.d/init_bash.sh")
@@ -370,7 +376,7 @@ Returns (list stub-start stub-end completions) with
           (list
            stub-start
            comp-pos
-           (completion-table-with-cache
+           (bash-completion--completion-table-with-cache
             (lambda (_)
               (bash-completion-comm line point words cword open-quote
                                     unparsed-stub))))



reply via email to

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