[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/trie 1e246d0 009/111: Bug-fix to remove setf inside bac
From: |
Stefan Monnier |
Subject: |
[elpa] externals/trie 1e246d0 009/111: Bug-fix to remove setf inside backquote construct from trie-insert |
Date: |
Mon, 14 Dec 2020 11:35:10 -0500 (EST) |
branch: externals/trie
commit 1e246d0a97d2a20e56a9c47e862ce696bb92c008
Author: Toby Cubitt <toby-predictive@dr-qubit.org>
Commit: tsc25 <toby-predictive@dr-qubit.org>
Bug-fix to remove setf inside backquote construct from trie-insert
---
trie.el | 50 ++++++++++++++++++++++----------------------------
1 file changed, 22 insertions(+), 28 deletions(-)
diff --git a/trie.el b/trie.el
index 55816e4..4c2dca0 100644
--- a/trie.el
+++ b/trie.el
@@ -271,13 +271,7 @@ reversed if REVERSE is non-nil."
(cond
((eq type 'avl) 'avl-tree-stack-empty-p)
(t (error "trie--create: unknown trie TYPE, %s" type))))
- (cmpfun `(lambda (a b)
- (setq a (trie--node-split a)
- b (trie--node-split b))
- (cond ((eq a 'trie--terminator)
- (if (eq b 'trie--terminator) nil t))
- ((eq b 'trie--terminator) nil)
- (t (,comparison-function a b)))))
+ (cmpfun (trie--wrap-cmpfun comparison-function))
(root (trie--node-create-root createfun cmpfun))
))
(:constructor trie--create-custom
@@ -293,13 +287,7 @@ reversed if REVERSE is non-nil."
(stack-popfun 'avl-tree-stack-pop)
(stack-emptyfun 'avl-tree-stack-empty-p)
&aux
- (cmpfun `(lambda (a b)
- (setq a (trie--node-split a)
- b (trie--node-split b))
- (cond ((eq a 'trie--terminator)
- (if (eq b 'trie--terminator) nil t))
- ((eq b 'trie--terminator) nil)
- (t (,comparison-function a b)))))
+ (cmpfun (trie--wrap-cmpfun comparison-function))
(root (trie--node-create-root createfun cmpfun))
))
(:copier nil))
@@ -308,15 +296,16 @@ reversed if REVERSE is non-nil."
stack-createfun stack-popfun stack-emptyfun)
-(defmacro trie--wrap-cmpfun (cmpfun)
+(defun trie--wrap-cmpfun (cmpfun)
;; wrap CMPFUN for use in a subtree
- `(lambda (a b)
- (setq a (trie--node-split a)
- b (trie--node-split b))
- (cond ((eq a 'trie--terminator)
- (if (eq b 'trie--terminator) nil t))
- ((eq b 'trie--terminator) nil)
- (t (,cmpfun a b)))))
+ (byte-compile
+ `(lambda (a b)
+ (setq a (trie--node-split a)
+ b (trie--node-split b))
+ (cond ((eq a 'trie--terminator)
+ (if (eq b 'trie--terminator) nil t))
+ ((eq b 'trie--terminator) nil)
+ (t (,cmpfun a b))))))
@@ -900,12 +889,17 @@ Returns the new association of KEY."
;; wrap it for passing to `trie--insertfun'.
(when (and trie-insert--old-node-flag trie-insert--updatefun)
(setq trie-insert--update-old
- (eval (macroexpand
- `(lambda (new old)
- (setf (trie--node-data old)
- (,trie-insert--updatefun (trie--node-data new)
- (trie--node-data old)))
- old)))))
+ (lambda (new old)
+ (setf (trie--node-data old)
+ ;; FIXME: trie-insert--updatefun ought to be safely
+ ;; protected by a lexical closure...except Emacs
+ ;; doesn't have them, so there's a risk of a nasty
+ ;; dynamical scoping bug if UPDATEFUN refers to
+ ;; trie-insert--updatefun
+ (funcall trie-insert--updatefun
+ (trie--node-data new)
+ (trie--node-data old)))
+ old)))
;; Create or update data node.
(setq node (funcall (trie--insertfun trie)
(trie--node-subtree node)
- [elpa] externals/trie 510844e 035/111: trivial variable name change, (continued)
- [elpa] externals/trie 510844e 035/111: trivial variable name change, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 4b24754 008/111: Converted function wrapping macros into functions, Stefan Monnier, 2020/12/14
- [elpa] externals/trie a17e6df 056/111: Minor bug-fixes to [trie/dict-tree]--edebug-pretty-print, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 3b61c64 065/111: More minor whitespace and commentary changes., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 19e6dbe 010/111: Make weird variable names used to avoid dynamic scoping bugs more consistent, Stefan Monnier, 2020/12/14
- [elpa] externals/trie ae8bf27 036/111: minor code tidying, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 0c21bf4 073/111: Add note to self to use cust-print pretty-printing instead of advice., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 490c011 025/111: Bug fixes to trie--wildcard-stack-repopulate, Stefan Monnier, 2020/12/14
- [elpa] externals/trie f398b8e 063/111: Updated copyright attribution and license (GPL2 -> GPL3)., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 14fa4ee 075/111: Code cleanup., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 1e246d0 009/111: Bug-fix to remove setf inside backquote construct from trie-insert,
Stefan Monnier <=
- [elpa] externals/trie ecf872e 061/111: Updated Package-Version, Package-Requires, and Keywords package headers., Stefan Monnier, 2020/12/14
- [elpa] externals/trie d746b4d 017/111: Added safeguards to throw errors if stack operations attempted, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 304b8e9 059/111: Added fboundp guard around ad-define-subr-args (removed in Emacs-24)., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 0ecad1b 016/111: Fixed avl type trie--createfun to accept (and ignore) extra seq argument, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 1b3b473 031/111: Another bug-fix in trie--do-wildcard-search, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 333151b 045/111: Bug-fix in trie--do-regexp-search relating to accumulation of results, Stefan Monnier, 2020/12/14
- [elpa] externals/trie cc94506 070/111: Enable lexical binding, and fix issues it picks up., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 6a449ed 049/111: Improved edebug-prin1 advice, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 7bf9008 100/111: Implement fuzzy-completion with fixed initial prefix segment., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 3117b5b 076/111: Fix bugs in trie searches introduced by code cleanup., Stefan Monnier, 2020/12/14