prefix. Holding down a mouse button and moving the mouse left and
right will make the clicked-on window thinner or wider."
(interactive "e")
- (let ((done nil)
- (echo-keystrokes 0)
- (start-event-frame (window-frame (car (car (cdr start-event)))))
- (start-event-window (car (car (cdr start-event))))
- (start-nwindows (count-windows t))
- (old-selected-window (selected-window))
- event mouse x left right edges wconfig growth)
+ (let* ((done nil)
+ (echo-keystrokes 0)
+ (start-event-frame (window-frame (car (car (cdr start-event)))))
+ (scroll-bar-left
+ (eq (cdr (assq 'vertical-scroll-bars (frame-parameters))) 'left))
+ (start-event-window (car (car (cdr start-event))))
+ (start-nwindows (count-windows t))
+ (old-selected-window (selected-window))
+ event mouse x left right edges wconfig growth)
(if (one-window-p t)
(error "Attempt to resize sole ordinary window"))
- (if (= (nth 2 (window-edges start-event-window))
- (frame-width start-event-frame))
+ (if (if scroll-bar-left
+ (= (nth 2 (window-edges start-event-window))
+ (frame-width start-event-frame))
+ (= (nth 0 (window-edges start-event-window)) 0))
(error "Attempt to drag rightmost scrollbar"))
(unwind-protect
(track-mouse
edges (window-edges)
left (nth 0 edges)
right (nth 2 edges))
+ (setq foo (cons (list x left) foo))
;; scale back a move that would make the
;; window too thin.
- (cond ((< (- x left -1) window-min-width)
- (setq x (+ left window-min-width -1))))
+ (if scroll-bar-left
+ (cond ((< (- right x) window-min-width)
+ (setq x (- right window-min-width))))
+ (cond ((< (- x left -1) window-min-width)
+ (setq x (+ left window-min-width -1)))))
;; compute size change needed
- (setq growth (- x right -1)
+ (setq growth (if scroll-bar-left
+ (- left x)
+ (- x right -1))
wconfig (current-window-configuration))
+ (message "%s" growth)
(enlarge-window growth t)
;; if this window's growth caused another
;; window to be deleted because it was too
;; from a window to the left of this one,
;; rescind the change.
(if (or (/= start-nwindows (count-windows t))
- (/= left (nth 0 (window-edges))))
+ (if scroll-bar-left
+ (/= right (nth 2 (window-edges)))
+ (/= left (nth 0 (window-edges)))))
(set-window-configuration wconfig)))))))
;; restore the old selected window
(select-window old-selected-window))))