all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Clemens <clemens.radermacher@posteo.de>
To: martin rudalics <rudalics@gmx.at>, Eli Zaretskii <eliz@gnu.org>
Cc: 44080@debbugs.gnu.org
Subject: bug#44080: 27.1; Display behavior of overlays `after-string` in resizable minibuffer frames
Date: Thu, 22 Oct 2020 14:39:55 +0200	[thread overview]
Message-ID: <0a222f7d-6d3f-4c7c-548f-09f4af82ae6e@posteo.de> (raw)
In-Reply-To: <e1b3c8b9-d4c0-bc6c-a8a7-42c29e5a7418@gmx.at>

[-- Attachment #1: Type: text/plain, Size: 757 bytes --]

> It's called from xdisp.c as
> 
> 
>    if (FRAME_MINIBUF_ONLY_P (f))
>      {
>        if (!NILP (resize_mini_frames))
>      safe_call1 (Qwindow__resize_mini_frame, WINDOW_FRAME (w));
>      }
> 
> 
> which represents one of our ways to call a Lisp function from C.

Thanks, for some reason `debug-on-entry` did not invoke the debugger
when I tested it.

> Right.  And if you have any questions, ask here immediately.

I never dealt with the C side of Emacs and you suggested to offer the 
new function as first customization choice for `resize-mini-frames`.
I guess this needs to be done on the C side as the variable is defined 
there?

I have attached the patch I have worked on. Let me know how to proceed 
and thanks for your help!

[-- Attachment #2: mini-frame.patch --]
[-- Type: text/x-patch, Size: 2530 bytes --]

diff --git a/lisp/window.el b/lisp/window.el
index 1fcfffcb53..b7d4b4d26f 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -3432,7 +3432,7 @@ (defun window--resize-mini-frame (frame)
   "Resize minibuffer-only frame FRAME."
   (if (functionp resize-mini-frames)
       (funcall resize-mini-frames frame)
-    (fit-frame-to-buffer frame)))
+    (fit-mini-frame-to-buffer frame)))
 
 (defun window--sanitize-window-sizes (horizontal)
   "Assert that all windows on selected frame are large enough.
@@ -8925,8 +8925,17 @@ (defun window--sanitize-margin (margin left right)
 
 (declare-function tool-bar-height "xdisp.c" (&optional frame pixelwise))
 
+(defun fit-mini-frame-to-buffer (frame)
+  "Adjust size of minibuffer FRAME to display its contents.
+Unlike `fit-frame-to-buffer' FRAME will fit to the contents with
+any leading or trailing empty lines included."
+  (fit-frame-to-buffer-1 frame))
+
 (defun fit-frame-to-buffer (&optional frame max-height min-height max-width min-width only)
   "Adjust size of FRAME to display the contents of its buffer exactly.
+Any leading or trailing empty lines of the buffers content are
+not considered.
+
 FRAME can be any live frame and defaults to the selected one.
 Fit only if FRAME's root window is live.
 
@@ -8945,6 +8954,12 @@ (defun fit-frame-to-buffer (&optional frame max-height min-height max-width min-
 `fit-frame-to-buffer-margins' or setting the corresponding
 parameters of FRAME."
   (interactive)
+  (fit-frame-to-buffer-1 frame max-height min-height max-width min-width only t t))
+
+(defun fit-frame-to-buffer-1 (&optional frame max-height min-height max-width min-width only from to)
+  "Helper function for `fit-frame-to-buffer'.
+FROM and TO are the buffer positions to determine the size to fit
+to, see `window-text-pixel-size'."
   (unless (fboundp 'display-monitor-attributes-list)
     (user-error "Cannot resize frame in non-graphic Emacs"))
   (setq frame (window-normalize-frame frame))
@@ -9079,7 +9094,7 @@ (defun fit-frame-to-buffer (&optional frame max-height min-height max-width min-
            ;; Note: Currently, for a new frame the sizes of the header
            ;; and mode line may be estimated incorrectly
            (size
-            (window-text-pixel-size window t t max-width max-height))
+            (window-text-pixel-size window from to max-width max-height))
            (width (max (car size) min-width))
            (height (max (cdr size) min-height)))
       ;; Don't change height or width when the window's size is fixed

  reply	other threads:[~2020-10-22 12:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 18:39 bug#44080: 27.1; Display behavior of overlays `after-string` in resizable minibuffer frames Clemens
2020-10-19 19:43 ` Eli Zaretskii
2020-10-20  7:21   ` martin rudalics
2020-10-20  9:27     ` Clemens
2020-10-20 14:40       ` martin rudalics
2020-10-20 15:19         ` Clemens
2020-10-20 17:02         ` Clemens
2020-10-21  9:11           ` Clemens
2020-10-21 13:49             ` martin rudalics
2020-10-21 14:13               ` Clemens
2020-10-21 16:05                 ` martin rudalics
2020-10-21 17:20                   ` Clemens
2020-10-21 17:25                     ` martin rudalics
2020-10-22 12:39                       ` Clemens [this message]
2020-10-22 16:26                         ` martin rudalics
2020-10-24 13:08                           ` Clemens
2020-10-24 13:39                             ` Robert Pluim
2020-10-27 18:15                               ` Clemens
2020-10-26 18:24                             ` martin rudalics
2020-10-26 18:32                               ` Eli Zaretskii
2020-10-26 20:53                               ` Clemens
2020-10-27  9:08                                 ` martin rudalics
2020-10-27 12:10                                   ` Clemens
2020-10-27 18:02                                     ` martin rudalics
2020-10-27 18:29                                       ` Clemens
2020-10-21 19:45                     ` Andrii Kolomoiets
2020-10-21 15:00               ` Eli Zaretskii
2020-10-27 18:23 ` bug#44080: Fixed for Emacs 27.2 Clemens

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

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

  git send-email \
    --in-reply-to=0a222f7d-6d3f-4c7c-548f-09f4af82ae6e@posteo.de \
    --to=clemens.radermacher@posteo.de \
    --cc=44080@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=rudalics@gmx.at \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.