diff options
author | JSDurand <mmemmew@gmail.com> | 2021-08-05 15:47:40 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-08-05 15:47:40 +0800 |
commit | 18bf82b5d10c40696a92011165aa7e0c0ff20e6b (patch) | |
tree | 97ee9584f413c1bee8131ffe40cc450d80a5b9a5 | |
parent | 47a56604069e5fc04a1dfa60ff6bf006b11539a4 (diff) |
fix: poor man' live upadting
* completion-conf.el (durand-minibuffer-respect-inhibit-advice)
(minibuffer-message): Make sure this respects the value of
`inhibit-message'.
(durand-completion-display-after-change): Previously this will add a
message at the end of the minibuffer after completing, so that the
input becomes invalid. Now this problem is fixed.
-rw-r--r-- | completion-conf.el | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/completion-conf.el b/completion-conf.el index fdf0e10..35248c6 100644 --- a/completion-conf.el +++ b/completion-conf.el @@ -91,18 +91,42 @@ minibuffer as usual." (remove-hook 'minibuffer-setup-hook 'durand-headlong-minibuffer-setup-hook) (remove-hook 'minibuffer-exit-hook 'durand-headlong-minibuffer-exit-hook)) +;; Make sure `minibuffer-message' respects `inhibit-message'. + +(defun durand-minibuffer-respect-inhibit-advice (fn &rest args) + (cond (inhibit-message) + (t (apply fn args)))) + +(advice-add 'minibuffer-message :around 'durand-minibuffer-respect-inhibit-advice) + ;;;###autoload -(fset - 'durand-completion-display-after-change - (make-byte-code - #x080 - (unibyte-string 192 32 135) - (vector #'minibuffer-completion-help) - 2 +(defun durand-completion-display-after-change (&rest args) "Call `minibuffer-completion-help' with no input. \(fn &rest ARGS)" - nil)) + (cond + ((minibufferp) + (let ((while-no-input-ignore-events '(selection-request))) + (while-no-input + (condition-case nil + (save-excursion + (goto-char (point-max)) + (save-match-data + (let ((inhibit-message t)) + (minibuffer-completion-help)))) + (quit (abort-recursive-edit)))))))) + +;; (fset +;; 'durand-completion-display-after-change +;; (make-byte-code +;; #x080 +;; (unibyte-string 192 32 135) +;; (vector #'minibuffer-completion-help) +;; 2 +;; "Call `minibuffer-completion-help' with no input. + +;; \(fn &rest ARGS)" +;; nil)) ;;;###autoload (fset |