[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion e95867c993 256/313: completion-table-with-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion e95867c993 256/313: completion-table-with-cache captures and restore buffer and variables. |
Date: |
Sat, 3 Dec 2022 10:59:35 -0500 (EST) |
branch: elpa/bash-completion
commit e95867c993d590319d1b67b6c9466b2bf54f1387
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
completion-table-with-cache captures and restore buffer and variables.
With this change, completion-table-with-cache restores the original
buffer. This is useful as here's no guarantee of what the current
buffer is when the dynamic table function is called, so enforce it
before calling bash-completion--complete, to be sure.
This change also restores the current directory as well as the value
of bash-completion-use-separate-processes and bash-completion-nospace,
as both these are often overridden temporarily in a let section.
---
bash-completion.el | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/bash-completion.el b/bash-completion.el
index b6d6d20301..8bd28a4584 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -568,8 +568,7 @@ Returns (list stub-start stub-end completions) with
comp-pos
(if dynamic-table
(bash-completion--completion-table-with-cache
- comp process
- bash-completion-use-separate-processes)
+ comp process)
(bash-completion--complete comp process)))))))
(defun bash-completion--find-last (elt array)
@@ -1538,7 +1537,7 @@ Return the parsed value, as a string or nil."
(prog1 (match-string 1)
(delete-region (match-beginning 0) (match-end 0)))))))
-(defun bash-completion--completion-table-with-cache (comp process
use-separate-process)
+(defun bash-completion--completion-table-with-cache (comp process)
"Build a dynamic completion table for COMP using PROCESS.
The result is a function that works like one built by
@@ -1546,16 +1545,23 @@ The result is a function that works like one built by
completions, built by `bash-completion--complete' are complete
and that completion style doesn't necessarily use substring
completion."
- (let ((last-str) (last-result))
+ (let ((last-str) (last-result)
+ (calling-buffer (current-buffer))
+ (dir default-directory)
+ (use-separate-process bash-completion-use-separate-processes)
+ (nospace bash-completion-nospace))
(lambda (str predicate action)
(if (or (eq (car-safe action) 'boundaries)
(eq action 'metadata))
nil
- (let ((result (if (equal str last-str)
- last-result
- (let ((bash-completion-use-separate-processes
- use-separate-process))
- (bash-completion--complete comp process)))))
+ (let ((result
+ (if (equal str last-str)
+ last-result
+ (let ((bash-completion-use-separate-processes
use-separate-process)
+ (bash-completion-nospace nospace)
+ (default-directory dir))
+ (with-current-buffer calling-buffer
+ (bash-completion--complete comp process))))))
(setq last-str str
last-result result)
;; The below passes an empty string to try-completion,
- [nongnu] elpa/bash-completion f1bd3d528f 201/313: Improve some docstrings, (continued)
- [nongnu] elpa/bash-completion f1bd3d528f 201/313: Improve some docstrings, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion fa49dbb382 209/313: Improve status code retrieval, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7822d84812 223/313: Added Cask with ert-runner to compile and run test., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 31a01859b2 227/313: Do not run tests under Emacs 24.1., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 21471cc542 228/313: Report result of running the test workflow on README.md., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 98a2a21be7 234/313: Provide a way of refreshing the completion table., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 4fcddf83c9 242/313: Make /etc/bash_completion scripts work with escaped spaces., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 2dbc7e61f6 248/313: Extend bash-completion-refresh to refresh everything, test it., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 04393bca0f 250/313: Apply filename post-processing even when prefix doesn't match., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 2a937b3763 255/313: Don't let Emacs post-filter completions built by bash., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion e95867c993 256/313: completion-table-with-cache captures and restore buffer and variables.,
ELPA Syncer <=
- [nongnu] elpa/bash-completion 747920fdbf 265/313: Avoid having to set BASH_COMPLETION., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f15176ee59 267/313: Fix to properly evaluate PROMPT_COMMAND after restoring it., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion b4ae893243 268/313: Test prompt and history manipulation, fix $? in prompt., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 20feaf909d 258/313: Fix markdown markup., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 8713edbb92 269/313: Mention that completion works with bash 5, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 4b80c75c43 272/313: Take current directory from shell when in single-process mode., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion ea5cc15b99 273/313: Let status code of compgen through when in single-process mode., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 12da4f0e91 289/313: Better handle slow completion functions., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7186a18cad 012/313: Integrated into comm, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion e81c478032 020/313: bash-complete -> bash-completion, ELPA Syncer, 2022/12/03