From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: Run a program Date: Wed, 28 Sep 2011 06:44:54 -0700 Message-ID: <1F2E505FE86947FA9696A4B268046041@us.oracle.com> References: <4BB5BAB3-2D48-402A-85EF-070EEC256DB3@canl.nc> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1317217530 4600 80.91.229.12 (28 Sep 2011 13:45:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 28 Sep 2011 13:45:30 +0000 (UTC) To: "'Roland Thiers'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Sep 28 15:45:25 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R8uRw-0007jh-CC for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Sep 2011 15:45:24 +0200 Original-Received: from localhost ([::1]:50080 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8uRv-0006sE-Bo for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Sep 2011 09:45:23 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:38830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8uRq-0006s9-3J for help-gnu-emacs@gnu.org; Wed, 28 Sep 2011 09:45:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8uRo-00023N-GI for help-gnu-emacs@gnu.org; Wed, 28 Sep 2011 09:45:17 -0400 Original-Received: from rcsinet15.oracle.com ([148.87.113.117]:46119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8uRo-000236-Ao for help-gnu-emacs@gnu.org; Wed, 28 Sep 2011 09:45:16 -0400 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p8SDj1aA026572 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 28 Sep 2011 13:45:02 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p8SDj0vK013595 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 Sep 2011 13:45:00 GMT Original-Received: from abhmt113.oracle.com (abhmt113.oracle.com [141.146.116.65]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p8SDisSC028905; Wed, 28 Sep 2011 08:44:54 -0500 Original-Received: from dradamslap1 (/10.159.58.251) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 28 Sep 2011 06:44:54 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Acx9v5nUI5V5Eh93QtaZ2OTXrxJHUAAIzTKg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090203.4E8324DF.0011:SCFMA922111,ss=1,re=-4.000,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 148.87.113.117 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:82364 Archived-At: > Thank very much Deniz, Kevin and Le for your replies and advices. > (vector 0 0 0) and (make-vector 3 0) work well. > I understood that my problem was connected with quoting, now > I have to read carefully the thread : buffer-local variables > seem to remember values (explanations of Drew Adams and others). > Not obvious, No, it's not obvious to someone new to Lisp. To be clear, Le took a shortcut in saying that this has to do with quoting. In fact, it does not. What it comes down to is that the Lisp _reader_ constructs Lisp objects as it reads sexps (code). That includes lists, vectors, and symbols. Nearly every Lisp sexp you see in a program leads to the Lisp reader constructing a list of lists, symbols, vectors, strings, etc. (defun foo ...) becomes a list when it is read, and so on. Reading is a separate step from evaluating. Lisp interpretation is a loop with these steps: Read (a sexp), Evaluate it, Print (the result) - the so-called REP Loop, or REPL. People sometimes gloss over the Read step when thinking about code, but that can be a mistake, as the gotcha in question shows. http://en.wikipedia.org/wiki/Read-eval-print_loop A special form such as `quote' does not receive program text as its argument; it receives an internal Lisp object already created by the Lisp reader. Depending on the particular Lisp and its implementation, the reader might or might not create a new, different list or vector each time it encounters equivalent text (sexp). In Emacs Lisp, it typically (always?) does not create a new one - it reuses the same list or vector. And that is why you should not modify such a "constant", at least not expecting a new, distinct constant to have been created at each textual occurrence of the same sexp. Those textual occurrences will typically all stand for the same Lisp object. This is a gotcha associated with learning Lisp, but once it is learned you have a better understanding of the kind of language it is. HTH.