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 07:16:46 +0000

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


> uzibalqa wrote:
> 
> > > > Have done
> > > > 
> > > > (defun help-show (bfname msg)
> > > > "Display the output of MSG"
> > > > 
> > > > (let ( (bfr (get-buffer-create bfname)) )
> > > > 
> > > > (when (stringp msg)
> > > > (with-current-buffer bfr
> > > > (print msg)
> > > > (pop-to-buffer bfr))) ))
> > > 
> > > (let ((buf (get-buffer-create "Test Buffer")))
> > > (with-current-buffer buf
> > > (insert "Lamers 'R Us\n") )
> > > (pop-to-buffer buf) )
> > 
> > Lastly I need the buffer to quit by hitting `q'.
> 
> 
> How do a programmer do that?

I have reverted back to using `with-output-to-temp-buffer' but taking out
`pop-to-buffer' from inside `with-output-to-temp-buffer'.  Then hitting
`q' gets me to quit the buffer and its window.

Here is the updated function

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

  (when (stringp msg)
    (with-output-to-temp-buffer buf
      (princ msg))
    (pop-to-buffer buf)))





reply via email to

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