emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/capf-autosuggest d5e1ce2 30/63: Rearrange


From: ELPA Syncer
Subject: [elpa] externals/capf-autosuggest d5e1ce2 30/63: Rearrange
Date: Wed, 27 Oct 2021 14:57:59 -0400 (EDT)

branch: externals/capf-autosuggest
commit d5e1ce2b9bffba2e2a8b1177b5e42d75d3119ec9
Author: jakanakaevangeli <jakanakaevangeli@chiru.no>
Commit: jakanakaevangeli <jakanakaevangeli@chiru.no>

    Rearrange
---
 capf-autosuggest.el | 54 ++++++++++++++++++++++++++++++-----------------------
 1 file changed, 31 insertions(+), 23 deletions(-)

diff --git a/capf-autosuggest.el b/capf-autosuggest.el
index add3dd4..1a0edd6 100644
--- a/capf-autosuggest.el
+++ b/capf-autosuggest.el
@@ -101,6 +101,8 @@
 (declare-function comint-previous-matching-input-from-input "comint")
 (declare-function eshell-previous-matching-input-from-input "em-hist")
 
+;;; Auto-suggestion overlay
+
 (defface capf-autosuggest-face '((t :inherit file-name-shadow))
   "Face used for auto suggestions."
   :group 'completion)
@@ -198,6 +200,8 @@ Otherwise, return nil."
     (remove-hook 'post-command-hook #'capf-autosuggest--post-h t)
     (capf-autosuggest-active-mode -1)))
 
+;;; Various commands and menu-items
+
 ;;;###autoload
 (defmacro capf-autosuggest-define-partial-accept-cmd (name command)
   "Define a command NAME.
@@ -277,6 +281,31 @@ inactive."
      (interactive)
      (goto-char (overlay-start capf-autosuggest--overlay)))))
 
+
+(defun capf-autosuggest-comint-previous-matching-input-from-input (n)
+  "Like `comint-previous-matching-input-from-input'.
+But increase arument N by 1, if positive, but not on command
+repetition."
+  (interactive "p")
+  (and (not (memq last-command '(comint-previous-matching-input-from-input
+                                 comint-next-matching-input-from-input)))
+       (> n 0)
+       (setq n (1+ n)))
+  (comint-previous-matching-input-from-input n)
+  (setq this-command #'comint-previous-matching-input-from-input))
+
+(defun capf-autosuggest-eshell-previous-matching-input-from-input (n)
+  "Like `eshell-previous-matching-input-from-input'.
+But increase arument N by 1, if positive, but not on command
+repetition."
+  (interactive "p")
+  (and (not (memq last-command '(eshell-previous-matching-input-from-input
+                                 eshell-next-matching-input-from-input)))
+       (> n 0)
+       (setq n (1+ n)))
+  (eshell-previous-matching-input-from-input n)
+  (setq this-command #'eshell-previous-matching-input-from-input))
+
 (defvar capf-autosuggest-active-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map [remap forward-word] #'capf-autosuggest-forward-word)
@@ -314,6 +343,8 @@ inactive."
   "Deactivate `capf-autosuggest-active-mode'."
   (capf-autosuggest-active-mode -1))
 
+;;;; History completion function
+
 ;;;###autoload
 (defun capf-autosuggest-comint-capf ()
   "Completion-at-point function for comint input history.
@@ -393,29 +424,6 @@ 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))
 
-(defun capf-autosuggest-comint-previous-matching-input-from-input (n)
-  "Like `comint-previous-matching-input-from-input'.
-But increase arument N by 1, if positive, but not on command
-repetition."
-  (interactive "p")
-  (and (not (memq last-command '(comint-previous-matching-input-from-input
-                                 comint-next-matching-input-from-input)))
-       (> n 0)
-       (setq n (1+ n)))
-  (comint-previous-matching-input-from-input n)
-  (setq this-command #'comint-previous-matching-input-from-input))
-
-(defun capf-autosuggest-eshell-previous-matching-input-from-input (n)
-  "Like `eshell-previous-matching-input-from-input'.
-But increase arument N by 1, if positive, but not on command
-repetition."
-  (interactive "p")
-  (and (not (memq last-command '(eshell-previous-matching-input-from-input
-                                 eshell-next-matching-input-from-input)))
-       (> n 0)
-       (setq n (1+ n)))
-  (eshell-previous-matching-input-from-input n)
-  (setq this-command #'eshell-previous-matching-input-from-input))
 
 (provide 'capf-autosuggest)
 ;;; capf-autosuggest.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]