Subject: Re: bug#18522: 24.4.50; mapcar is very slow

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 29 Feb 2016 13:21:50 +1100

Peter Münster <[email-masked]> writes:

> And then I have to stop it with C-g because it hangs...

Probably a circular list somewhere.  Try the following:

(let ((table (make-hash-table :test 'eq)))
  (mapatoms
   (lambda (symbol)
     (when (boundp symbol)
       (let ((value (symbol-value symbol)))
	 (while (and (consp value)
		     (not (gethash value table)))
	   (let ((elem (car value)))
	     (when (bufferp elem)
	       (message "%s has a buffer %s"
			symbol (buffer-name elem))))
	   (setf (gethash value table) t)
	   (setq value (cdr value))))))
   obarray))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no