From 0ef2c2f2e63e6d5e173b076bca140ef0bc112df3 Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Thu, 18 Aug 1994 21:03:37 +0000 Subject: [PATCH] (split-window-horizontally): If size is negative, measure from the right. --- lisp/window.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/window.el b/lisp/window.el index bab282a265c..4ebe8b50e41 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -124,10 +124,14 @@ new mode line." (defun split-window-horizontally (&optional arg) "Split current window into two windows side by side. -This window becomes the leftmost of the two, and gets -ARG columns. No arg means split equally." +This window becomes the leftmost of the two, and gets ARG columns. +Negative arg means select the size of the rightmost window instead. +No arg means split equally." (interactive "P") - (split-window nil (and arg (prefix-numeric-value arg)) t)) + (let ((size (and arg (prefix-numeric-value arg)))) + (and size (< size 0) + (setq size (+ (window-width) size))) + (split-window nil size t))) (defun enlarge-window-horizontally (arg) "Make current window ARG columns wider."