Subject: 24.0.90; eshell:for command destructivly modifies list variables

From: Andreas Politz <[email-masked]>
Date: Sun, 30 Oct 2011 01:09:06 +0200

M-x eshell

$ for l in $load-path {echo $l}

Do this two times. After the first time the value of `load-path' is
gone, because the lisp code implementing the loop destructively modifies
this list.  Idea of the following solution: Copy it.

diff -c -L /usr/share/emacs/24.0.90/lisp/eshell/esh-cmd.el.gz -L \#\<buffer\ esh-cmd.el.gz\> /tmp/jka-com2122MHr /tmp/buffer-content-2122LbA
*** /usr/share/emacs/24.0.90/lisp/eshell/esh-cmd.el.gz
--- #<buffer esh-cmd.el.gz>
***************
*** 494,500 ****
  			       (if (listp elem)
  				   elem
  				 (list 'list elem))))
! 			    (cdr (cddr terms)))))
  		    (list 'eshell-command-body
  			  (list 'quote (list nil)))
  		    (list 'eshell-test-body
--- 494,501 ----
  			       (if (listp elem)
  				   elem
  				 (list 'list elem))))
! 			    (cdr (cddr terms)))
!                            (list nil)))
  		    (list 'eshell-command-body
  			  (list 'quote (list nil)))
  		    (list 'eshell-test-body