From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
Emacs Devel <emacs-devel@gnu.org>
Subject: Re: add-list local value
Date: Wed, 12 Mar 2008 09:49:57 +0100 [thread overview]
Message-ID: <47D79935.5040509@gmail.com> (raw)
In-Reply-To: <f7ccd24b0803120141p2e07b147i157b6a0052861b8e@mail.gmail.com>
Juanma Barranquero wrote:
> On Wed, Mar 12, 2008 at 3:18 AM, Lennart Borgman (gmail)
> <lennart.borgman@gmail.com> 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.
next prev parent reply other threads:[~2008-03-12 8:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-12 0:54 add-list local value Lennart Borgman (gmail)
2008-03-12 1:51 ` Stefan Monnier
2008-03-12 2:18 ` Lennart Borgman (gmail)
2008-03-12 8:41 ` Juanma Barranquero
2008-03-12 8:49 ` Lennart Borgman (gmail) [this message]
2008-03-12 13:51 ` Stefan Monnier
2008-03-12 17:51 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47D79935.5040509@gmail.com \
--to=lennart.borgman@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=lekktu@gmail.com \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).