emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/auto-overlays a73aeff 51/93: Use eq for comparison when


From: Stefan Monnier
Subject: [elpa] externals/auto-overlays a73aeff 51/93: Use eq for comparison when adding to auto-o-pending-suicides, instead of equal
Date: Mon, 14 Dec 2020 13:00:36 -0500 (EST)

branch: externals/auto-overlays
commit a73aeff70abd82650a00902565e2d1898150cde5
Author: Toby Cubitt <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>

    Use eq for comparison when adding to auto-o-pending-suicides, instead of 
equal
    (via add-to-list), in an attempt to avoid "stack overflow in equal" error.
---
 auto-overlays.el | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/auto-overlays.el b/auto-overlays.el
index bb35b34..2146b77 100644
--- a/auto-overlays.el
+++ b/auto-overlays.el
@@ -457,8 +457,7 @@ Comparison is done with 'eq."
       (while (setq el (nth i alist))
        (when (eq key (car el)) (throw 'found i))
        (setq i (1+ i))
-       nil)))
-)
+       nil))))
 
 
 
@@ -471,8 +470,7 @@ Comparison is done with 'equal."
       (while (setq el (nth i list))
        (when (equal item el) (throw 'found i))
        (setq i (1+ i))
-       nil)))
-)
+       nil))))
 
 
 
@@ -493,9 +491,13 @@ If START or END is negative, it counts from the end."
       (while (< start end)
        (push (nth start list) res)
        (setq start (1+ start)))
-      (nreverse res)))
-)
+      (nreverse res))))
+
 
+(defmacro auto-o-adjoin (item list)
+  "Cons ITEM onto front of LIST if it's not already there.
+Comparison is done with `eq'."
+  `(if (memq ,item ,list) ,list (setf ,list (cons ,item ,list))))
 
 
 
@@ -1202,7 +1204,7 @@ overlays were saved."
   (unless (= len 0)
     (dolist (o (auto-overlays-at-point nil '(identity auto-overlay-match)))
       (when (or (= (overlay-end o) start) (= (overlay-start o) end))
-       (add-to-list 'auto-o-pending-suicides o)))))
+       (auto-o-adjoin o auto-o-pending-suicides)))))
 
 
 
@@ -1210,7 +1212,7 @@ overlays were saved."
   ;; Schedule `auto-o-suicide' to run after buffer modification is
   ;; complete. It will be run by `auto-o-run-after-change-functions'. Assigned
   ;; to overlay modification and insert in-front/behind hooks.
-  (unless modified (add-to-list 'auto-o-pending-suicides o-self)))
+  (unless modified (auto-o-adjoin o-self auto-o-pending-suicides)))
 
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]