all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Modifying literal lists in Emacs lisp?
@ 2014-06-13 10:14 Nicolas Petton
  2014-06-13 16:01 ` Drew Adams
  2014-06-13 20:13 ` Nicolas Richard
  0 siblings, 2 replies; 6+ messages in thread
From: Nicolas Petton @ 2014-06-13 10:14 UTC (permalink / raw
  To: help-gnu-emacs

Hi,

In Common Lisp one should not modify literal lists because of possible
shared conses.

I was wondering if it is the same in Emacs Lisp, but I couldn't find
anything in the documentattion.

Cheers,
Nico





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Modifying literal lists in Emacs lisp?
       [not found] <mailman.3583.1402673918.1147.help-gnu-emacs@gnu.org>
@ 2014-06-13 15:57 ` Barry Margolin
  2014-06-13 18:59 ` Stefan Monnier
  1 sibling, 0 replies; 6+ messages in thread
From: Barry Margolin @ 2014-06-13 15:57 UTC (permalink / raw
  To: help-gnu-emacs

In article <mailman.3583.1402673918.1147.help-gnu-emacs@gnu.org>,
 Nicolas Petton <petton.nicolas@gmail.com> wrote:

> Hi,
> 
> In Common Lisp one should not modify literal lists because of possible
> shared conses.
> 
> I was wondering if it is the same in Emacs Lisp, but I couldn't find
> anything in the documentattion.

Yes, you should not do it for the exact same reason. There have been 
many threads in the Emacs newsgroups about the failures that result.

I don't know if it's documented (I've been searching and can't find it 
either), but it works essentially the same way as in CL.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Modifying literal lists in Emacs lisp?
  2014-06-13 10:14 Nicolas Petton
@ 2014-06-13 16:01 ` Drew Adams
  2014-06-13 20:13 ` Nicolas Richard
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2014-06-13 16:01 UTC (permalink / raw
  To: Nicolas Petton, help-gnu-emacs

> In Common Lisp one should not modify literal lists because of possible
> shared conses.
> 
> I was wondering if it is the same in Emacs Lisp, but I couldn't find
> anything in the documentattion.

The same is a good idea in any Lisp.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Modifying literal lists in Emacs lisp?
       [not found] <mailman.3583.1402673918.1147.help-gnu-emacs@gnu.org>
  2014-06-13 15:57 ` Modifying literal lists in Emacs lisp? Barry Margolin
@ 2014-06-13 18:59 ` Stefan Monnier
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2014-06-13 18:59 UTC (permalink / raw
  To: help-gnu-emacs

> I was wondering if it is the same in Emacs Lisp, but I couldn't find
> anything in the documentattion.

Not only that, but I recommend to avoid modifying conses in general.


        Stefan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Modifying literal lists in Emacs lisp?
  2014-06-13 10:14 Nicolas Petton
  2014-06-13 16:01 ` Drew Adams
@ 2014-06-13 20:13 ` Nicolas Richard
  2014-06-13 22:07   ` Nicolas Petton
  1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Richard @ 2014-06-13 20:13 UTC (permalink / raw
  To: Nicolas Petton; +Cc: help-gnu-emacs

Nicolas Petton <petton.nicolas@gmail.com> writes:
> I was wondering if it is the same in Emacs Lisp, but I couldn't find
> anything in the documentattion.

See (info "(elisp) Rearrangement") search for "A common pitfall".

-- 
Nico.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Modifying literal lists in Emacs lisp?
  2014-06-13 20:13 ` Nicolas Richard
@ 2014-06-13 22:07   ` Nicolas Petton
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Petton @ 2014-06-13 22:07 UTC (permalink / raw
  To: Nicolas Richard; +Cc: help-gnu-emacs

Thank you all for the clarifications!

Cheers,
Nico


Nicolas Richard writes:

> Nicolas Petton <petton.nicolas@gmail.com> writes:
>> I was wondering if it is the same in Emacs Lisp, but I couldn't find
>> anything in the documentattion.
>
> See (info "(elisp) Rearrangement") search for "A common pitfall".




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-13 22:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.3583.1402673918.1147.help-gnu-emacs@gnu.org>
2014-06-13 15:57 ` Modifying literal lists in Emacs lisp? Barry Margolin
2014-06-13 18:59 ` Stefan Monnier
2014-06-13 10:14 Nicolas Petton
2014-06-13 16:01 ` Drew Adams
2014-06-13 20:13 ` Nicolas Richard
2014-06-13 22:07   ` Nicolas Petton

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.