[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 65e54c6f9c 307/313: Temporarily revert fix
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 65e54c6f9c 307/313: Temporarily revert fixes for issue #44. |
Date: |
Sat, 3 Dec 2022 10:59:40 -0500 (EST) |
branch: elpa/bash-completion
commit 65e54c6f9c0ffebf94f7c505694bd249b9b53d32
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
Temporarily revert fixes for issue #44.
Reverting the changes that causes test failures on gihtub action as I'll
need some time to reproduce and fix them.
This reverts commits:
d550256 master origin/master Disable flakey test for now.
ca4fbce Turn off bash completion when non-bash prompts are detected.
fd85366 Detect non-responsive processes more quickly.
---
bash-completion.el | 87 +++++++-------------------------
test/bash-completion-integration-test.el | 18 +++----
test/bash-completion-test.el | 9 ++--
3 files changed, 28 insertions(+), 86 deletions(-)
diff --git a/bash-completion.el b/bash-completion.el
index 4b888e658f..5c391b9190 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -179,11 +179,11 @@ explanation."
:type '(repeat (string :tag "Argument"))
:group 'bash-completion)
-(defcustom bash-completion-process-timeout 0.5
+(defcustom bash-completion-process-timeout 2.5
"Number of seconds to wait for an answer from bash.
-This doesn't include the time it takes to execute an actual
-completion command, which is set by `bash-completion-command-timeout'."
+If bash takes longer than that to answer, the answer will be
+ignored."
:type '(float)
:group 'bash-completion)
@@ -234,30 +234,6 @@ to remove the extra space bash adds after a completion."
:type '(boolean)
:group 'bash-completion)
-(defcustom bash-completion-bash-prompts nil
- "Regexps that match BASH prompts (PS1).
-
-If a prompt matches one of the regular expression on this list,
-it'll be considered a bash prompt even if it matches one of the
-regular expressions in `bash-completion-nonbash-prompts'.
-
-See `bash-completion-nonbash-prompts' for more details."
- :type '(repeat string)
- :group 'bash-completion)
-
-(defcustom bash-completion-nonbash-prompts '("[>+] +$")
- "Regexps that match non-BASH prompts and BASH PS2 prompts.
-
-If a prompt matches one of the regular expressions on this list,
-`bash-completion-dynamic-complete' doesn't attempt to communicate
-with the current BASH process to do completion.
-
-If your BASH prompt matches one of the regexps on this list, you
-might want to put a regexp for it in
-`bash-completion-bash-prompts'."
- :type '(repeat string)
- :group 'bash-completion)
-
(defvar bash-completion-start-files
'("~/.emacs_bash.sh" "~/.emacs.d/init_bash.sh")
"Shell files that, if they exist, will be sourced at the beginning of a bash
completion subprocess.
@@ -504,27 +480,13 @@ When doing completion outside of a comint buffer, call
(if (and (not (window-minibuffer-p))
(not (null bash-completion-message-delay)))
(run-at-time
- bash-completion-message-delay nil
- (lambda () (message "Bash completion..."))))))
+ bash-completion-message-delay nil
+ (lambda () (message "Bash completion..."))))))
(unwind-protect
- (let ((prompt-end (comint-line-beginning-position)))
- (if (or bash-completion-use-separate-processes
- (let* ((prompt-start (save-excursion
- (goto-char prompt-end)
- (line-end-position -1)))
- (prompt (buffer-substring-no-properties
- prompt-start prompt-end)))
- (or
- (bash-completion--match-any
- prompt bash-completion-bash-prompts)
- (not (bash-completion--match-any
- prompt bash-completion-nonbash-prompts)))))
- (bash-completion-dynamic-complete-nocomint
- prompt-end (point) 'dynamic-table)
-
- (error (concat "Bash completion not available. "
- "Call M-x customize-option
bash-completion-nonbash-prompts "
- "if this is incorrect."))))
+ (bash-completion-dynamic-complete-nocomint
+ (comint-line-beginning-position)
+ (point)
+ 'dynamic-table)
;; cleanup
(if message-timer
(cancel-timer message-timer)))))
@@ -1544,10 +1506,8 @@ Return the status code of the command, as a number."
(send-string (if bash-completion-use-separate-processes
#'process-send-string
#'comint-send-string))
- (pre-command (concat
- "echo bash\\-completion:; "
- (unless bash-completion-use-separate-processes
- "__emacs_complete_pre_command; ")))
+ (pre-command (unless bash-completion-use-separate-processes
+ "__emacs_complete_pre_command; "))
(complete-command (concat pre-command commandline "\n")))
(setq bash-completion--debug-info
(list (cons 'commandline complete-command)
@@ -1557,24 +1517,17 @@ Return the status code of the command, as a number."
(with-current-buffer (bash-completion--get-buffer process)
(erase-buffer)
(funcall send-string process complete-command)
- ;; Wait for 'echo bash\-completion' to be executed within
- ;; bash-completion-process-timeout. This takes care of any
- ;; command-line echo as well.
- (unless (bash-completion--wait-for-regexp process "bash-completion:"
bash-completion-process-timeout)
- (push (cons 'error "non-bash") bash-completion--debug-info)
- (push (cons 'buffer-string (buffer-substring-no-properties (point-min)
(point-max)))
- bash-completion--debug-info)
- (error "Not a bash process. Fix using M-x customize-option
bash-completion-nonbash-prompts"))
- (delete-region (point-min) (1+ (match-end 0)))
- (goto-char (point-max))
- ;; Now wait for the real to be executed within timeout. This can
- ;; take a while for some completion commands.
(unless (bash-completion--wait-for-regexp process "\t-?[[:digit:]]+\v"
timeout)
-
(push (cons 'error "timeout") bash-completion--debug-info)
(push (cons 'buffer-string (buffer-substring-no-properties (point-min)
(point-max)))
bash-completion--debug-info)
(error "Bash completion failed. M-x bash-completion-debug for
details."))
+ (when pre-command
+ ;; Detect the command having been echoed and remove it
+ (save-excursion
+ (goto-char (point-min))
+ (when (looking-at pre-command)
+ (delete-region (match-beginning 0) (line-beginning-position 2)))))
(let ((status (string-to-number
(buffer-substring-no-properties
(1+ (point))
@@ -1717,12 +1670,6 @@ Return the parsed value, as a string or nil."
(prog1 (match-string 1)
(delete-region (match-beginning 0) (match-end 0)))))))
-(defun bash-completion--match-any (text regexp-list)
- (catch 'bash-completion-return
- (dolist (regexp regexp-list)
- (when (string-match-p regexp text)
- (throw 'bash-completion-return t)))))
-
(defun bash-completion--completion-table-with-cache (comp process)
"Build a dynamic completion table for COMP using PROCESS.
diff --git a/test/bash-completion-integration-test.el
b/test/bash-completion-integration-test.el
index 11255fcdd2..3b74105d85 100644
--- a/test/bash-completion-integration-test.el
+++ b/test/bash-completion-integration-test.el
@@ -568,17 +568,13 @@ other
4 history
$ ")))))
-;; Test has become flakey; likely some error message is shown when in
-;; a non-existent directory that brakes completion. The test should be
-;; fixed.
-;;
-;; (ert-deftest bash-completion-integration-bad-directory-tracking ()
-;; "When using single-process, bad directory tracking shouldn't be a
problem."
-;; (bash-completion_test-with-shell-harness
-;; "" ; .bashrc
-;; nil ; use-separate-process
-;; (let ((default-directory "/does-not-exist/"))
-;; (should (equal "ls some/" (bash-completion_test-complete "ls so"))))))
+(ert-deftest bash-completion-integration-bad-directory-tracking ()
+ "When using single-process, bad directory tracking shouldn't be a problem."
+ (bash-completion_test-with-shell-harness
+ "" ; .bashrc
+ nil ; use-separate-process
+ (let ((default-directory "/does-not-exist/"))
+ (should (equal "ls some/" (bash-completion_test-complete "ls so"))))))
(ert-deftest bash-completion-integration-caching ()
"Make sure caching works and that completion is only executed once."
diff --git a/test/bash-completion-test.el b/test/bash-completion-test.el
index 061eef7ca8..bbe7cd56f6 100644
--- a/test/bash-completion-test.el
+++ b/test/bash-completion-test.el
@@ -519,16 +519,15 @@ Return (const return-value new-buffer-content)"
(lambda (process command)
(unless (eq process 'process)
(error "unexpected process: %s" process))
- (unless (equal command "echo bash\\-completion:; cmd\n")
+ (unless (equal "cmd\n" command)
(error "unexpected command: %s" command))))
((symbol-function 'accept-process-output)
(lambda (process timeout &optional millisec just-this-one)
(unless (eq process 'process)
(error "unexpected process: %s" process))
- (cond ((= timeout 3.14) (insert buffer-content))
- ((= timeout bash-completion-process-timeout)
- (insert "bash-completion:\n"))
- (t (error "unexpected timeout: %s" timeout)))
+ (unless (= timeout 3.14)
+ (error "unexpected timeout: %s" timeout))
+ (insert buffer-content)
t)))
(bash-completion-test-with-buffer
""
- [nongnu] elpa/bash-completion 18ed1504ce 274/313: Add test cases for TRAMP shell., (continued)
- [nongnu] elpa/bash-completion 18ed1504ce 274/313: Add test cases for TRAMP shell., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 23dbe5b537 276/313: Change minimum supported Emacs version from 24.1 to 24.3., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c3797e0d09 277/313: Avoid running the same completion multiple times., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 0210d346f1 279/313: Make bash-completion-use-separate-processes default to nil., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7a1f127851 292/313: Test and fix the dynamic table function that's returned., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3dbbd1beff 293/313: Fix tests to run under Emacs 24.3., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion d47edb9d41 294/313: Bump version to 3.1, a bugfix release., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion faefaf6950 298/313: Add command M-x bash-completion-debug, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion fa5557709e 300/313: GitHub Actions now runs tests on Emacs 27.1., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion fd853663ee 304/313: Detect non-responsive processes more quickly., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 65e54c6f9c 307/313: Temporarily revert fixes for issue #44.,
ELPA Syncer <=
- [nongnu] elpa/bash-completion d9c97b741d 309/313: Attempt to fix automated tests., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 29b5fc860a 312/313: Shorten overly long docstring (#53), ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3ffc296e0b 149/313: Close opened quote for all completion candidate that don't end with a, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 6bf1536325 150/313: Fix occasional escaping issue with candidates containing quotes., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7ce100b7eb 006/313: cursor position, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 21149fdc27 152/313: Introduce the variable bash-completion-start-files, that allow, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 31bc1c1c21 161/313: Compile bash-completion.el before running tests., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 054ecdfce3 290/313: ignore file ert-profile created by ert-runner, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c444230670 154/313: Add run_tests.sh, to run tests from the command-line, with specific, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 0709a9803d 303/313: Support newlines in the output of complete -p., ELPA Syncer, 2022/12/03