emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help making setq work on dynamic symbol


From: Visuwesh
Subject: Re: Help making setq work on dynamic symbol
Date: Fri, 18 Oct 2024 20:48:59 +0530
User-agent: Gnus/5.13 (Gnus v5.13)

[வெள்ளி அக்டோபர் 18, 2024] Ship Mints wrote:

> Yessir. This fails, too, in the same way when I expect it to work:
>
> (setq (intern (concat "f" "oo"))) t)

It should be (set (intern (concat "f" "oo")) t).

>
> On Fri, Oct 18, 2024 at 11:00 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
>> > From: Ship Mints <shipmints@gmail.com>
>> > Date: Fri, 18 Oct 2024 10:40:47 -0400
>> >
>> > (defmacro my/setq (name value)
>> >   (let ((sym (intern name)))
>> >     `(setq ,sym ,value)))
>> > (defvar foo nil)
>> > (my/setq "foo" t) ; this works
>> > (intern (concat "f" "oo")) ; this works
>> > (my/setq (concat "f" "oo") t) ; this fails with...
>> >
>> > Debugger entered--Lisp error: (wrong-type-argument stringp (concat "f"
>> "oo"))
>> >   intern((concat "f" "oo"))
>> >   (let ((sym (intern name))) (list 'setq sym value))
>> >   (closure (t) (name value) (let ((sym (intern name))) (list 'setq sym
>> value)))((concat "f" "oo") t)
>> >   macroexpand((my/setq (concat "f" "oo") t))
>> >   elisp--eval-last-sexp(nil)
>>
>> my/setq is a macro, not a function.
>>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]