[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dict-tree f0af36e 148/154: Fix byte-compilation of func
From: |
Stefan Monnier |
Subject: |
[elpa] externals/dict-tree f0af36e 148/154: Fix byte-compilation of functions embedded in dict-trees. |
Date: |
Mon, 14 Dec 2020 12:22:04 -0500 (EST) |
branch: externals/dict-tree
commit f0af36ef541724dfd944651bb5d01a33cf0c1199
Author: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Fix byte-compilation of functions embedded in dict-trees.
---
dict-tree.el | 231 +++++++++++++++++++++++++++++++----------------------------
1 file changed, 121 insertions(+), 110 deletions(-)
diff --git a/dict-tree.el b/dict-tree.el
index 8124fea..a6358aa 100644
--- a/dict-tree.el
+++ b/dict-tree.el
@@ -1,9 +1,9 @@
;;; dict-tree.el --- Dictionary data structure -*- lexical-binding: t; -*-
-;; Copyright (C) 2004-2015, 2017-2018 Free Software Foundation, Inc
+;; Copyright (C) 2004-2015, 2017-2019 Free Software Foundation, Inc
;; Author: Toby Cubitt <toby-predictive@dr-qubit.org>
-;; Version: 0.15
+;; Version: 0.16
;; Keywords: extensions, matching, data structures
;; trie, tree, dictionary, completion, regexp
;; Package-Requires: ((trie "0.3) (tNFA "0.1.1") (heap "0.3"))
@@ -221,27 +221,29 @@ If START or END is negative, it counts from the end."
;; Wrapping functions
;; return wrapped insfun to deal with data wrapping
-(dictree--if-lexical-binding
- (defun dictree--wrap-insfun (insfun) ; INTERNAL USE ONLY
- (lambda (new old)
- (dictree--cell-set-data old (funcall insfun
- (dictree--cell-data new)
- (dictree--cell-data old)))
- old))
+(defun dictree--wrap-insfun (insfun) ; INTERNAL USE ONLY
+ (lambda (new old)
+ (dictree--cell-set-data old (funcall insfun
+ (dictree--cell-data new)
+ (dictree--cell-data old)))
+ old))
+
+(dictree--if-lexical-binding nil
(defun dictree--wrap-insfun (insfun) ; INTERNAL USE ONLY
`(lambda (new old)
(dictree--cell-set-data old (,insfun (dictree--cell-data new)
- (dictree--cell-data old)))
+ (dictree--cell-data old)))
old)))
;; return wrapped rankfun to deal with data wrapping
-(dictree--if-lexical-binding
- (defun dictree--wrap-rankfun (rankfun) ; INTERNAL USE ONLY
- (lambda (a b)
- (funcall rankfun
- (cons (car a) (dictree--cell-data (cdr a)))
- (cons (car b) (dictree--cell-data (cdr b))))))
+(defun dictree--wrap-rankfun (rankfun) ; INTERNAL USE ONLY
+ (lambda (a b)
+ (funcall rankfun
+ (cons (car a) (dictree--cell-data (cdr a)))
+ (cons (car b) (dictree--cell-data (cdr b))))))
+
+(dictree--if-lexical-binding nil
(defun dictree--wrap-rankfun (rankfun) ; INTERNAL USE ONLY
`(lambda (a b)
(,rankfun (cons (car a) (dictree--cell-data (cdr a)))
@@ -249,23 +251,24 @@ If START or END is negative, it counts from the end."
;; return wrapped rankfun to ignore regexp grouping data
-(dictree--if-lexical-binding
- (defun dictree--wrap-regexp-rankfun (rankfun)
- (lambda (a b)
- ;; if car of argument contains a key+group list rather than a straight
- ;; key, remove group list
- ;; FIXME: the test for straight key, below, will fail if the key is a
- ;; list, and the first element of the key is itself a list
- ;; (there might be no easy way to fully fix this...)
- (if (or (atom (car a))
- (and (listp (car a)) (not (sequencep (caar a)))))
- (setq a (cons (car a) (dictree--cell-data (cdr a))))
- (setq a (cons (caar a) (dictree--cell-data (cdr a)))))
- (if (or (atom (car b))
- (and (listp (car b)) (not (sequencep (caar b)))))
- (setq b (cons (car b) (dictree--cell-data (cdr b))))
- (setq b (cons (caar b) (dictree--cell-data (cdr b)))))
- (funcall rankfun a b)))
+(defun dictree--wrap-regexp-rankfun (rankfun)
+ (lambda (a b)
+ ;; if car of argument contains a key+group list rather than a straight
+ ;; key, remove group list
+ ;; FIXME: the test for straight key, below, will fail if the key is a
+ ;; list, and the first element of the key is itself a list
+ ;; (there might be no easy way to fully fix this...)
+ (if (or (atom (car a))
+ (and (listp (car a)) (not (sequencep (caar a)))))
+ (setq a (cons (car a) (dictree--cell-data (cdr a))))
+ (setq a (cons (caar a) (dictree--cell-data (cdr a)))))
+ (if (or (atom (car b))
+ (and (listp (car b)) (not (sequencep (caar b)))))
+ (setq b (cons (car b) (dictree--cell-data (cdr b))))
+ (setq b (cons (caar b) (dictree--cell-data (cdr b)))))
+ (funcall rankfun a b)))
+
+(dictree--if-lexical-binding nil
(defun dictree--wrap-regexp-rankfun (rankfun)
`(lambda (a b)
;; if car of argument contains a key+group list rather than a straight
@@ -274,61 +277,63 @@ If START or END is negative, it counts from the end."
;; list, and the first element of the key is itself a list
;; (there might be no easy way to fully fix this...)
(if (or (atom (car a))
- (and (listp (car a)) (not (sequencep (caar a)))))
- (setq a (cons (car a) (dictree--cell-data (cdr a))))
+ (and (listp (car a)) (not (sequencep (caar a)))))
+ (setq a (cons (car a) (dictree--cell-data (cdr a))))
(setq a (cons (caar a) (dictree--cell-data (cdr a)))))
(if (or (atom (car b))
- (and (listp (car b)) (not (sequencep (caar b)))))
- (setq b (cons (car b) (dictree--cell-data (cdr b))))
+ (and (listp (car b)) (not (sequencep (caar b)))))
+ (setq b (cons (car b) (dictree--cell-data (cdr b))))
(setq b (cons (caar b) (dictree--cell-data (cdr b)))))
(,rankfun a b))))
;; return wrapped sortfun to ignore regexp grouping data
-(dictree--if-lexical-binding
- (defun dictree--wrap-regexp-sortfun (cmpfun &optional reverse)
- (let ((sortfun (trie-construct-sortfun cmpfun reverse)))
- (lambda (a b)
- ;; if car of argument contains a key+group list rather than a
- ;; straight key, remove group list
- ;; FIXME: the test for straight key, below, will fail if the key
- ;; is a list, and the first element of the key is itself a
- ;; list (there might be no easy way to fully fix this...)
- (if (or (atom (car a))
- (and (listp (car a)) (not (sequencep (caar a)))))
- (setq a (car a))
- (setq a (caar a)))
- (if (or (atom (car b))
- (and (listp (car b)) (not (sequencep (caar b)))))
- (setq b (car b))
- (setq b (caar b)))
- (funcall sortfun a b))))
+(defun dictree--wrap-regexp-sortfun (cmpfun &optional reverse)
+ (let ((sortfun (trie-construct-sortfun cmpfun reverse)))
+ (lambda (a b)
+ ;; if car of argument contains a key+group list rather than a
+ ;; straight key, remove group list
+ ;; FIXME: the test for straight key, below, will fail if the key
+ ;; is a list, and the first element of the key is itself a
+ ;; list (there might be no easy way to fully fix this...)
+ (if (or (atom (car a))
+ (and (listp (car a)) (not (sequencep (caar a)))))
+ (setq a (car a))
+ (setq a (caar a)))
+ (if (or (atom (car b))
+ (and (listp (car b)) (not (sequencep (caar b)))))
+ (setq b (car b))
+ (setq b (caar b)))
+ (funcall sortfun a b))))
+
+(dictree--if-lexical-binding nil
(defun dictree--wrap-regexp-sortfun (cmpfun &optional reverse)
(let ((sortfun (trie-construct-sortfun cmpfun reverse)))
`(lambda (a b)
- ;; if car of argument contains a key+group list rather than a
- ;; straight key, remove group list
- ;; FIXME: the test for straight key, below, will fail if the key
- ;; is a list, and the first element of the key is itself a
- ;; list (there might be no easy way to fully fix this...)
- (if (or (atom (car a))
- (and (listp (car a)) (not (sequencep (caar a)))))
- (setq a (car a))
- (setq a (caar a)))
- (if (or (atom (car b))
- (and (listp (car b)) (not (sequencep (caar b)))))
- (setq b (car b))
- (setq b (caar b)))
- (,sortfun a b)))))
+ ;; if car of argument contains a key+group list rather than a
+ ;; straight key, remove group list
+ ;; FIXME: the test for straight key, below, will fail if the key
+ ;; is a list, and the first element of the key is itself a
+ ;; list (there might be no easy way to fully fix this...)
+ (if (or (atom (car a))
+ (and (listp (car a)) (not (sequencep (caar a)))))
+ (setq a (car a))
+ (setq a (caar a)))
+ (if (or (atom (car b))
+ (and (listp (car b)) (not (sequencep (caar b)))))
+ (setq b (car b))
+ (setq b (caar b)))
+ (,sortfun a b)))))
;; return wrapped rankfun to deal with data wrapping and ignore fuzzy query
;; distance data. Note: works for both fuzzy-matching and fuzzy-completion.
-(dictree--if-lexical-binding
- (defun dictree--wrap-fuzzy-rankfun (rankfun) ; INTERNAL USE ONLY
- (lambda (a b)
- (funcall rankfun
- (cons (car a) (dictree--cell-data (cdr a)))
- (cons (car b) (dictree--cell-data (cdr b))))))
+(defun dictree--wrap-fuzzy-rankfun (rankfun) ; INTERNAL USE ONLY
+ (lambda (a b)
+ (funcall rankfun
+ (cons (car a) (dictree--cell-data (cdr a)))
+ (cons (car b) (dictree--cell-data (cdr b))))))
+
+(dictree--if-lexical-binding nil
(defun dictree--wrap-fuzzy-rankfun (rankfun) ; INTERNAL USE ONLY
`(lambda (a b)
(,rankfun (cons (car a) (dictree--cell-data (cdr a)))
@@ -363,25 +368,27 @@ If START or END is negative, it counts from the end."
;; return wrapped sortfun to ignore fuzzy query distance data
-(dictree--if-lexical-binding
- (defun dictree--wrap-fuzzy-sortfun (cmpfun &optional reverse)
- (let ((sortfun (trie-construct-sortfun cmpfun reverse)))
- (lambda (a b) (funcall sortfun (car a) (car b)))))
+(defun dictree--wrap-fuzzy-sortfun (cmpfun &optional reverse)
+ (let ((sortfun (trie-construct-sortfun cmpfun reverse)))
+ (lambda (a b) (funcall sortfun (car a) (car b)))))
+
+(dictree--if-lexical-binding nil
(defun dictree--wrap-fuzzy-sortfun (cmpfun &optional reverse)
(let ((sortfun (trie-construct-sortfun cmpfun reverse)))
`(lambda (a b) (,sortfun (car a) (car b))))))
;; return wrapped combfun to deal with data wrapping
-(dictree--if-lexical-binding
- (defun dictree--wrap-combfun (combfun) ; INTERNAL USE ONLY
- (lambda (cell1 cell2)
- (dictree--cell-create
- (funcall combfun
- (dictree--cell-data cell1)
- (dictree--cell-data cell2))
- (append (dictree--cell-plist cell1)
- (dictree--cell-plist cell2)))))
+(defun dictree--wrap-combfun (combfun) ; INTERNAL USE ONLY
+ (lambda (cell1 cell2)
+ (dictree--cell-create
+ (funcall combfun
+ (dictree--cell-data cell1)
+ (dictree--cell-data cell2))
+ (append (dictree--cell-plist cell1)
+ (dictree--cell-plist cell2)))))
+
+(dictree--if-lexical-binding nil
(defun dictree--wrap-combfun (combfun) ; INTERNAL USE ONLY
`(lambda (cell1 cell2)
(dictree--cell-create
@@ -392,34 +399,37 @@ If START or END is negative, it counts from the end."
;; return wrapped filter function to deal with data wrapping
-(dictree--if-lexical-binding
- (defun dictree--wrap-filter (filter) ; INTERNAL USE ONLY
- (lambda (key data) (funcall filter key (dictree--cell-data data))))
+(defun dictree--wrap-filter (filter) ; INTERNAL USE ONLY
+ (lambda (key data) (funcall filter key (dictree--cell-data data))))
+
+(dictree--if-lexical-binding nil
(defun dictree--wrap-filter (filter) ; INTERNAL USE ONLY
`(lambda (key data) (,filter key (dictree--cell-data data)))))
;; return wrapped result function to deal with data wrapping
-(dictree--if-lexical-binding
- (defun dictree--wrap-resultfun (resultfun) ; INTERNAL USE ONLY
- (lambda (res)
- (funcall resultfun (car res) (dictree--cell-data (cdr res)))))
+(defun dictree--wrap-resultfun (resultfun) ; INTERNAL USE ONLY
+ (lambda (res)
+ (funcall resultfun (car res) (dictree--cell-data (cdr res)))))
+
+(dictree--if-lexical-binding nil
(defun dictree--wrap-resultfun (resultfun) ; INTERNAL USE ONLY
`(lambda (res) (,resultfun (car res) (dictree--cell-data (cdr res))))))
;; construct lexicographic sort function from DICT's comparison function.
;; ACCESSOR is used to obtain the sort key, defaulting to `car'.
-;;(dictree--if-lexical-binding
(defun dictree--construct-sortfun (comparison-function &optional accessor) ;
INTERNAL USE ONLY
(unless accessor (setq accessor #'car))
(let ((sortfun (trie-construct-sortfun comparison-function)))
(lambda (a b)
(funcall sortfun (funcall accessor a) (funcall accessor b)))))
- ;; (defun dictree--construct-sortfun (dict &optional accessor) ; INTERNAL
USE ONLY
- ;; `(lambda (a b)
- ;; (,(trie-construct-sortfun (dictree-comparison-function dict))
- ;; (,accessor a) (,accessor b)))))
+
+(dictree--if-lexical-binding nil
+ (defun dictree--construct-sortfun (dict &optional accessor) ; INTERNAL USE
ONLY
+ `(lambda (a b)
+ (,(trie-construct-sortfun (dictree-comparison-function dict))
+ (,accessor a) (,accessor b)))))
@@ -2093,19 +2103,20 @@ Interactively, DICT is read from the mini-buffer."
;; Wrap SORTFUN, which sorts keys, so it can act on dictree--meta-stack
;; elements.
-(dictree--if-lexical-binding
- (defun dictree--construct-meta-stack-heapfun (sortfun &optional reverse)
- (if reverse
- (lambda (b a) (funcall sortfun (car (dictree-stack-first a))
- (car (dictree-stack-first b))))
- (lambda (a b) (funcall sortfun (car (dictree-stack-first a))
- (car (dictree-stack-first b))))))
+(defun dictree--construct-meta-stack-heapfun (sortfun &optional reverse)
+ (if reverse
+ (lambda (b a) (funcall sortfun (car (dictree-stack-first a))
+ (car (dictree-stack-first b))))
+ (lambda (a b) (funcall sortfun (car (dictree-stack-first a))
+ (car (dictree-stack-first b))))))
+
+(dictree--if-lexical-binding nil
(defun dictree--construct-meta-stack-heapfun (sortfun &optional reverse)
(if reverse
- `(lambda (b a) (,sortfun (car (dictree-stack-first a))
- (car (dictree-stack-first b))))
+ `(lambda (b a) (,sortfun (car (dictree-stack-first a))
+ (car (dictree-stack-first b))))
`(lambda (a b) (,sortfun (car (dictree-stack-first a))
- (car (dictree-stack-first b)))))))
+ (car (dictree-stack-first b)))))))
(defun* dictree-stack (dict &key type reverse pfxfilter)
- [elpa] externals/dict-tree d84725e 124/154: Bump version numbers since we've added iterator generators., (continued)
- [elpa] externals/dict-tree d84725e 124/154: Bump version numbers since we've added iterator generators., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree f47d49c 137/154: Bug fixes to meta-dict fuzzy-matching/completing., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 65b94b4 131/154: Bump version numbers., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree c737d3a 134/154: Make use of new trie-fuzzy-complete facilities., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree eec26c3 132/154: Fix trie--construct-Lewenstein-rankfun to new versions., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 5e2ffac 136/154: Test for lexical binding must be within same file to work reliably., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 22d0e13 140/154: Sort completions by fuzzy dist before ngram length., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 67afade 151/154: Document PFXFILTER argument to query functions., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 4299171 150/154: Work around Emacs bug preventing dict-tree caching., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 22d569e 153/154: Improve error reporting when reading dictionary data from dumped file., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree f0af36e 148/154: Fix byte-compilation of functions embedded in dict-trees.,
Stefan Monnier <=
- [elpa] externals/dict-tree dd695da 147/154: Display more informative message during writing dict to file., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 45270bc 144/154: Cache all queries, not just those with named function arguments., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 1db3424 128/154: Fix quoting of ' in one docstring., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 77f7b3a 133/154: Minor code refactoring., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 63b59a2 135/154: Implement fuzzy-completion with fixed initial prefix segment., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 4381f72 114/154: Generate caches as needed instead of at dict-tree creation., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree ad600f8 116/154: Fix data wrapping handling in fuzzy query functions., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 8d134c2 110/154: Fix bug in dictree-create with empty NAME argument., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 3c4b666 142/154: Refactored and rationalised dict saving/loading code., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree f232541 121/154: Merge updates to pretty-printy and docstring fixes from ELPA., Stefan Monnier, 2020/12/14