|
From: | Lennart Borgman (gmail) |
Subject: | Re: add-list local value |
Date: | Wed, 12 Mar 2008 09:49:57 +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 |
Juanma Barranquero wrote:
On Wed, Mar 12, 2008 at 3:18 AM, Lennart Borgman (gmail) <address@hidden> 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.
[Prev in Thread] | Current Thread | [Next in Thread] |