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

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

[nongnu] elpa/bash-completion 5171866b65 180/313: Simplify options a bit


From: ELPA Syncer
Subject: [nongnu] elpa/bash-completion 5171866b65 180/313: Simplify options a bit, since the only useful option is nospace.
Date: Sat, 3 Dec 2022 10:59:28 -0500 (EST)

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

    Simplify options a bit, since the only useful option is nospace.
---
 bash-completion.el | 45 +++++++++------------------------------------
 1 file changed, 9 insertions(+), 36 deletions(-)

diff --git a/bash-completion.el b/bash-completion.el
index d1e2c122ce..36a82d93b3 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -250,13 +250,6 @@ completion in colon-separated values.")
   (append bash-completion-wordbreaks-str nil)
   "`bash-completion-wordbreaks-str' as a list of characters.")
 
-(defconst bash-completion--default-option-strings
-  '("filenames")
-  "Compgen for command, default and wordbreak completions.
-
-`bash-completion--parse-options' is applied to it at runtime, to
-allow customization of these options.")
-
 (defconst bash-completion-special-chars "[^-0-9a-zA-Z_./\n=]"
   "Regexp of characters that must be escaped or quoted.")
 
@@ -319,7 +312,7 @@ See options definition in
    (if (eq (bash-completion--type comp) 'custom)
        (bash-completion--extract-compgen-options
         (bash-completion--compgen-args comp))
-     bash-completion--default-option-strings)))
+     nil)))
 
 ;;; ---------- Inline functions
 
@@ -471,8 +464,7 @@ This function is not meant to be called outside of
             pos
             (bash-completion--default-completion
              after-wordbreak unparsed-after-wordbreak
-             open-quote (bash-completion--parse-options
-                         bash-completion--default-option-strings))))))
+             open-quote (bash-completion--parse-options nil))))))
 
 (defun bash-completion--find-last (elt array)
   "Return the position of the last intance of ELT in array or nil."
@@ -1344,32 +1336,13 @@ Return the status code of the command, as a number."
 (defun bash-completion--parse-options (option-strings)
   "Parse OPTIONS-STRINGS for compgen into a list of symbols.
 
-Supported options and compgen option equivalent:
- 'nospace: -o nospace"
-  (let ((options))
-    (if (bash-completion--check-option
-         option-strings
-         "nospace" bash-completion-nospace)
-        (push 'nospace options))
-    options))
-
-(defun bash-completion--check-option
-    (option-strings option-name customize-option)
-  "Return t if the option should be enabled.
-
-OPTION-STRINGS is a list of compgen option strings, often
-generated by `bash-completion--extract-compgen-options'
-
-OPTION-NAME is a string that correspond to the option to check,
-what follows -o.
-
-CUSTOMIZE-OPTION is a customized value, which is either
-'as-configured, to take the option from OPTION-STRINGS, t, to
-force it to be always enabled, or nil, to force it to be always
-disabled."
-  (if (eq 'as-configured customize-option)
-      (member option-name option-strings)
-    customize-option))
+The only supported option is nospace, which might come from
+compgen options or from `bash-completion-nospace'"
+  (if (if (eq 'as-configured bash-completion-nospace)
+          (member "nospace" option-strings)
+        bash-completion-nospace)
+      '(nospace)
+    nil))
 
 (provide 'bash-completion)
 ;;; bash-completion.el ends here



reply via email to

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