From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: add-list local value Date: Wed, 12 Mar 2008 09:49:57 +0100 Message-ID: <47D79935.5040509@gmail.com> References: <47D729CB.2060105@gmail.com> <47D73D5B.4070502@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1205311819 31571 80.91.229.12 (12 Mar 2008 08:50:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Mar 2008 08:50:19 +0000 (UTC) Cc: Stefan Monnier , Emacs Devel To: Juanma Barranquero Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 12 09:50:46 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JZMfd-0006Gj-W2 for ged-emacs-devel@m.gmane.org; Wed, 12 Mar 2008 09:50:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZMf5-0002gv-Gu for ged-emacs-devel@m.gmane.org; Wed, 12 Mar 2008 04:50:11 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JZMf1-0002fA-0v for emacs-devel@gnu.org; Wed, 12 Mar 2008 04:50:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JZMez-0002eY-8v for emacs-devel@gnu.org; Wed, 12 Mar 2008 04:50:06 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZMez-0002eH-33 for emacs-devel@gnu.org; Wed, 12 Mar 2008 04:50:05 -0400 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JZMey-0008Rr-JU for emacs-devel@gnu.org; Wed, 12 Mar 2008 04:50:04 -0400 Original-Received: from c83-254-148-228.bredband.comhem.se ([83.254.148.228]:63225 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1JZMeu-0004dF-9X; Wed, 12 Mar 2008 09:50:01 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 In-Reply-To: X-Antivirus: avast! (VPS 080311-0, 2008-03-11), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.148.228 X-ACL-Warn: Too high rate of unknown addresses received from you X-Scan-Result: No virus found in message 1JZMeu-0004dF-9X. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1JZMeu-0004dF-9X 958ac64355ab63933129d091bd8700f2 X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:92254 Archived-At: Juanma Barranquero wrote: > On Wed, Mar 12, 2008 at 3:18 AM, Lennart Borgman (gmail) > wrote: > >> And if I have a local value and want to add to the global value with >> add-to-list? > > (with-temp-buffer (add-to-list 'my-variable 'my-value)) > > unless the variable is automatically buffer-local. If it is, I think > it would be uncommon to modify the global value (it would be more > logical to just set it up with defvar), but you can always skip the > `add-to-list' and assign to my-variable with setq-default. Thanks, yes, something like this perhaps (defun add-to-global-list (list-var element &optional append compare-fn) (let ((global-val (default-value list-var))) (add-to-list 'global-val element append compare-fn) (set-default list-var global-val))) But I would prefer that add-to-list did it for me.