help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using key q to quit temporary buffer window


From: uzibalqa
Subject: Re: Using key q to quit temporary buffer window
Date: Wed, 24 Aug 2022 05:56:32 +0000

------- Original Message -------
On Wednesday, August 24th, 2022 at 5:35 AM, Emanuel Berg <incal@dataswamp.org> 
wrote:


> uzibalqa wrote:
> 
> > Also included (switch-to-buffer bfname) to get
> > 
> > (defun help-show (bfname msg)
> > "Display the output of MSG"
> 
> 
> Still not good ...
> 
> > (when (stringp msg)
> > (with-output-to-temp-buffer bfname
> > (switch-to-buffer bfname)
> > (print msg))))
> > 
> > But (switch-to-buffer bfname) replaces the buffer.
> > Without it, a new buffer is generated underneath the current
> > buffer. All I want is to make the temporary buffer to become
> > the current buffer.
> 
> 
> `get-buffer-create', then` with-current-buffer', then
> `pop-to-buffer'. See` print-roll-outs' here

This fails because I end up with an empty buffer.

(defun help-show-b (bfname msg)
  "Display the output of MSG"

  (when (stringp msg)
    (get-buffer-create bfname)
    (with-current-buffer bfname
      (pop-to-buffer bfname)
      (print msg))))

I want a temporary buffer, where I can hit `q' to get out of it as
happens with the buffer *Backtrace*.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]