[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/capf-autosuggest cf91a30 37/63: Added experimental supp
From: |
ELPA Syncer |
Subject: |
[elpa] externals/capf-autosuggest cf91a30 37/63: Added experimental support for minibuffer history |
Date: |
Wed, 27 Oct 2021 14:58:00 -0400 (EDT) |
branch: externals/capf-autosuggest
commit cf91a30f1b74b5d31fc1d2937a2fd3e8af12d7fa
Author: jakanakaevangeli <jakanakaevangeli@chiru.no>
Commit: jakanakaevangeli <jakanakaevangeli@chiru.no>
Added experimental support for minibuffer history
---
capf-autosuggest.el | 39 +++++++++++++++++++++++++++++++++------
1 file changed, 33 insertions(+), 6 deletions(-)
diff --git a/capf-autosuggest.el b/capf-autosuggest.el
index eb5e69a..01d5745 100644
--- a/capf-autosuggest.el
+++ b/capf-autosuggest.el
@@ -339,6 +339,14 @@ repetition."
#'eshell-send-input))
(setq this-command #'eshell-send-input))
+(defun capf-autosuggest-minibuffer-send-input ()
+ "`capf-autosuggest-accept' and `exit-minibuffer'."
+ (interactive)
+ (capf-autosuggest-accept)
+ (call-interactively (or (command-remapping #'exit-minibuffer)
+ #'exit-minibuffer))
+ (setq this-command #'exit-minibuffer))
+
(defcustom capf-autosuggest-dwim-next-line t
"Whether `next-line' can accept and send current suggestion.
If t and point is on last line, `next-line' will accept the
@@ -396,11 +404,11 @@ suggestion and send input."
(lambda (cmd)
(if (and capf-autosuggest-dwim-next-line
(looking-at-p "[^\n]*\n?\\'"))
- (cond ((derived-mode-p 'comint-mode)
- #'capf-autosuggest-comint-send-input)
- ((derived-mode-p 'eshell-mode)
- #'capf-autosuggest-eshell-send-input)
- (t cmd))
+ (cond
+ ((derived-mode-p 'comint-mode)
#'capf-autosuggest-comint-send-input)
+ ((derived-mode-p 'eshell-mode)
#'capf-autosuggest-eshell-send-input)
+ ((minibufferp) #'capf-autosuggest-minibuffer-send-input)
+ (t cmd))
cmd))))
(define-key map [remap comint-next-prompt]
(list 'menu-item "" #'comint-next-prompt :filter
@@ -487,7 +495,6 @@ Is only applicable if point is after the last prompt."
(capf-autosuggest--completion-table ring)
:exclusive 'no))))
-;;;###autoload
(defun capf-autosuggest-eshell-capf ()
"Completion-at-point function for eshell input history.
Is only applicable if point is after the last prompt."
@@ -548,6 +555,26 @@ Is only applicable if point is after the last prompt."
(capf-autosuggest-mode)
(add-hook 'capf-autosuggest-capf-functions #'capf-autosuggest-eshell-capf
nil t))
+;;;###autoload
+(defun capf-autosuggest-setup-minibuffer ()
+ "Setup capf-autosuggest for history suggestion in the minibuffer."
+ (let ((hist minibuffer-history-variable)
+ (should-prin1 nil))
+ (when (and (not (eq t hist))
+ (setq hist (symbol-value hist)))
+ (when (eq minibuffer-history-sexp-flag (minibuffer-depth))
+ (setq should-prin1 t))
+ (capf-autosuggest-mode)
+ (add-hook 'capf-autosuggest-capf-functions
+ (lambda ()
+ (when should-prin1
+ (setq hist (mapcar #'prin1-to-string hist)
+ should-prin1 nil))
+ (list (minibuffer-prompt-end)
+ (point-max)
+ hist
+ :exclusive 'no))
+ nil t))))
(provide 'capf-autosuggest)
;;; capf-autosuggest.el ends here
- [elpa] externals/capf-autosuggest 0ba985a 14/63: Minor simplification, use pcase-let, (continued)
- [elpa] externals/capf-autosuggest 0ba985a 14/63: Minor simplification, use pcase-let, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 7085c0a 02/63: Improve, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 6432d5f 09/63: Avoid error if all-completions returns invalid strings, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest f9854fb 03/63: Define partial-accept commands individually, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest d374a0b 21/63: Small rearrangement, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 56796e2 23/63: Minor loop optimization, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 82c6851 25/63: Merge into one file, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest bdc26ec 31/63: Typo, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 07cb937 32/63: Added dwim commands/menu-items, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest d5e1ce2 30/63: Rearrange, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest cf91a30 37/63: Added experimental support for minibuffer history,
ELPA Syncer <=
- [elpa] externals/capf-autosuggest d72b37a 35/63: Added readme, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest f137fcb 39/63: Fix previous-matching-input if point isn't touching overlay, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 8f5d5fa 49/63: Fix last change, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 1333fb9 41/63: Override face text property, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 25ddce8 45/63: Fix compiler warning, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 96394ca 48/63: Simplify accept and send menu-items, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 6e702a7 47/63: Fix programming typo, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 54e9d1f 42/63: Fix cursor display issues if overlay text ends with a newline, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest 4b2fbee 62/63: Release version 0.1, ELPA Syncer, 2021/10/27
- [elpa] externals/capf-autosuggest d8433bc 51/63: Suggest autoload instead of require, ELPA Syncer, 2021/10/27