From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Clemens Newsgroups: gmane.emacs.bugs Subject: bug#44080: 27.1; Display behavior of overlays `after-string` in resizable minibuffer frames Date: Thu, 22 Oct 2020 14:39:55 +0200 Message-ID: <0a222f7d-6d3f-4c7c-548f-09f4af82ae6e@posteo.de> References: <83v9f6ngr6.fsf@gnu.org> <9a624e83-8d12-7597-2421-8c8ac9415ef9@gmx.at> <62b3f36b-c352-6004-7a59-e95ffe1ce408@gmx.at> <10267321-400d-5d36-1558-070a24476a03@posteo.de> <82e8f1b4-c3cb-6aec-45d3-e413da4a1b58@gmx.at> <052c2d28-c565-4038-92b1-38057bfe654b@posteo.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------DD2D6A4F10C55E96A22B0CF0" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13857"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: 44080@debbugs.gnu.org To: martin rudalics , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 22 14:41:28 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVZuK-0003WB-8B for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Oct 2020 14:41:28 +0200 Original-Received: from localhost ([::1]:54988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVZuJ-0003TO-8U for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Oct 2020 08:41:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVZtv-0003Rx-7f for bug-gnu-emacs@gnu.org; Thu, 22 Oct 2020 08:41:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40166) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVZtu-0005wT-UO for bug-gnu-emacs@gnu.org; Thu, 22 Oct 2020 08:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kVZtu-0004T6-Sf for bug-gnu-emacs@gnu.org; Thu, 22 Oct 2020 08:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Clemens Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Oct 2020 12:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44080 X-GNU-PR-Package: emacs Original-Received: via spool by 44080-submit@debbugs.gnu.org id=B44080.160337040517057 (code B ref 44080); Thu, 22 Oct 2020 12:41:02 +0000 Original-Received: (at 44080) by debbugs.gnu.org; 22 Oct 2020 12:40:05 +0000 Original-Received: from localhost ([127.0.0.1]:51704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVZsy-0004R2-Sz for submit@debbugs.gnu.org; Thu, 22 Oct 2020 08:40:05 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:51682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVZsw-0004QP-PZ for 44080@debbugs.gnu.org; Thu, 22 Oct 2020 08:40:03 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 8E68716005F for <44080@debbugs.gnu.org>; Thu, 22 Oct 2020 14:39:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1603370396; bh=zjug8bFVoDkp6c0XwFGU0yJRwZY9Y6KcLVR4QGlYGiU=; h=Subject:To:Cc:From:Date:From; b=Sqf1nKs5prAanM+79jr+Ndp0rEHB29pahcM/ew/jlcv+KX75GzVPkQFdQvckk7ykn zjbrueaSGW6SZyeDoFO7GwQNAOhiNmEYgtH35v01oniDbVovL2jGO6qg0gCHD6Ixe+ V4gBeeaZKhh5QHHV5uiKZEI4CKmBuFbIDTktiPhv7pC3ZRvgFpkCsY67Vtw1Blgjtz /NWvJhDLURe+6gfDSUp9ULD78c057Xd2n/71EQroXA8Hjmcrf/a83YDtm7YXlbxFlw e8afMhuHQcy2qbxkSMOf2/MeTcUw4+snyKm8TjAkwcd7iOMtm6TX2OSRHp2Nzza4Cm P8CCpPGYjKD6A== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4CH6Q36CXPz9rxr; Thu, 22 Oct 2020 14:39:55 +0200 (CEST) In-Reply-To: Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:191254 Archived-At: This is a multi-part message in MIME format. --------------DD2D6A4F10C55E96A22B0CF0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit > 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! --------------DD2D6A4F10C55E96A22B0CF0 Content-Type: text/x-patch; charset=UTF-8; name="mini-frame.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mini-frame.patch" 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 --------------DD2D6A4F10C55E96A22B0CF0--