From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#14233: 24.3; Don't constrain frame size to character multiples Date: Sat, 27 Apr 2013 06:53:11 -0700 Message-ID: References: <2r7gjy2gyy.fsf@fencepost.gnu.org> <83bo991z00.fsf@gnu.org><517257A0.4080607@gmx.at> <8338ul1rmb.fsf@gnu.org><517275A0.1040702@gmx.at> <83wqrxzbc7.fsf@gnu.org><51729A6A.7090404@gmx.at> <83mwstyxre.fsf@gnu.org><5172D1D6.8030200@gmx.at> <83bo99ys79.fsf@gnu.org><5173B0B2.9070607@gmx.at><51750438.5060106@gmx.at><8C0357F6-5720-42E5-90EB-B83416F0344E@swipnet.se><51762F4D.7070101@gmx.at> <8361zdxll8.fsf@gnu.org><51777DF3.5030206@gmx.at> <83fvyfx3c1.fsf@gnu.org><5178DB50.20404@gmx.at> <834neuvas1.fsf@gnu.org> <517A2FCE.30006@gmx.at> <97FD826D96FF4DAA91192817D475A0B3@us.oracle.com> <517B776B.2080007@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1367070840 8807 80.91.229.3 (27 Apr 2013 13:54:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 27 Apr 2013 13:54:00 +0000 (UTC) Cc: esabof@gmail.com, 14233@debbugs.gnu.org To: "'martin rudalics'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 27 15:54:04 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UW5Zi-0007t7-9A for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Apr 2013 15:54:02 +0200 Original-Received: from localhost ([::1]:53685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW5Zh-0000Vk-W7 for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Apr 2013 09:54:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW5Ze-0000Vf-9Z for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2013 09:53:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UW5Zd-0006Fm-3R for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2013 09:53:58 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42216) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW5Zc-0006Fh-Vr for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2013 09:53:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UW5Zi-0008Rg-Bb for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2013 09:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Apr 2013 13:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14233 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 14233-submit@debbugs.gnu.org id=B14233.136707081532388 (code B ref 14233); Sat, 27 Apr 2013 13:54:02 +0000 Original-Received: (at 14233) by debbugs.gnu.org; 27 Apr 2013 13:53:35 +0000 Original-Received: from localhost ([127.0.0.1]:46325 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UW5ZG-0008QI-EX for submit@debbugs.gnu.org; Sat, 27 Apr 2013 09:53:34 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:19447) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UW5ZB-0008Pz-W2 for 14233@debbugs.gnu.org; Sat, 27 Apr 2013 09:53:32 -0400 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r3RDrLxi022727 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 27 Apr 2013 13:53:21 GMT Original-Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3RDrJcv019979 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sat, 27 Apr 2013 13:53:20 GMT Original-Received: from ubhmt116.oracle.com (ubhmt116.oracle.com [156.151.24.21]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3RDrJOD023127; Sat, 27 Apr 2013 13:53:19 GMT Original-Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 27 Apr 2013 06:53:19 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <517B776B.2080007@gmx.at> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac5DGDi1esV8b5kaSrWv+V6HZIsgYAAMyxRg X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:73775 Archived-At: > > I have code that relies on this behavior to shrink not > > only the default font size (of all windows in the frame) > > but the frame itself. I do this not only to zoom > > (shrink or enlarge) a frame and its text slightly. I do > > it also to shrink it a lot - down to a thumbnail/icon size > > - and later restore it. > > > > I would not like to see this behavior change, so that, > > e.g., Emacs stopped resizing the frame when I change the > > font size for the frame. > > It depends on the interface you use. Already that does not sound very good. Why should the behavior be different depending on how you change a frame parameter? > The function `set-frame-font' has the KEEP-SIZE argument > and I don't intend to change its semantics (I'll probably > remove the rounding when `frame-resize-pixelwise' is non-nil). I use `modify-frame-parameters', providing a new value for parameter `font'. The new value is calculated this way (in frame-cmds.el): (defun enlarged-font-name (fontname frame increment) "FONTNAME, after enlarging font size of FRAME by INCREMENT. FONTNAME is the font of FRAME." (when (query-fontset fontname) (let ((ascii (assq 'ascii (aref (fontset-info fontname frame) 2)))) (when ascii (setq fontname (nth 2 ascii))))) (let ((xlfd-fields (x-decompose-font-name fontname))) (unless xlfd-fields (error "Cannot decompose font name")) (let ((new-size (+ (string-to-number (aref xlfd-fields xlfd-regexp-pixelsize-subnum)) increment))) (unless (> new-size 0) (error "New font size is too small: %s" new-size)) (aset xlfd-fields xlfd-regexp-pixelsize-subnum (number-to-string new-size))) ;; Set point size & width to "*", so frame width will adjust ;; to new font size (aset xlfd-fields xlfd-regexp-pointsize-subnum "*") (aset xlfd-fields xlfd-regexp-avgwidth-subnum "*") (x-compose-font-name xlfd-fields))) This is the function that uses that new value: (defun enlarge-font (&optional increment frame) "Increase size of font in FRAME by INCREMENT. Interactively, INCREMENT is given by the prefix argument. Optional FRAME parameter defaults to current frame." (interactive "p") (setq frame (or frame (selected-frame))) (let ((fontname (cdr (assq 'font (frame-parameters frame)))) (count enlarge-font-tries)) (setq fontname (enlarged-font-name fontname frame increment)) (while (and (not (x-list-fonts fontname)) (wholenump (setq count (1- count)))) (setq fontname (enlarged-font-name fontname frame increment))) (unless (x-list-fonts fontname) (error "Cannot change font size")) (modify-frame-parameters frame (list (cons 'font fontname))) ;; Update faces that want a bold or italic version of default. (when (< emacs-major-version 21) (frame-update-faces frame)))) I use this code a lot: in doremi-frm.el to enlarge/shrink incrementally; in zoom-frm.el to do likewise, but differently; in thumb-frm.el to (de)thumbify. I really hope this will not be broken by whatever changes you envision. Thx. The code is here: http://www.emacswiki.org/emacs-en/download/frame-cmds.el http://www.emacswiki.org/emacs-en/download/zoom-frm.el http://www.emacswiki.org/emacs-en/download/thumb-frm.el