From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: Automatically shrink-wrapping frames to fit their selected window Date: Fri, 7 May 2004 15:48:40 -0700 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1083970497 4956 80.91.224.253 (7 May 2004 22:54:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 7 May 2004 22:54:57 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat May 08 00:54:48 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BMEEy-0004IO-00 for ; Sat, 08 May 2004 00:54:48 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BMEEy-00033T-00 for ; Sat, 08 May 2004 00:54:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.33) id 1BMEC8-0004S0-AQ for emacs-devel@quimby.gnus.org; Fri, 07 May 2004 18:51:52 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.33) id 1BMEC2-0004QX-0g for emacs-devel@gnu.org; Fri, 07 May 2004 18:51:46 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.33) id 1BMEBV-0004Hp-3O for emacs-devel@gnu.org; Fri, 07 May 2004 18:51:45 -0400 Original-Received: from [148.87.2.201] (helo=inet-mail1.oracle.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.33) id 1BME9S-0003xL-Ix for emacs-devel@gnu.org; Fri, 07 May 2004 18:49:07 -0400 Original-Received: from inet-mail1.oracle.com (localhost [127.0.0.1]) by inet-mail1.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id i47MnoGW003013 for ; Fri, 7 May 2004 15:49:50 -0700 (PDT) Original-Received: from rgmgw3.us.oracle.com (rgmgw3.us.oracle.com [138.1.191.12]) by inet-mail1.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id i47Mnluo002992 for ; Fri, 7 May 2004 15:49:48 -0700 (PDT) Original-Received: from rgmgw3.us.oracle.com (localhost [127.0.0.1]) by rgmgw3.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id i47MmgDw005187 for ; Fri, 7 May 2004 16:48:42 -0600 Original-Received: from dradamslap (dhcp-amer-vpn-gw2-east-141-144-66-125.vpn.oracle.com [141.144.66.125]) by rgmgw3.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with SMTP id i47Mmgcd005174 for ; Fri, 7 May 2004 16:48:42 -0600 Original-To: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Importance: Normal X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:22916 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:22916 I have some elisp code that does the following: - Library shrink-fit.el lets you shrink-wrap (enlarge or shrink) a frame on demand, to fit the content of its selected window (within user-defined limits). - Library shrink-fit-all.el provides automatic shrink-wrapping of one-window frames (one-window-p). The latter redefines pop-to-buffer, display-buffer, and switch-to-buffer to call a shrink-wrap function at the end. User variables control whether each of these low-level functions, separately, should in fact resize frames. I've updated the code so that it works in Emacs 21 (21.3.50.1 i386-mingw-nt5.1.2600), as well as Emacs 20. The code and documentation are available here: - code: http://www.emacswiki.org/elisp/shrink-fit.el, http://www.emacswiki.org/elisp/shrink-fit-all.el - doc: http://www.emacswiki.org/cgi-bin/wiki/OneOnOneEmacs#Shrink-Wrapping_Frames Please try it out, and consider incorporating it into Emacs at some point. I believe it would help make Emacs more frame-oriented. Thanks, Drew P.S. I have not tried this code with images or a mixture of font sizes. I imagine that some tweaking might be necessary to accomodate these (?). The current resizing code uses set-frame-size. It counts lines and measures maximum line-width (in characters) to determine the needed frame height (lines) and width (cols). Suggestions are welcome.