update packages
This commit is contained in:
67
lisp/amx.el
67
lisp/amx.el
@@ -8,11 +8,11 @@
|
||||
;; Cornelius Mika <cornelius.mika@gmail.com>
|
||||
;; Maintainer: Ryan C. Thompson <rct@thompsonclan.org>
|
||||
;; URL: http://github.com/DarwinAwardWinner/amx/
|
||||
;; Package-Version: 20210101.1921
|
||||
;; Package-Commit: b99149715266b5c2c48f5a0fc43716d36575da5f
|
||||
;; Package-Version: 20210305.118
|
||||
;; Package-Commit: 37f9c7ae55eb0331b27200fb745206fc58ceffc0
|
||||
;; Package-Requires: ((emacs "24.4") (s "0"))
|
||||
;; Version: 3.3
|
||||
;; Keywords: convenience, usability
|
||||
;; Version: 3.4
|
||||
;; Keywords: convenience, usability, completion
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
@@ -494,7 +494,7 @@ A backend must be defined with at least a `:name' and a
|
||||
`:comp-fun' must accept the same arguments as
|
||||
`amx-completing-read-default'.
|
||||
|
||||
Additionally, a backend muse declare a `:get-text-fun', unless
|
||||
Additionally, a backend must declare a `:get-text-fun', unless
|
||||
`amx-default-get-text' is sufficient to get the user's currently
|
||||
entered text for the backend. Similarly, if pressing RET is not
|
||||
the correct way to exit the minibuffer with the currently
|
||||
@@ -537,7 +537,7 @@ choose the backend."
|
||||
(t (error "Unknown amx backed %S" backend))))
|
||||
|
||||
(cl-defun amx-completing-read-default (choices &key initial-input predicate def)
|
||||
"Amx backend for default Emacs completion"
|
||||
"Amx backend for default Emacs completion."
|
||||
(amx--debug-message "Preparing default-style completion")
|
||||
(require 'minibuf-eldef)
|
||||
(let ((minibuffer-completion-table choices)
|
||||
@@ -573,7 +573,7 @@ May not work for things like ido and ivy."
|
||||
(declare-function ido-completing-read+ "ext:ido-completing-read+")
|
||||
|
||||
(cl-defun amx-completing-read-ido (choices &key initial-input predicate def)
|
||||
"Amx backend for ido completion"
|
||||
"Amx backend for ido completion."
|
||||
(require 'ido-completing-read+)
|
||||
(let ((ido-completion-map ido-completion-map)
|
||||
(ido-setup-hook (cons 'amx-prepare-ido-bindings ido-setup-hook))
|
||||
@@ -596,7 +596,7 @@ May not work for things like ido and ivy."
|
||||
(declare-function ivy-read "ext:ivy")
|
||||
|
||||
(cl-defun amx-completing-read-ivy (choices &key initial-input predicate def)
|
||||
"Amx backend for ivy completion"
|
||||
"Amx backend for ivy completion."
|
||||
(require 'ivy)
|
||||
(ivy-read (amx-prompt-with-prefix-arg) choices
|
||||
:predicate predicate
|
||||
@@ -621,7 +621,7 @@ May not work for things like ido and ivy."
|
||||
(declare-function helm-comp-read "ext:helm-mode")
|
||||
|
||||
(cl-defun amx-completing-read-helm (choices &key initial-input predicate def)
|
||||
"Amx backend for helm completion"
|
||||
"Amx backend for helm completion."
|
||||
(require 'helm-config)
|
||||
(require 'helm-mode) ; Provides `helm-comp-read-map'
|
||||
(helm-comp-read (amx-prompt-with-prefix-arg) choices
|
||||
@@ -645,34 +645,32 @@ May not work for things like ido and ivy."
|
||||
:required-feature 'helm
|
||||
:auto-activate '(bound-and-true-p helm-mode))
|
||||
|
||||
(declare-function selectrum-read "ext:selectrum")
|
||||
(declare-function selectrum--normalize-collection "ext:selectrum")
|
||||
(declare-function selectrum-completing-read "ext:selectrum")
|
||||
(defvar selectrum-should-sort)
|
||||
(defvar selectrum-should-sort-p)
|
||||
(defvar selectrum--previous-input-string)
|
||||
|
||||
(cl-defun amx-completing-read-selectrum (choices &key initial-input predicate def)
|
||||
"Amx backend for selectrum completion."
|
||||
(let ((choices (cl-remove-if-not (or predicate #'identity)
|
||||
choices))
|
||||
(selectrum-should-sort-p nil))
|
||||
(minibuffer-with-setup-hook
|
||||
(lambda ()
|
||||
(use-local-map (make-composed-keymap
|
||||
(list amx-map (current-local-map)))))
|
||||
(selectrum-read (amx-prompt-with-prefix-arg)
|
||||
(selectrum--normalize-collection choices)
|
||||
:history 'extended-command-history
|
||||
:require-match t
|
||||
:default-candidate def
|
||||
:initial-input initial-input))))
|
||||
|
||||
(defun amx-selectrum-get-text ()
|
||||
selectrum--previous-input-string)
|
||||
(minibuffer-with-setup-hook
|
||||
(lambda ()
|
||||
(setq-local selectrum-should-sort nil)
|
||||
(use-local-map (make-composed-keymap
|
||||
(list amx-map (current-local-map)))))
|
||||
;; FIXME: `selectrum-should-sort-p' should be removed after it can be
|
||||
;; assumed all amx users updated also Selectrum.
|
||||
(let ((selectrum-should-sort-p nil))
|
||||
(selectrum-completing-read (amx-prompt-with-prefix-arg)
|
||||
choices
|
||||
predicate
|
||||
t
|
||||
initial-input
|
||||
'extended-command-history
|
||||
def))))
|
||||
|
||||
(amx-define-backend
|
||||
:name 'selectrum
|
||||
:comp-fun 'amx-completing-read-selectrum
|
||||
:get-text-fun 'amx-selectrum-get-text
|
||||
:get-text-fun 'amx-default-get-text
|
||||
:required-feature 'selectrum
|
||||
:auto-activate '(bound-and-true-p selectrum-mode))
|
||||
|
||||
@@ -747,18 +745,17 @@ the associated feature, if any."
|
||||
(set-default symbol value))
|
||||
|
||||
(defcustom amx-backend 'auto
|
||||
"Completion function to select a candidate from a list of strings.
|
||||
"Completion backend used by amx.
|
||||
|
||||
This function should take the same arguments as
|
||||
`amx-completing-read': CHOICES and INITIAL-INPUT.
|
||||
|
||||
By default, an appropriate method is selected based on whether
|
||||
`ivy-mode' or `ido-mode' is enabled."
|
||||
This should be the name of backend defined using
|
||||
`amx-define-backend', such as `ido' or `ivy', or the symbol
|
||||
`auto' to have amx select a backend automatically."
|
||||
:type '(choice
|
||||
(const :tag "Auto-select" auto)
|
||||
(const :tag "Ido" ido)
|
||||
(const :tag "Ivy" ivy)
|
||||
(const :tag "Helm" helm)
|
||||
(const :tag "Selectrum" selectrum)
|
||||
(const :tag "Standard" standard)
|
||||
(symbol :tag "Custom backend"))
|
||||
:set #'amx-set-backend)
|
||||
|
||||
Reference in New Issue
Block a user