emacs-diffs
[Top][All Lists]
Advanced

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

master 417d53d: Fix `uniquify-managed' unbounded growth


From: Lars Ingebrigtsen
Subject: master 417d53d: Fix `uniquify-managed' unbounded growth
Date: Wed, 12 May 2021 11:36:33 -0400 (EDT)

branch: master
commit 417d53db2bcafeab54b37c59667f8dee63ffd0fb
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix `uniquify-managed' unbounded growth
    
    * lisp/uniquify.el (uniquify-rationalize-file-buffer-names):
    Protect against exponential `uniquify-managed' growth when
    reverting several (more than two) buffers that have the same file
    name (bug#36877).
---
 lisp/uniquify.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/uniquify.el b/lisp/uniquify.el
index 7cc0168..ffb5ecc 100644
--- a/lisp/uniquify.el
+++ b/lisp/uniquify.el
@@ -246,7 +246,14 @@ this rationalization."
                              (if (buffer-live-p (uniquify-item-buffer item))
                                  item))
                            items)))
-         (setq fix-list (append fix-list items))))
+          ;; Other buffer's `uniquify-managed' lists may share
+          ;; elements.  Ensure that we don't add these elements more
+          ;; than once to this buffer's `uniquify-managed' list.
+          (let ((new-items nil))
+            (dolist (item items)
+              (unless (memq item fix-list)
+                (push item new-items)))
+           (setq fix-list (append fix-list new-items)))))
       ;; selects buffers whose names may need changing, and others that
       ;; may conflict, then bring conflicting names together
       (uniquify-rationalize fix-list))))



reply via email to

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