The following loop hangs my emacs (even when called with -q) to the point that I have to force quit it.

(let ((buffs (buffer-list)))
  (while buffs
    (delq (car buffs) buffs)
    (print (cadr buffs))))

I don't understand why this should happen, but is there something I can do to recover from a hanging Emacs?

  • My understanding of the word "crash" is "exiting badly" possibly with a segfault or something like that. Apparently this is not what you mean. – JeanPierre Oct 12 '16 at 10:13
  • You are right. Hanging is a better word. I'll edit – dangom Oct 12 '16 at 10:15

I guess since youre saving the result of buffer-list, buffs never evaluates to a falsy value. You should update the buffs variable by seting it to the return vaulue of your delq.

(setq buffs (delq (car buffs) buffs))

Not the answer you're looking for? Browse other questions tagged or ask your own question.