unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Heime <heimeborgia@protonmail.com>
To: Heime <heimeborgia@protonmail.com>
Cc: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: Make new buffers into new frames
Date: Sun, 29 Sep 2024 12:44:04 +0000	[thread overview]
Message-ID: <TXM8a4RJ3G9aftG0A7Gp4TH7r6srFPnF1OY-qQaCUfNbaSFSZ0F8XVTzdLYlrDCBCWe8LufOaf7XgAOaeyk8hBztjpKNiUAGZI1SvTFJKEM=@protonmail.com> (raw)
In-Reply-To: <UJaaebfjIypkig3DW5Y6r2EnBJG9PWdDugBVfvtvKCt0OKkzp3KA8YdeTp0qlUEaOb_YPNk-rQGE4g_4kpV3Vc8VgejgSztD1bFIRVAJ_T0=@protonmail.com>


On Sunday, September 29th, 2024 at 7:40 PM, Heime <heimeborgia@protonmail.com> wrote:

> I want to display the user named buffer when calling buffer-into-frame into
> a new frame. The buffer will have a button, which when pressed another buffer
> will be made to display my-message, which is some text.
>
> I also want my-message to be displayed in a buffer and in the same new frame.
>
> (defun display-message (my-message &optional bfrn)
> "Display textual message into the buffer BFRN."
>
> (let* ( (bfname (or bfrn "Info"))
> (dbuffer (get-buffer-create (concat "𒆳 " bfname))) )
>
> (with-current-buffer dbuffer
> (erase-buffer)
> (insert my-message)
> (goto-char (point-min)))
>
> (display-buffer dbuffer)))
>
> ;; -------------------------------------------------------
>
> (defun buffer-into-frame (&optional bfrn)
> "TODO"
>
> (interactive
> (list (let ( (rqmatch nil)
> (cseq '("Default" "Torium")) )
> (completing-read " Display Name: " cseq nil rqmatch "Selection Buffer"))))
>
> (let* ( (bfname (or bfrn "S_election Buffer"))
> (dbuffer (get-buffer-create (concat "𒆳 " bfname))) )
>
> (with-current-buffer dbuffer
> (erase-buffer)
>
> ;; Insert a button that shows the info when pressed
> (insert-button " - "
> 'action (display-message my-message "Info Buffer")
> 'follow-link t)
>
> (insert " Running Non-Interactive Commands"))) )

Have made a dedicated frame frame-display-unit. With
trm-display-info used to display a message, and 
trm-button-choices handling the button choices.

But things go wrong when I press the button with

 (invalid-function #<window 14 on 𒆳 Info>)

(defvar frame-display-unit nil
  "Dedicated frame for displaying specific buffers.")

;; -----------------------------------------------------------

(defun trm-display-info (message &optional bfrn)
  "Display textual message into the buffer BFRN."

  (let* ( (bfname (or bfrn "Display Button Choice"))
          (dbuffer (get-buffer-create (concat "𒆳 " bfname))) )

    (with-current-buffer dbuffer
      (erase-buffer)
      (insert message)
      (goto-char (point-min)))

      (display-buffer dbuffer) ))

;; ----------------------------------------------------

(defun trm-button-choices (&optional bfrn)
  "TODO"

  (interactive
    (list (let ( (rqmatch nil)
                 (cseq '("Default" "Choices")) )
            (completing-read " Display Name: " cseq nil rqmatch "Choices"))))

  (let* ( (bfname (or bfrn "Choices"))
          (dbuffer (get-buffer-create (concat "𒆳 " bfname))) )

    ;; Initialize the dedicated frame if it doesn't exist
    (unless (frame-live-p frame-display-unit)
      (setq frame-display-unit (make-frame '((name . "Frame Display Unit")))))

    (with-current-buffer dbuffer
      (erase-buffer)

      ;; Insert a button that shows the info when pressed
      (insert-button " - "
        'action (trm-display-info my-message "Info")
        'follow-link t)

      (insert " Running Non-Interactive Commands"))

    ;; Display the buffer in the dedicated frame
    (select-frame-set-input-focus frame-display-unit)
    (set-window-buffer
      (frame-selected-window frame-display-unit) dbuffer)))





  reply	other threads:[~2024-09-29 12:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-29  7:40 Make new buffers into new frames Heime
2024-09-29 12:44 ` Heime [this message]
2024-09-29 17:15   ` tomas
2024-09-29 19:16     ` Heime
2024-09-29 19:22       ` tomas
2024-09-29 19:31         ` Heime
2024-09-30  4:41           ` tomas
2024-09-30  6:40             ` Heime
2024-09-30  9:13               ` Stephen Berman
2024-09-30  9:15               ` tomas
2024-09-30  9:29               ` Rudolf Schlatte
2024-09-30 19:32                 ` Heime

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='TXM8a4RJ3G9aftG0A7Gp4TH7r6srFPnF1OY-qQaCUfNbaSFSZ0F8XVTzdLYlrDCBCWe8LufOaf7XgAOaeyk8hBztjpKNiUAGZI1SvTFJKEM=@protonmail.com' \
    --to=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).