unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ship Mints <shipmints@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Help making setq work on dynamic symbol
Date: Fri, 18 Oct 2024 18:00:18 +0300	[thread overview]
Message-ID: <86sestmp6l.fsf@gnu.org> (raw)
In-Reply-To: <CAN+1HboPTfwENftbpM9v+BaU8HUUf8yZJG-xqxKF7mCAEBtVbw@mail.gmail.com> (message from Ship Mints on Fri, 18 Oct 2024 10:40:47 -0400)

> 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	other threads:[~2024-10-18 15:00 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 [this message]
2024-10-18 15:02   ` Ship Mints
2024-10-18 15:18     ` Visuwesh
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

  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=86sestmp6l.fsf@gnu.org \
    --to=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 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).