Adapting frame to match size of the invoking window

Heime <[email protected]> Wed, 29 Jul 2026 13:58:20 +0000
Newsgroups gmane.emacs.help
Message-ID <ElBrsEh-UvA32ym8wbyrqgzkXgiAFMiv1iLqO6i0OMG7zJbONILv-fGtmeJH7arbxk9oMMGLKsgsnYoik4B6YnBziD9tkVptqR-3_-gg6lw=@protonmail.com>
galaxiakos-du makes a frame using parameters in frame-prmt.  I want=20
to change this behaviour, making the frame take the size of the parent
window from which the command was executed.  The text scale of the window
has also to be applied to keep the same dimensions.=20

(defvar frame-prmt '( (width . 72) (height . 21) )
  "Alist of frame parameters for `make-frame`.  Used to customize new
frames.")


(defun galaxiakos-du (frm-name bfr-name &rest implfds)
  "Call multiple implanted functions passed as arguments.
This allows dynamic insertion within the buffer.

FRM-NAME   Name for the frame.
BFR-NAME   Name for the buffer.
IMPLFDS    Implanted feed functions."
 =20
  (interactive)

  ;; Make the nem frame, then change its name afterwards=20
  (let ( (frm  (make-frame frame-prmt))
         (bfr  (get-buffer-create bfr-name)) )

    ;; Change frame parameter for name
    (set-frame-parameter frm 'name frm-name)

    ;; Iterate and call each function passed as argument
    (select-frame frm)
    (with-current-buffer bfr
      (dolist (implfd implfds)
        (funcall implfd))
      (goto-char (point-min)))

    ;; Display the buffer in the selected frame
    (switch-to-buffer bfr)) )