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

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

Setting mode to a temporary buffer


From: uzibalqa
Subject: Setting mode to a temporary buffer
Date: Thu, 25 Aug 2022 06:30:29 +0000

I am using the following function to write a message to a temporary buffer.  To 
set the mode
of the buffer I call (with-current-buffer bfname (org-mode)).  Another 
alternative is to
add (org-mode) after (pop-to-buffer bfname).

switch-to-buffer uses pop-to-buffer under the hood.  What is the way to do 
this?  Use 
(pop-to-buffer bfname) followed by (org-mode)?

(defun galaxy-help-show (bfname msg)

  "Makes temporary buffer BFNAME and prints message MSG."

  (when (stringp msg)

    (with-output-to-temp-buffer bfname

      (princ msg))

    (with-current-buffer bfname (org-mode))

    (pop-to-buffer bfname)))





reply via email to

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