Re: Determine object passed as argument

Heime <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <lTRe9CiD2QumjdQq-dPw17RZutwhvMDB4oxVwLJ59_hiCNLTku2a1g-Vg-KDT9anPdoo2t2W1-NeW4CT6NmJqnxPVb31Xg6v0qRAkCVrsHE=@protonmail.com>
On Sunday, April 12th, 2026 at 2:25 AM, Heime <[email protected]> wrote:

> 
> On Sunday, April 12th, 2026 at 12:57 AM, Jean Louis <[email protected]> wrote:
> 
> > On 2026-04-11 15:14, Heime wrote:
> 
> > > Can a function determine the object being passed as argument and
> > > print its name.  For instance that I passed if I pass fpln when
> > > calling (lana-du-fpln 'fpln).
> > >
> > > (defun lana-du-fpln (datenstruk &optional bname)
> >
> > In Emacs Lisp, you cannot directly get the variable name that was passed
> > to a function, because arguments are evaluated before being passed. By
> > the time datenstruk receives the value, the original variable name is
> > lost.
> >
> > (defun lana-du-fpln (datenstruk-symbol &optional bname)
> >    "Print the name of the symbol passed, then access its value."
> >    (message "Processing variable: %s" datenstruk-symbol)
> >    (let ((datenstruk (symbol-value datenstruk-symbol)))
> >      ;; Now work with datenstruk's value
> >      (message "Value: %S" datenstruk)))
> >
> > Call it with quoted symbol: (lana-du-fpln 'fpln)
> 
> The above gives "Warning: lana-fpln is unbound (void variable)"
> 
> > (defun lana-du-fpln (datenstruk-symbol &optional bname)
> >    "Print the name of the symbol passed, then access its value if bound."
> >    (message "Processing variable: %s" datenstruk-symbol)
> >    (if (boundp datenstruk-symbol)
> >        (let ((datenstruk (symbol-value datenstruk-symbol)))
> >          (message "Value: %S" datenstruk)
> >          ;; Your logic here
> >          )
> >      (message "Warning: %s is unbound (void variable)"
> > datenstruk-symbol)))
> >
> > "Warning: fpln is unbound (void variable)"
> 
> The above gives "Processing variable: fpln" followed by its value.
> 
> Why does the condition (if (boundp datenstruk-symbol) make things work out?

I actually need symbol-name.  Cannot understand the problem you are 
trying to describe to me.
 
> > --
> > Jean Louis
> >
> >
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.