all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Wrong argument for buffer name
@ 2023-08-07  6:59 Heime
  2023-08-07  7:39 ` Heime
  0 siblings, 1 reply; 3+ messages in thread
From: Heime @ 2023-08-07  6:59 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

Why does the following function give

Lisp error: (wrong-type-argument stringp bfname)

What can I do to fix this problem for the buffer name ?

(defconst buffer-name "BFTEMP")

(defun estring (string &optional bfname)
  "Show STRING in a temporary buffer."

  (or bfname (setq bfname buffer-name))

  (with-output-to-temp-buffer bfname
    (princ string)
    (emacs-lisp-mode)))






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Wrong argument for buffer name
  2023-08-07  6:59 Wrong argument for buffer name Heime
@ 2023-08-07  7:39 ` Heime
  2023-08-07 18:53   ` Emanuel Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Heime @ 2023-08-07  7:39 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

------- Original Message -------
On Monday, August 7th, 2023 at 6:59 PM, Heime <heimeborgia@protonmail.com> wrote:


> Why does the following function give
> 
> Lisp error: (wrong-type-argument stringp bfname)
> 
> What can I do to fix this problem for the buffer name ?
> 
> (defconst buffer-name "BFTEMP")
> 
> (defun estring (string &optional bfname)
> "Show STRING in a temporary buffer."
> 
> (or bfname (setq bfname buffer-name))
> 
> (with-output-to-temp-buffer bfname
> (princ string)
> (emacs-lisp-mode)))
 
I think the problem is with these functions

Where I use (mcode '(macro-adder (* 3 5) (* 5 7)))

macro-adder being a macro defined with defmacro

(defun mobject (object &optional bfname)
  (or bfname (setq bfname buffer-name))
  (estring (pp-to-string object) bfname))

(defun mcode (code &optional bfname)
  (or bfname (setq bfname buffer-name))
  (apply 'mobject '((macroexpand code) bfname)) )




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Wrong argument for buffer name
  2023-08-07  7:39 ` Heime
@ 2023-08-07 18:53   ` Emanuel Berg
  0 siblings, 0 replies; 3+ messages in thread
From: Emanuel Berg @ 2023-08-07 18:53 UTC (permalink / raw)
  To: help-gnu-emacs

Heime wrote:

> I think the problem is with these functions [...]
>   (apply 'mobject '((macroexpand code) bfname)) )
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Yes, as in not a string (the `stringp' error).

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-07 18:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-07  6:59 Wrong argument for buffer name Heime
2023-08-07  7:39 ` Heime
2023-08-07 18:53   ` Emanuel Berg

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.