From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74866: 29.4; fit-frame-to-window + no vertical scroll bar + ch Date: Wed, 18 Dec 2024 11:05:17 +0100 Message-ID: <7e7b4037-5f71-4c74-9a93-2db76d2eb86e@gmx.at> References: <87msgyzakk.fsf@toomas.mail-host-address-is-not-set> <86zfkytmyt.fsf@gnu.org> <20241214210901.14730@toomas> Reply-To: martin rudalics Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29974"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Eli Zaretskii , 74866@debbugs.gnu.org To: Stefan Kangas , Toomas Rosin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 18 11:06:31 2024 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 1tNqwp-0007dY-8A for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Dec 2024 11:06:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNqwY-0007Xz-Mu; Wed, 18 Dec 2024 05:06:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNqwP-0007Wy-5W for bug-gnu-emacs@gnu.org; Wed, 18 Dec 2024 05:06:05 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNqwO-0001nR-QN for bug-gnu-emacs@gnu.org; Wed, 18 Dec 2024 05:06:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=EHsk3xKWCs345qDYG5erVHOISdmY3v14QOpGAspgakE=; b=DEXBaBbM/RrP9bkuC3bx9VXIWlLr4Rl76O1uXnq5NgaOV7ZWh+e2oRkwVZ6mPJXZHpAODG0n2jzk+V/7yTPGZKIZtVjpNq530UdYLQvEsDp5X1v1dtch4zkt/sKePOxqrlkeOpUG77oglriJObrNTbydphlWNrmVQk2TgAOFno4zmQmewlaPm+e7M3SKOW3I6Ek+t6FQK/vi66WR6CZNS8KpeXF3o6Q5jINRcHO0k/H+flhadFsR6fBDz7bds9mEgkawfDP4h5K73bKqvaz+/k0Abz5I+o+J1Ltga2BY+x6M8FTIcrFv9P92XMVOwdNkZwnCj2nJBlh3k6K8NIegaQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tNqwM-0001na-Af for bug-gnu-emacs@gnu.org; Wed, 18 Dec 2024 05:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Dec 2024 10:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74866 X-GNU-PR-Package: emacs Original-Received: via spool by 74866-submit@debbugs.gnu.org id=B74866.17345163346857 (code B ref 74866); Wed, 18 Dec 2024 10:06:02 +0000 Original-Received: (at 74866) by debbugs.gnu.org; 18 Dec 2024 10:05:34 +0000 Original-Received: from localhost ([127.0.0.1]:33471 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNqvt-0001mV-E3 for submit@debbugs.gnu.org; Wed, 18 Dec 2024 05:05:34 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:50709) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNqvm-0001m6-QU for 74866@debbugs.gnu.org; Wed, 18 Dec 2024 05:05:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at; s=s31663417; t=1734516319; x=1735121119; i=rudalics@gmx.at; bh=EHsk3xKWCs345qDYG5erVHOISdmY3v14QOpGAspgakE=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=YdrC4EKFzJPg9IC+LyRsOFkDXsgADv38IY90Ah4aR3KytlVeB751r8zsaCvhEpHH jGX+MhLnBQC9rMDtlDs17Zx02L8q2s7xMek3sbPind61TcQcLPdP8r01nQc2qDt6l MNHpoVG9cCKkRPpaxoCRllOSjMzejimcQe3BgwKb/408WslL2ahm/Zj06vxwBGQS/ FcdYsBjxFEPXE0j9xb42UxxW7f/o58xRjWkJydTSFoSrD7GRjtNBNik4KP/g3O78G KbyNY5y3G6lgg3kzvDLOM5DF5osxlnBK0NzUXp+nN+4lo4SdESsgnwz33CQ+xtxuC ZmHAZeuF7xUwCtiqLw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [192.168.31.113] ([213.142.97.162]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M2wGs-1tR8iI3jMS-00B03N; Wed, 18 Dec 2024 11:05:19 +0100 Content-Language: en-US In-Reply-To: X-Provags-ID: V03:K1:wtyzLiS1Q/9RZetpFfIq6WrNDN4EplOJka4YvI6ZtV+1nwv3JSA pGphtrrY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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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:297329 Archived-At: > Toomas Rosin writes: Toomas please include me in the recipients. >> Thank you, this got the damn thing working for me. As the lines about >> vertical scroll bars and font size were from my init.el, I was loath to >> clutter my function with them and hoped to get away with only adding the >> `vertical-scroll-bars' item to the `frame-attributes' arg of >> `make-frame'. And indeed, this worked. So the final form of my MWM >> looks like this: >> >> ;;; init.el: >> (setq-default vertical-scroll-bar nil) >> (set-face-attribute 'default nil :height 75) >> >> ;;; main code: >> (defun fit (lin col) >> "Fit some text (LIN lines and COL columns) into a newly created frame." >> (interactive) >> (let ((buf (get-buffer-create "*foo*")) >> (frm (make-frame >> `((z-group . above) >> (vertical-scroll-bars . ,vertical-scroll-bar))))) >> (with-current-buffer buf >> (erase-buffer) >> (setq mode-line-format '("")) >> (dotimes (_ lin) (insert (format "%s\n" (make-string col ?x)))) >> (goto-char (point-min))) >> (with-selected-frame frm >> (switch-to-buffer buf) >> (fit-frame-to-buffer)))) >> >> Cheers, T. > > So is there a bug here? It might be a synchronization problem. When in the new frame I type M-x fit-frame-to-buffer, it behaves as intended here. Whatever it is, I'd suggest to never ever use the idiom (setq-default vertical-scroll-bar nil) 'vertical-scroll-bar' is an automatically buffer-local variable meant to override what the frame specifies for any buffer displayed in it. But the size hints Emacs sends to the window manager are derived from the settings for the frame. So it's easily possible that the window manager truncates the frame size to the next size specified by our size increments just that in the case at hand the base width would still include the vertical scroll bar. In fact, here I have to set 'frame-resize-pixelwise' to t to make your scenario work even without the 'set-face-attribute' call. So if you want to turn off vertical scroll bars for all frames please use a (vertical-scroll-bars . nil) entry in 'default-frame-alist'. Whether 'set-face-attribute' DTRT and how it is involved in the scenario at hand is a question I'd prefer not to answer. If it affects the canonical line height or column width of a frame, it should find its way into the size hints for each frame. Otherwise, chaos may result. martin