[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7c122ed 2/2: * el-search/el-search.el: Fix heuristic match
From: |
Michael Heerdegen |
Subject: |
[elpa] master 7c122ed 2/2: * el-search/el-search.el: Fix heuristic matcher for 'nil |
Date: |
Sat, 12 May 2018 12:58:01 -0400 (EDT) |
branch: master
commit 7c122edd324ac92b0db0e03e1b51dec50b3a55c8
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>
* el-search/el-search.el: Fix heuristic matcher for 'nil
(el-search-heuristic-matcher): Special case 'nil.
---
packages/el-search/el-search.el | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index b65bd9e..e2b7179 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -1187,6 +1187,8 @@ matcher function is constructed by recursively
destructuring the
PATTERN and combining the heuristic matchers of the subpatterns."
(pcase pattern
((pred symbolp) #'el-search-true)
+ (''nil ; special case: don't miss occurrences in text like "(1 . nil)"
+ #'el-search-true)
((pred pcase--self-quoting-p) (lambda (_ atoms-thunk) (member pattern
(thunk-force atoms-thunk))))
(`',tree
(pcase (el-search--flatten-tree tree)
@@ -1239,7 +1241,9 @@ PATTERN and combining the heuristic matchers of the
subpatterns."
(defvar el-search--atom-list-cache (make-hash-table :test #'equal :size 1000))
(defun el-search-atom-list (file-name-or-buffer)
- "Return a list of el-search-atomic expressions in FILE-NAME-OR-BUFFER."
+ "Return a list of el-search-atomic expressions in FILE-NAME-OR-BUFFER.
+`nil' atoms may be missing from the list for code like
+\"(1 . nil)\")."
(let ((get-buffer-atoms
(lambda () (apply #'append
(mapcar #'el-search--flatten-tree