[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/popup 29c6db4 130/184: Pass filtering function as an argum
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/popup 29c6db4 130/184: Pass filtering function as an argument to popup-menu* |
Date: |
Wed, 6 Oct 2021 00:01:27 -0400 (EDT) |
branch: elpa/popup
commit 29c6db4c0bda7b6771cb0ecb98dc86d57c292a0e
Author: Igor Shymko <igor.shimko@gmail.com>
Commit: Igor Shymko <igor.shimko@gmail.com>
Pass filtering function as an argument to popup-menu*
---
popup.el | 28 ++++++++++++++++++++--------
tests/popup-test.el | 2 +-
2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/popup.el b/popup.el
index 6791272..d197f8c 100644
--- a/popup.el
+++ b/popup.el
@@ -4,7 +4,7 @@
;; Author: Tomohiro Matsuyama <m2ym.pub@gmail.com>
;; Keywords: lisp
-;; Version: 0.5.2
+;; Version: 0.5.3
;; Package-Requires: ((cl-lib "0.3"))
;; This program is free software; you can redistribute it and/or modify
@@ -31,7 +31,7 @@
(require 'cl-lib)
-(defconst popup-version "0.5.2")
+(defconst popup-version "0.5.3")
@@ -919,11 +919,11 @@ Pages up through POPUP."
(propertize pattern 'face 'isearch-fail)
pattern)))
-(defun popup-isearch-update (popup pattern &optional callback)
+(defun popup-isearch-update (popup filter pattern &optional callback)
(setf (popup-cursor popup) 0
(popup-scroll-top popup) 0
(popup-pattern popup) pattern)
- (let ((list (popup-isearch-filter-list pattern (popup-original-list popup))))
+ (let ((list (funcall filter pattern (popup-original-list popup))))
(popup-set-filtered-list popup list)
(if callback
(funcall callback list)))
@@ -931,6 +931,7 @@ Pages up through POPUP."
(cl-defun popup-isearch (popup
&key
+ (filter 'popup-isearch-filter-list)
(cursor-color popup-isearch-cursor-color)
(keymap popup-isearch-keymap)
callback
@@ -938,6 +939,8 @@ Pages up through POPUP."
"Start isearch on POPUP. This function is synchronized, meaning
event loop waits for quiting of isearch.
+FILTER is function with two argumenst to perform popup items filtering.
+
CURSOR-COLOR is a cursor color during isearch. The default value
is `popup-isearch-cursor-color'.
@@ -972,10 +975,10 @@ HELP-DELAY is a delay of displaying helps."
((eq binding 'popup-isearch-done)
(cl-return nil))
((eq binding 'popup-isearch-cancel)
- (popup-isearch-update popup "" callback)
+ (popup-isearch-update popup filter "" callback)
(cl-return t))
((eq binding 'popup-isearch-close)
- (popup-isearch-update popup "" callback)
+ (popup-isearch-update popup filter "" callback)
(setq unread-command-events
(append (listify-key-sequence key)
unread-command-events))
(cl-return nil))
@@ -986,7 +989,7 @@ HELP-DELAY is a delay of displaying helps."
(setq unread-command-events
(append (listify-key-sequence key)
unread-command-events))
(cl-return nil)))
- (popup-isearch-update popup pattern callback))))
+ (popup-isearch-update popup filter pattern callback))))
(if old-cursor-color
(set-cursor-color old-cursor-color)))))
@@ -1177,6 +1180,7 @@ PROMPT is a prompt string when reading events during
event loop."
prompt
help-delay
isearch
+ isearch-filter
isearch-cursor-color
isearch-keymap
isearch-callback
@@ -1185,6 +1189,7 @@ PROMPT is a prompt string when reading events during
event loop."
(while (popup-live-p menu)
(and isearch
(popup-isearch menu
+ :filter isearch-filter
:cursor-color isearch-cursor-color
:keymap isearch-keymap
:callback isearch-callback
@@ -1220,6 +1225,7 @@ PROMPT is a prompt string when reading events during
event loop."
:parent-offset index
:help-delay help-delay
:isearch isearch
+ :isearch-filter isearch-filter
:isearch-cursor-color
isearch-cursor-color
:isearch-keymap isearch-keymap
:isearch-callback
isearch-callback))
@@ -1238,6 +1244,7 @@ PROMPT is a prompt string when reading events during
event loop."
(popup-menu-show-help menu))
((eq binding 'popup-isearch)
(popup-isearch menu
+ :filter 'isearch-filter
:cursor-color isearch-cursor-color
:keymap isearch-keymap
:callback isearch-callback
@@ -1306,6 +1313,7 @@ PROMPT is a prompt string when reading events during
event loop."
nowait
prompt
isearch
+ (isearch-filter 'popup-isearch-filter-list)
(isearch-cursor-color popup-isearch-cursor-color)
(isearch-keymap popup-isearch-keymap)
isearch-callback
@@ -1314,7 +1322,7 @@ PROMPT is a prompt string when reading events during
event loop."
"Show a popup menu of LIST at POINT. This function returns a
value of the selected item. Almost arguments are same as
`popup-create' except for KEYMAP, FALLBACK, HELP-DELAY, PROMPT,
-ISEARCH, ISEARCH-CURSOR-COLOR, ISEARCH-KEYMAP, and
+ISEARCH, ISEARCH-FILTER, ISEARCH-CURSOR-COLOR, ISEARCH-KEYMAP, and
ISEARCH-CALLBACK.
If KEYMAP is a keymap which is used when processing events during
@@ -1335,6 +1343,9 @@ PROMPT is a prompt string when reading events during
event loop.
If ISEARCH is non-nil, do isearch as soon as displaying the popup
menu.
+ISEARCH-FILTER is a filtering function taking two arguments:
+search pattern and list of items. Returns a list of matching items.
+
ISEARCH-CURSOR-COLOR is a cursor color during isearch. The
default value is `popup-isearch-cursor-color'.
@@ -1383,6 +1394,7 @@ If `INITIAL-INDEX' is non-nil, this is an initial index
value for
:prompt prompt
:help-delay help-delay
:isearch isearch
+ :isearch-filter isearch-filter
:isearch-cursor-color isearch-cursor-color
:isearch-keymap isearch-keymap
:isearch-callback isearch-callback)))
diff --git a/tests/popup-test.el b/tests/popup-test.el
index 3583288..7da821d 100644
--- a/tests/popup-test.el
+++ b/tests/popup-test.el
@@ -656,7 +656,7 @@ Qux" :nowait t)
foo
bar
baz")
- (popup-isearch-update popup "a")
+ (popup-isearch-update popup 'popup-isearch-filter-list "a")
(should (popup-test-helper-rectangle-match "\
bar
baz"))
- [nongnu] elpa/popup 13dbaf5 037/184: Change test helper spec, (continued)
- [nongnu] elpa/popup 13dbaf5 037/184: Change test helper spec, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup c0937ea 053/184: Truncate summary first, then string itself, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup a49ffd0 081/184: Rename :initial-cursor keyword option to :cursor., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 5809969 041/184: Add test case for margin, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup e5794f8 052/184: Truncate summary when it is too long, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 967cde1 067/184: Merge pull request #30 from tkf/summary-face, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup e164f3b 098/184: fixed without ignore-errors, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 34be113 116/184: Merge pull request #78 from aki2o/fix-popup-delete, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup dcc9ee5 119/184: Merge pull request #80 from ancane/master, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 0bead7c 086/184: Use cl-lib functions instead of cl in tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 29c6db4 130/184: Pass filtering function as an argument to popup-menu*,
ELPA Syncer <=
- [nongnu] elpa/popup 5374e55 110/184: Merge pull request #73 from auto-complete/add-initial-index-test, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 47008e1 135/184: Allow the user to specify a custom function to build the regexp in isearch, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 3d62f15 161/184: Merge pull request #112 from PuercoWork/patch-1, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup cf2cefe 166/184: Fixed compile warning, free variable from display line numbers., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 51f4430 171/184: Fixed to not use emacs 26.1 as dep., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 28762fc 138/184: Improve definition, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 88efff5 010/184: Not to insert newlines., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup bb4bb26 019/184: git mv popup-test.el tests/popup-interactive-test.el, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 07901c6 023/184: Merge pull request #15 from tkf/travis-ci, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 31779da 028/184: Fix test case bug when batch mode., ELPA Syncer, 2021/10/06