all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ship Mints <shipmints@gmail.com>
To: Emacs Devel <emacs-devel@gnu.org>
Subject: Help making setq work on dynamic symbol
Date: Fri, 18 Oct 2024 10:40:47 -0400	[thread overview]
Message-ID: <CAN+1HboPTfwENftbpM9v+BaU8HUUf8yZJG-xqxKF7mCAEBtVbw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 658 bytes --]

Probably something silly but this seems esoteric enough to ask.

On Emacs 29.4:

(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)

TIA,

-Stephane

[-- Attachment #2: Type: text/html, Size: 1804 bytes --]

             reply	other threads:[~2024-10-18 14:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 14:40 Ship Mints [this message]
2024-10-18 15:00 ` Help making setq work on dynamic symbol Eli Zaretskii
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAN+1HboPTfwENftbpM9v+BaU8HUUf8yZJG-xqxKF7mCAEBtVbw@mail.gmail.com \
    --to=shipmints@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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.