From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bastien Newsgroups: gmane.emacs.devel Subject: Re: New keybinding suggestion: C-x _ for `shrink-window' Date: Mon, 05 Nov 2007 03:30:24 +0000 Message-ID: <87d4upxtbj.fsf@bzg.ath.cx> References: <87prysd8n6.fsf@bzg.ath.cx> <87prys55kc.fsf@catnip.gol.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1194229850 22862 80.91.229.12 (5 Nov 2007 02:30:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 5 Nov 2007 02:30:50 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 05 03:30:53 2007 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 1Iorjp-0003nX-2E for ged-emacs-devel@m.gmane.org; Mon, 05 Nov 2007 03:30:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iorje-0002h8-El for ged-emacs-devel@m.gmane.org; Sun, 04 Nov 2007 21:30:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iorjb-0002fG-8D for emacs-devel@gnu.org; Sun, 04 Nov 2007 21:30:39 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IorjY-0002cH-Np for emacs-devel@gnu.org; Sun, 04 Nov 2007 21:30:37 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IorjY-0002cE-Hk for emacs-devel@gnu.org; Sun, 04 Nov 2007 21:30:36 -0500 Original-Received: from nf-out-0910.google.com ([64.233.182.185]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IorjY-0000Qj-2l for emacs-devel@gnu.org; Sun, 04 Nov 2007 21:30:36 -0500 Original-Received: by nf-out-0910.google.com with SMTP id f5so1405816nfh for ; Sun, 04 Nov 2007 18:30:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:received:from:to:subject:in-reply-to:references:user-agent:date:message-id:mime-version:content-type:sender; bh=xE7jjw8rVC1fS1kTAVBYWNLN8ebekG4B/Ew2dZDy39g=; b=rMlDHyJVuZff7zKF1mB68Q8uCDoYnE1+g+ku/c+aWaS0kUDNMSqtiPTs8aVrHyGRhIhs1FUmGhDWRkP2mxS4kMf5cg7XWgah5ZaVzcdAR9AgVto4Ik6w3YEbeKsk6Q+8VX1qk4xJEv862cLUM3k6JTRyxvbiu9oKhF6vNALpq7I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:from:to:subject:in-reply-to:references:user-agent:date:message-id:mime-version:content-type:sender; b=cV4T8bPW0ZJVqSoXm0GMlYIe/JxvVjBLQhq6wKqdfAto79Fwh4EKLsrCMg6tzJPIOBuk/NtWGG7SXnos7WpfasiO+5Jrpa3cwp+q7WN71c3Cap9aLUJHtTxOPMWAE79qQ0XYGmQMsdtfn5CPji6rufn4jzCX5qS+/rgwx4Gah50= Original-Received: by 10.86.65.11 with SMTP id n11mr3024616fga.1194229834797; Sun, 04 Nov 2007 18:30:34 -0800 (PST) Original-Received: from bzg.ath.cx ( [78.113.180.159]) by mx.google.com with ESMTPS id u9sm13460009muf.2007.11.04.18.30.29 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 04 Nov 2007 18:30:30 -0800 (PST) Original-Received: by bzg.ath.cx (Postfix, from userid 1000) id A42711575BA; Mon, 5 Nov 2007 03:30:24 +0000 (GMT) In-Reply-To: (Richard Stallman's message of "Sat, 03 Nov 2007 20:11:03 -0400") User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.0 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:82536 Archived-At: --=-=-= Richard Stallman writes: > We could give it a try and see what users think of it. Here is another try. It uses the arrow keys to push borders and -/+ for raw shrinking/enlarging. I've also added other keys like `s' to store a window configuration and '_' to call it back. See the docstring for details. Feedback welcome. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline; filename=window-reorganize.el Content-Transfer-Encoding: 8bit (defun window-reorganize (&optional arg wcf) "Reorganize windows interactively. ARG is the number of lines by which the window should be resized. WCF is the last stored window configuration. Use the arrow keys to push the corresponding border by ARG lines. Use S- to increase ARG, S- to decrease ARG. Use M- to temporarily negate ARG and push a border. Use S- to navigate through windows. Use `=' to balance windows. Use `+' to enlarge current window. Use `-' to shrink current window. Use `1' to delete windows. Use `2' to split current window vertically. Use `3' to split current window horizontally. Use `s' to store actual window configuration. Use `_' to restore last stored window configuration. Use `q' to quit." (interactive "p") (require 'windmove) (unless arg (setq arg 1)) (setq wcf (current-window-configuration)) (catch 'done (while t (message "Use arrow keys to push borders by %d (S- to increase)" arg) (ignore-errors (let ((window-size-fixed nil) (bottom (string-match "Minibuf" (buffer-name (window-buffer (windmove-find-other-window 'down))))) (e (read-event)) neg) (when (memq e '(M-left M-right M-up M-down)) (setq arg (- arg)) (setq neg t)) (cond ((memq e '(left M-left)) (if (windmove-find-other-window 'left) (progn (windmove-left) (shrink-window-horizontally arg) (windmove-right)) (shrink-window-horizontally arg))) ((memq e '(right M-right)) (if (windmove-find-other-window 'right) (enlarge-window-horizontally arg) (shrink-window-horizontally arg))) ((memq e '(up M-up)) (if (windmove-find-other-window 'up) (progn (windmove-up) (shrink-window arg) (windmove-down)) (unless bottom (shrink-window arg)))) ((memq e '(down M-down)) (cond ((and bottom (windmove-find-other-window 'up)) (shrink-window arg)) (bottom (enlarge-window arg)) ((windmove-find-other-window 'down) (enlarge-window arg)) (t (shrink-window arg)))) ((eq e ?=) (balance-windows)) ((eq e ?+) (enlarge-window arg)) ((eq e ?-) (shrink-window arg)) ((eq e ?1) (delete-other-windows)) ((eq e ?2) (split-window)) ((eq e ?3) (split-window-horizontally)) ((eq e ?o) (other-window 1)) ((eq e ?s) (setq wcf (current-window-configuration))) ((eq e ?_) (set-window-configuration wcf)) ((eq e 'S-left) (other-window -1)) ((eq e 'S-right) (other-window 1)) ((eq e 'S-down) (setq arg (1- arg))) ((eq e 'S-up) (setq arg (1+ arg))) ((eq e ?\^G) (keyboard-quit)) ((eq e ?q) (throw 'done t))) (if neg (setq arg (- arg))))))) (message "Done")) --=-=-= -- Bastien --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--