[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mct 6a1835cf00 48/64: Remove mct--region-buf
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mct 6a1835cf00 48/64: Remove mct--region-buf |
Date: |
Thu, 30 Dec 2021 23:58:00 -0500 (EST) |
branch: externals/mct
commit 6a1835cf006f13be05484f88fd7f6b685d851411
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Remove mct--region-buf
We do not have to store this buffer since completion-reference-buffer
exists.
completion-in-region-mode is automatically left as soon as we leave the
original
buffer. This happens in the completion-in-region--postch hook function.
Unfortunately this makes it hard to implement a command bound to TAB, which
inserts the current candidate and proceeds with the completion in the buffer
(mct-region-choose-completion-no-exit). It would be nice to have this for
file
path completion. There are these possibilities to achieve this goal:
1) Remove the completion-in-region--postch from the post-command-hook list.
Instead use our own hook which preserves the completion-in-region-mode. This
approach is probably not such a good idea, since by definition of the
completion-in-region-mode, the mode should be left as soon as we leave the
buffer.
2) Save the entire completion-in-region--data just before entering the
*Completions* buffer. Use the saved data to restore the completion-in-region
after mct-region-choose-completion-no-exit, such
3) Try to restart the completion after
mct-region-choose-completion-no-exit, by
calling completion-at-point again or the appropriate completion-in-region
command. I don't think it is easy to find a way which works in general.
I would try to implement option 2.
---
mct.el | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/mct.el b/mct.el
index 08b43b93aa..01c96af89f 100644
--- a/mct.el
+++ b/mct.el
@@ -304,7 +304,7 @@ Meant to be added to `after-change-functions'."
;; need to review this.
(defun mct--region-p ()
"Return non-nil if Mct is completing in region."
- (and (bound-and-true-p mct-region-mode) mct--region-buf))
+ (and (bound-and-true-p mct-region-mode) (mct--region-current-buffer)))
(defun mct--display-completion-list-advice (&rest app)
"Prepare advice around `display-completion-list'.
@@ -1111,26 +1111,20 @@ region.")
;;;;;; Live completions
-;; TODO: Why do we need this variable?
-;; Can we not always call `mct--region-current-buffer'?
-(defvar mct--region-buf nil
- "Current buffer where Mct performs completion in region.")
-
(defun mct--region-current-buffer ()
"Return current buffer of completion in region."
- (setq mct--region-buf (and completion-in-region--data
- (marker-buffer (nth 0
completion-in-region--data)))))
+ (and completion-in-region--data
+ (marker-buffer (nth 0 completion-in-region--data))))
(defun mct--region-live-completions (&rest _)
"Update the *Completions* buffer.
Meant to be added to `after-change-functions'."
- (let ((buf (window-buffer (mct--get-completion-window))))
- (when (and mct--region-buf (not (eq (current-buffer) buf)))
- (while-no-input
- (condition-case nil
- (save-match-data
- (mct--show-completions))
- (quit (keyboard-quit)))))))
+ (when (mct--region-current-buffer)
+ (while-no-input
+ (condition-case nil
+ (save-match-data
+ (mct--show-completions))
+ (quit (keyboard-quit))))))
(defun mct--region-live-update ()
"Hook up `mct--region-live-completions'."
- [elpa] externals/mct bf0f666ee4 49/64: Replace "mct-mode" with "mct-minibuffer-mode", (continued)
- [elpa] externals/mct bf0f666ee4 49/64: Replace "mct-mode" with "mct-minibuffer-mode", ELPA Syncer, 2021/12/30
- [elpa] externals/mct aaaf12c70c 50/64: Merge branch 'main' into experiment-completion-in-region, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 775f42951d 02/64: Remove mct--region-current-buffer, ELPA Syncer, 2021/12/30
- [elpa] externals/mct fb177ace70 18/64: Keep "next or mini" intact (we'll use another fn), ELPA Syncer, 2021/12/30
- [elpa] externals/mct f3d86fe28a 06/64: Rename internal function, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 72a1c3e6f4 22/64: Minor changes to doc strings, ELPA Syncer, 2021/12/30
- [elpa] externals/mct dedb62cce5 23/64: Implement next/prev candidate or quit completions, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 6bb328a795 24/64: Merge branch 'main' into experiment-completion-in-region, ELPA Syncer, 2021/12/30
- [elpa] externals/mct a3edf3ce5a 28/64: Remove obsolete function, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 85d05c08b6 33/64: Remove superfluous comment, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 6a1835cf00 48/64: Remove mct--region-buf,
ELPA Syncer <=
- [elpa] externals/mct 771fb8b3cb 54/64: Make in-region prev motion work at all times, ELPA Syncer, 2021/12/30
- [elpa] externals/mct e4b49f40f1 58/64: Add TODO about local mct-region-mode, ELPA Syncer, 2021/12/30
- [elpa] externals/mct a6dac17d1c 59/64: Review mct--region-p for buffer-local mode, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 59431a2622 61/64: Provide global variant of mct-region-mode, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 9e81e4425a 64/64: Complete key bindings of next/prev group motions, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 740d9f5d7d 01/64: Do not bind while-no-input-ignore-events, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 0c575c23c4 04/64: Add TODO: mct-region-mode could be buffer local, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 2413746369 11/64: Merge 'main' into experiment-completion-in-region, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 90aa42f432 13/64: Style the completions regardless of mct variant, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 236e03fd5e 08/64: Install advice to silence messages in region, ELPA Syncer, 2021/12/30