[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 11e52fce6f 018/313: Fixed initialization
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 11e52fce6f 018/313: Fixed initialization |
Date: |
Sat, 3 Dec 2022 10:59:11 -0500 (EST) |
branch: elpa/bash-completion
commit 11e52fce6f33736b49fd2aa075b2abcba5c2f012
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
Fixed initialization
---
bash-complete.el | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/bash-complete.el b/bash-complete.el
index 3946ffcff9..abdca04c88 100644
--- a/bash-complete.el
+++ b/bash-complete.el
@@ -1,9 +1,12 @@
(require 'comint)
-(defvar bash-complete-command "bash"
+(defvar bash-complete-prog "bash"
"Command-line to execute bash")
+(defvar bash-complete-mode-list '(shell-mode)
+ "List of comint modes for which bash-complete should be enabled")
+
(defvar bash-complete-process-timeout 2.5)
(defvar bash-complete-initial-timeout 30
"Timeout value to apply when talking to bash for the first time.
@@ -24,21 +27,25 @@ See `bash-complete-add-to-alist'.
")
(defun bash-complete-setup ()
- (add-hook 'shell-mode-hook 'bash-complete-setup-shell))
-
-(defun bash-complete-setup-shell ()
- (add-hook 'comint-dynamic-complete-functions 'bash-complete-dynamic-complete
t t))
-
+ (add-hook 'shell-dynamic-complete-functions
+ 'bash-complete-dynamic-complete-in-selected-modes)
+ (add-hook 'shell-command-complete-functions
+ 'bash-complete-dynamic-complete))
+
+;;;###autoload
+(defun bash-complete-dynamic-complete-in-selected-modes ()
+ (when (memq major-mode bash-complete-mode-list)
+ (message "Bash completion...")
+ (bash-complete-dynamic-complete)))
+
+;;;###autoload
(defun bash-complete-dynamic-complete ()
"Bash completion function for `comint-complete-dynamic-functions'.
Call bash to do the completion."
- (when (comint-match-partial-filename)
- (unless (window-minibuffer-p (selected-window))
- (message "Bash completion..."))
- (bash-complete-dynamic-complete-0)))
+ (bash-complete-dynamic-complete))
-(defun bash-complete-dynamic-complete-0 ()
+(defun bash-complete-dynamic-complete ()
(let* ( (pos (point))
(start (bash-complete-line-beginning-position))
(end (line-end-position))
@@ -170,10 +177,10 @@ The result is a list of candidates, which might be empty."
(start-process
"*bash-complete*"
"*bash-complete*"
- bash-complete-command
+ bash-complete-prog
"--noediting"))
(set-process-query-on-exit-flag process nil)
- (let* ((shell-name (file-name-nondirectory
bash-complete-executable))
+ (let* ((shell-name (file-name-nondirectory bash-complete-prog))
(startfile1 (concat "~/.emacs_" shell-name ".sh"))
(startfile2 (concat "~/.emacs.d/init_" shell-name ".sh")))
(cond
@@ -234,7 +241,7 @@ The result is a list of candidates, which might be empty."
(and bash-complete-process (eq 'run (process-status bash-complete-process))))
(defun bash-complete-send (commandline &optional process timeout)
- (let ((process (or process bash-complete-process))
+ (let ((process (or process (bash-complete-require-process)))
(timeout (or timeout bash-complete-process-timeout)))
(with-current-buffer (process-buffer process)
(erase-buffer)
- [nongnu] elpa/bash-completion 540f8f516a 011/313: build bash cmdline, (continued)
- [nongnu] elpa/bash-completion 540f8f516a 011/313: build bash cmdline, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 6eebe8f965 016/313: cleaned up process launch, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 34d11220dd 024/313: add prefix if missing, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3036ef0394 028/313: disable quote_readline to get good whitespace handling for bash 3.2 at least, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion ba83e81651 053/313: bash-completion-generate-line, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f7bfc68ea2 001/313: bash completion, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f5885ec87a 002/313: test case for bash-complete, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 208cb5ab76 007/313: Join, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 47a890dd72 010/313: launch process, send commands, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 53f2c5d30e 009/313: parse complete -p output, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 11e52fce6f 018/313: Fixed initialization,
ELPA Syncer <=
- [nongnu] elpa/bash-completion c10cfef5b8 015/313: complex line split, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion b5c2fbf4a2 014/313: add hooks, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 9eb026ae0b 025/313: fixed current directory for adding slash, workaround for bash ~ expansion, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 02d1acf260 030/313: wordbreaks, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 5931a2ba43 037/313: completion-fix, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion a78fd6b587 044/313: turn off mailwarn and checkjobs, continue if this failed, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 0ffaad3ef0 035/313: wordbreak-split, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 80cd654c35 043/313: turn off mailwarn and checkjobs, continue if this failed, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 1c6b2efb67 040/313: enormous test, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion fc96b621e2 034/313: pass all tests in bash-completion, new test for -send, ELPA Syncer, 2022/12/03