[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/popup 2687612 132/184: Merge pull request #91 from ancane/
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/popup 2687612 132/184: Merge pull request #91 from ancane/master |
Date: |
Wed, 6 Oct 2021 00:01:28 -0400 (EDT) |
branch: elpa/popup
commit 2687612766f87acd5296a4e65696c5295287314a
Merge: 2af1c6c dbf62bf
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>
Merge pull request #91 from ancane/master
Pass filtering function as an argument to popup-menu*
---
README.md | 8 ++++++--
popup.el | 28 ++++++++++++++++++++--------
tests/popup-test.el | 2 +-
3 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index 17e1a8c..3749b65 100644
--- a/README.md
+++ b/README.md
@@ -273,13 +273,14 @@ select an item of a list.
popup-menu* list &key point around width height margin margin-left
margin-right scroll-bar symbol parent parent-offset keymap
- fallback help-delay nowait prompt isearch isearch-cursor-color
+ fallback help-delay nowait prompt isearch isearch-filter
isearch-cursor-color
isearch-keymap isearch-callback initial-index => selected-value
Show a popup menu of `LIST` at `POINT`. This function returns the value
of the selected item. Almost all arguments are same as `popup-create`
except for `KEYMAP`, `FALLBACK`, `HELP-DELAY`, `PROMPT`, `ISEARCH`,
-`ISEARCH-CURSOR-COLOR`, `ISEARCH-KEYMAP`, and `ISEARCH-CALLBACK`.
+`ISEARCH-FILTER`, `ISEARCH-CURSOR-COLOR`, `ISEARCH-KEYMAP`
+and `ISEARCH-CALLBACK`.
If `KEYMAP` is provided, it is a keymap which is used when processing
events during event loop.
@@ -299,6 +300,9 @@ instance without entering 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'.
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 9587ace 085/184: Merge pull request #55 from auto-complete/fix-bytecompile-warnings, (continued)
- [nongnu] elpa/popup 9587ace 085/184: Merge pull request #55 from auto-complete/fix-bytecompile-warnings, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup d70cff9 101/184: Merge pull request #64 from aki2o/cascade-isearch, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup c02ec73 111/184: Apply the patch of #8., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 895d031 123/184: Add MELPA badges, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup d8fe6b0 102/184: Use Cask instead of 'git submodule', ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 649242e 118/184: :initial-index respects real popup height(beyond first popup page), ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 2bb4bce 115/184: fix error on popup-delete when char-before return nil, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 1f817d6 097/184: fixed deficient help-delay, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup becfbdd 099/184: Merge pull request #63 from aki2o/fix-deficient-help-delay, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup c3ebfba 094/184: Merge pull request #61 from auto-complete/add-nostrip-documentation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 2687612 132/184: Merge pull request #91 from ancane/master,
ELPA Syncer <=
- [nongnu] elpa/popup 4438b94 136/184: Merge pull request #95 from Konubinix/master, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 4dbed57 137/184: Update cl-lib version, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 0a6447b 157/184: correct spelling mistake, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 98965e8 156/184: Fix typo in the docstring of popup-x-string, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup a7ed816 174/184: Upate license year., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 13364d7 173/184: Add more Emacs version for CI test., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 866a091 178/184: Add homepage url, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 4abbbf9 146/184: Merge pull request #99 from spwhitton/apt-get, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup e452399 153/184: Add popup-isearch-yank., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup b436b63 168/184: Merge pull request #111 from drvink/patch-1, ELPA Syncer, 2021/10/06