From: Visuwesh <visuweshm@gmail.com>
To: Ship Mints <shipmints@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Help making setq work on dynamic symbol
Date: Fri, 18 Oct 2024 20:48:59 +0530 [thread overview]
Message-ID: <87msj1wiak.fsf@gmail.com> (raw)
In-Reply-To: <CAN+1HbpHEs5RFPFU7ip36QjTDDeVeMJL3H_-qkGKVz7mgg37VA@mail.gmail.com> (Ship Mints's message of "Fri, 18 Oct 2024 11:02:16 -0400")
[வெள்ளி அக்டோபர் 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.
>>
next prev parent reply other threads:[~2024-10-18 15:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 14:40 Help making setq work on dynamic symbol Ship Mints
2024-10-18 15:00 ` Eli Zaretskii
2024-10-18 15:02 ` Ship Mints
2024-10-18 15:18 ` Visuwesh [this message]
2024-10-18 15:20 ` Andreas Schwab
2024-10-18 15:24 ` Ship Mints
2024-10-18 15:53 ` Ship Mints
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87msj1wiak.fsf@gmail.com \
--to=visuweshm@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=shipmints@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.