[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 318e32979f 135/313: Display completion pro
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 318e32979f 135/313: Display completion progress message only if completion takes too long. |
Date: |
Sat, 3 Dec 2022 10:59:24 -0500 (EST) |
branch: elpa/bash-completion
commit 318e32979fab4e1fcb4fdf400af0e30148544951
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
Display completion progress message only if completion takes too long.
issue #12
bash-completion-message-delay now controls when an whether the message
"Bash Completion..." is displayed:
- if it a number, only display it if completion takes longer than
that much time, in seconds.
- if it is 0, always display it
- if it is nil, never display it
The default is to display it if completion takes longer than 400ms.
---
bash-completion.el | 58 +++++++++++++++++++++++++++++++++++-------------------
1 file changed, 38 insertions(+), 20 deletions(-)
diff --git a/bash-completion.el b/bash-completion.el
index cefdc2f420..61d81b3897 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -178,6 +178,16 @@ ignored."
:type '(float)
:group 'bash-completion)
+(defcustom bash-completion-message-delay 0.4
+ "Time to wait before displaying a message while waiting for results.
+
+If completion takes longer than that time, a message is displayed
+on the minibuffer to make it clear what's happening. Set to nil
+to never display any such message. 0 to always display it.
+
+Only relevant when using bash completion in a shell, through
+`bash-completion-dynamic-complete'.")
+
(defcustom bash-completion-initial-timeout 30
"Timeout value to apply when talking to bash for the first time.
The first thing bash is supposed to do is process /etc/bash_complete,
@@ -299,26 +309,34 @@ nil if no completions available.
When doing completion outside of a comint buffer, call
`bash-completion-dynamic-complete-nocomint' instead."
- (when (not (window-minibuffer-p))
- (message "Bash completion..."))
- (let ((result (bash-completion-dynamic-complete-nocomint
- (comint-line-beginning-position)
- (point))))
- (if bash-completion-comint-uses-standard-completion
- result
- ;; pre-emacs 24.1 compatibility code
- (let ((result (bash-completion-dynamic-complete-0)))
- (when result
- (let ((stub (buffer-substring-no-properties
- (nth 0 result)
- (nth 1 result)))
- (completions (nth 2 result))
- ;; Setting comint-completion-addsuffix overrides
- ;; configuration for comint-dynamic-simple-complete.
- ;; Bash adds a space suffix automatically.
- (comint-completion-addsuffix nil))
- (with-no-warnings
- (comint-dynamic-simple-complete stub completions))))))))
+ (let ((message-timer
+ (if (and (not (window-minibuffer-p))
+ (not (null bash-completion-message-delay)))
+ (run-at-time
+ bash-completion-message-delay nil
+ (lambda () (message "Bash completion..."))))))
+ (unwind-protect
+ (let ((result (bash-completion-dynamic-complete-nocomint
+ (comint-line-beginning-position)
+ (point))))
+ (if bash-completion-comint-uses-standard-completion
+ result
+ ;; pre-emacs 24.1 compatibility code
+ (let ((result (bash-completion-dynamic-complete-0)))
+ (when result
+ (let ((stub (buffer-substring-no-properties
+ (nth 0 result)
+ (nth 1 result)))
+ (completions (nth 2 result))
+ ;; Setting comint-completion-addsuffix overrides
+ ;; configuration for comint-dynamic-simple-complete.
+ ;; Bash adds a space suffix automatically.
+ (comint-completion-addsuffix nil))
+ (with-no-warnings
+ (comint-dynamic-simple-complete stub completions)))))))
+ ;; cleanup
+ (if message-timer
+ (cancel-timer message-timer)))))
(defun bash-completion-dynamic-complete-nocomint (start pos)
"Return completion information for bash command at an arbitrary position.
- [nongnu] elpa/bash-completion aadb2e20b2 070/313: simplified bash-completion-parse-line, (continued)
- [nongnu] elpa/bash-completion aadb2e20b2 070/313: simplified bash-completion-parse-line, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion ca24f8ada4 073/313: forward last open quote, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion b4fc1a73cb 092/313: removed unnecessary elisp directory, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3f86d75644 064/313: Trim strange results that are a subset of the current value, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7f4bcd03a8 110/313: Avoid cluttering .bash_history with commands from, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c8ddd11ec3 113/313: Fix tests after "Make bash-completion.el work, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion d2745d8923 114/313: Extended history, added a pointer to github, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 6413d662ba 116/313: Rewrote the tests using ert instead of regress., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion d65f7e018d 118/313: Skip integration tests if /bin/bash is not executable., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion ec557d8949 123/313: shell-command.el is unnecessary, and has probably been so for years..., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 318e32979f 135/313: Display completion progress message only if completion takes too long.,
ELPA Syncer <=
- [nongnu] elpa/bash-completion 2378b04eeb 140/313: More easily call bash-completion-dynamic-complete-nocomint, faking bash, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 43348d0be1 143/313: Bugfixes: remove references to nonexistent variables, such as, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 583d1dde61 151/313: Remove usage of seq-position with a custom implementation., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 664452aca2 157/313: Merge pull request #22 from kfogel/21-fix-completion-re-21149fdc, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion ad8d72c626 162/313: README nit pick ; ), ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c494a89070 168/313: Run tests under Emacs 24.1: alias letf to cl-letf., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f523a290a6 169/313: Make the integration tests run on Emacs 24.1., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion bbff4fa527 172/313: Merge branch 'master' of github.com:szermatt/emacs-bash-completion, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion b307dc24c3 005/313: keep cword, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion a79137cc86 004/313: escaped quotes, ELPA Syncer, 2022/12/03