Skip to content

Commit

Permalink
Try to not test the Vertico/Corfu packages on Emacs versions less tha…
Browse files Browse the repository at this point in the history
…n 27.
  • Loading branch information
okamsn committed Dec 31, 2023
1 parent 3cc1141 commit 3644fdd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 38 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ jobs:
strategy:
matrix:
emacs_version: [25, 26, 27, 28]
make_target: ['checkdoc', 'longlines', 'test', 'compile']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: CI
env:
VERSION: ${{ matrix.emacs_version }}
TARGET: ${{ matrix.make_target }}
run: |
echo "Emacs version is: $VERSION"
>-
make docker CMD="make -k $TARGET VERSION=$VERSION"
run: >-
make docker CMD="make -k compile checkdoc longlines test"
12 changes: 0 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,7 @@ CMD ?=
EMACS ?= emacs

# The order is important for compilation.
#
# Get all files that we might wish to to test compilation, then remove
# files that we shouldn't test based on the Emacs version.
for_compile := prescient.el $(wildcard *-prescient.el)
ifneq ($(strip $(VERSION)),)
ifeq (1, $(strip $(shell expr $(VERSION) \< 26)))
for_compile := $(filter-out selectrum-prescient.el,$(for_compile))
endif
ifeq (1, $(strip $(shell expr $(VERSION) \< 27)))
for_compile := $(filter-out vertico-prescient.el corfu-prescient.el,\
$(for_compile))
endif
endif
for_checkdoc := prescient.el $(wildcard *-prescient.el)
for_longlines := $(wildcard *.el *.md *.yml) Makefile

Expand Down
30 changes: 10 additions & 20 deletions vertico-prescient.el
Original file line number Diff line number Diff line change
Expand Up @@ -141,32 +141,22 @@ trailing directory separator as needed."
vertico-directory-enter)
"Commands that trigger `prescient-remember' after running.")

(declare-function vertico-prescient--minibuffer-active-p
"ext:vertico-prescient")
(if (let ((upper-bound (cdr (func-arity 'minibufferp))))
(or (eq t upper-bound)
(>= 2 upper-bound)))
(defun vertico-prescient--minibuffer-active-p (buf)
"Check if BUF minibuffer is a minibuffer and is active."
(minibufferp buf t))
(defun vertico-prescient--minibuffer-active-p (buf)
"Check if BUF minibuffer is a minibuffer and is active."
(and (minibufferp buf)
(/= 0 (minibuffer-depth))
;; There is an internal list of minibuffers that doesn't seem
;; accessible from Lisp, so we use this approximation:
(eq (active-minibuffer-window) (get-buffer-window buf))
(eq (active-minibuffer-window) (selected-window)))))

(defun vertico-prescient--remember-inserted-candidate ()
"Remember the minibuffer contents as a candidate after insertion commands.
Such commands are listed in `vertico-prescient--insertion-commands'."
(when (and (memq this-command vertico-prescient--insertion-commands)
;; Try to avoid running the remembrance function twice
;; for commands that can insert and exit.
;; Pro-actively try to avoid running the remembrance
;; function twice for commands that can insert and exit.
;; This might not be needed?
(vertico-prescient--minibuffer-active-p (current-buffer)))
(let ((buf (current-buffer)))
;; In Emacs 28+, we would use the new second argument
;; to `minibufferp' check if the buffer is the active
;; minibuffer, but we want to support Emacs 27.
(and (> 0 (minibuffer-depth))
(minibufferp buf)
(eq (active-minibuffer-window)
(get-buffer-window buf)))))
(vertico-prescient--remember-minibuffer-contents)))

(defvar vertico-prescient--exit-commands
Expand Down

0 comments on commit 3644fdd

Please sign in to comment.