From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: face-remap.el patch to resize window Date: Mon, 22 Jun 2009 13:40:15 -0700 Message-ID: <8F69F432630D4C30875CBF4B117C0BF1@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_003D_01C9F33E.F9C61500" X-Trace: ger.gmane.org 1245703408 1081 80.91.229.12 (22 Jun 2009 20:43:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Jun 2009 20:43:28 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 22 22:43:25 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MIqMP-0005Kw-50 for ged-emacs-devel@m.gmane.org; Mon, 22 Jun 2009 22:43:25 +0200 Original-Received: from localhost ([127.0.0.1]:56708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MIqMO-0003T8-HJ for ged-emacs-devel@m.gmane.org; Mon, 22 Jun 2009 16:43:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MIqJX-00022b-9v for emacs-devel@gnu.org; Mon, 22 Jun 2009 16:40:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MIqJS-00021j-Ny for emacs-devel@gnu.org; Mon, 22 Jun 2009 16:40:26 -0400 Original-Received: from [199.232.76.173] (port=45927 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MIqJS-00021g-Bb for emacs-devel@gnu.org; Mon, 22 Jun 2009 16:40:22 -0400 Original-Received: from rcsinet12.oracle.com ([148.87.113.124]:46731 helo=rgminet12.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MIqJR-0006uW-QN for emacs-devel@gnu.org; Mon, 22 Jun 2009 16:40:22 -0400 Original-Received: from rgminet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rgminet12.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n5MKe0Bb014034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 22 Jun 2009 20:40:03 GMT Original-Received: from abhmt002.oracle.com (abhmt002.oracle.com [141.146.116.11]) by rgminet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n5MKeLBF011299 for ; Mon, 22 Jun 2009 20:40:22 GMT Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Jun 2009 13:40:14 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcnzeaXDtO9yEgYATwuuQpos+YER3w== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: abhmt002.oracle.com [141.146.116.11] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090209.4A3FEC2F.017C:SCFSTAT5015188,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:111644 Archived-At: This is a multi-part message in MIME format. ------=_NextPart_000_003D_01C9F33E.F9C61500 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Commands `text-scale-decrease', `text-scale-increase', and `text-scale-adjust' (bound to `C-x C--', `C-x C-+', `C-x C-=', and `C-x C-0') let you resize the text in the current buffer by changing its scale factor. When you shrink or enlarge the apparent text size this way, however, the window takes no notice of it. In particular, although shrinking text can result in extra horizontal space at the right, window commands do not see this space as extra (available). With this patch, user option `text-scale-resize-window' lets you automatically resize the selected window (horizontally, vertically, or both) when text is resized, so that the way the window fits the buffer text remains relatively constant. Shrinking the text in one window shrinks that window, giving more space to adjacent windows. Feel free to change the default value for the option (e.g. to nil, to have no effect by default). Feel free to accept the patch or ignore it. [For anyone who might be interested in a version that also resizes a one-window frame: http://www.emacswiki.org/emacs/face-remap%2b.el.] ------=_NextPart_000_003D_01C9F33E.F9C61500 Content-Type: application/octet-stream; name="face-remap-2009-06-22.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="face-remap-2009-06-22.patch" diff -c -w face-remap.el face-remap-patched-2009-06-22.el=0A= *** face-remap.el Mon Jun 22 10:06:24 2009=0A= --- face-remap-patched-2009-06-22.el Mon Jun 22 11:41:02 2009=0A= ***************=0A= *** 191,196 ****=0A= --- 191,207 ----=0A= :type 'number=0A= :version "23.1")=0A= =0A= + (defcustom text-scale-resize-window t=0A= + "Non-nil means text scaling resizes the window accordingly.=0A= + For example, if you use `C-x C--' (`text-scale-decrease')' to make the=0A= + text smaller, then the window is made smaller by a similar factor."=0A= + :type '(choice=0A= + (const :tag "Do not resize window when scale text" nil)=0A= + (const :tag "Resize window when scale text" t)=0A= + (const :tag "Resize only horizontally" = horizontally)=0A= + (const :tag "Resize only vertically" = vertically))=0A= + :group 'display)=0A= + =0A= ;; current remapping cookie for text-scale-mode=0A= (defvar text-scale-mode-remapping nil)=0A= (make-variable-buffer-local 'text-scale-mode-remapping)=0A= ***************=0A= *** 237,247 ****=0A= Each step scales the height of the default face by the variable=0A= `text-scale-mode-step' (a negative number of steps decreases the=0A= height by the same amount). As a special case, an argument of 0=0A= ! will remove any scaling currently active."=0A= (interactive "p")=0A= (setq text-scale-mode-amount=0A= (if (=3D inc 0) 0 (+ (if text-scale-mode text-scale-mode-amount 0) = inc)))=0A= ! (text-scale-mode (if (zerop text-scale-mode-amount) -1 1)))=0A= =0A= ;;;###autoload=0A= (defun text-scale-decrease (dec)=0A= --- 248,277 ----=0A= Each step scales the height of the default face by the variable=0A= `text-scale-mode-step' (a negative number of steps decreases the=0A= height by the same amount). As a special case, an argument of 0=0A= ! removes any scaling currently active.=0A= ! =0A= ! If option `text-scale-resize-window' is non-nil, then resize the=0A= ! selected window accordingly, so as to keep roughly the same text=0A= ! visible in the window. See option `text-scale-resize-window' for the=0A= ! possible behaviors."=0A= (interactive "p")=0A= + (let* ((oamount (if text-scale-mode text-scale-mode-amount 0))=0A= + (scale-factor (expt text-scale-mode-step (if (=3D inc 0) (- = oamount) inc)))=0A= + (edges (window-edges))=0A= + (owidth (- (nth 2 edges) (nth 0 edges)))=0A= + (oheight (- (nth 3 edges) (nth 1 edges))))=0A= (setq text-scale-mode-amount=0A= (if (=3D inc 0) 0 (+ (if text-scale-mode = text-scale-mode-amount 0) inc)))=0A= ! (text-scale-mode (if (zerop text-scale-mode-amount) -1 1))=0A= ! (when text-scale-resize-window=0A= ! (unless (eq text-scale-resize-window 'vertically)=0A= ! (condition-case nil=0A= ! (enlarge-window-horizontally (round (- (* owidth = scale-factor) owidth)))=0A= ! (error nil)))=0A= ! (unless (eq text-scale-resize-window 'horizontally)=0A= ! (condition-case nil=0A= ! (enlarge-window (round (- (* oheight scale-factor) = oheight)))=0A= ! (error nil))))))=0A= =0A= ;;;###autoload=0A= (defun text-scale-decrease (dec)=0A= =0A= Diff finished. Mon Jun 22 11:42:00 2009=0A= ------=_NextPart_000_003D_01C9F33E.F9C61500--