Changeset - bed3532125d1
[Not reviewed]
0 1 0
Sergey Pashinin - 11 years ago 2014-08-23 12:59:19
sergey@pashinin.com
(Re)moved wg-restore-window-positions
1 file changed with 11 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/workgroups-win.el
Show inline comments
 
@@ -79,74 +79,72 @@
 
  (wg-minify-win (wg-copy-win (wg-last-win w))))
 

	
 
(defun wg-w-size (w &optional height)
 
  "Return the width or height of W, calculated from its edge list."
 
  (wg-with-edges w (l1 t1 r1 b1)
 
    (if height (- b1 t1) (- r1 l1))))
 

	
 
(defun wg-adjust-w-size (w width-fn height-fn &optional new-left new-top)
 
  "Adjust W's width and height with WIDTH-FN and HEIGHT-FN."
 
  (wg-with-edges w (left top right bottom)
 
    (let ((left (or new-left left)) (top (or new-top top)))
 
      (wg-set-edges (wg-copy-w w)
 
                    (list left
 
                          top
 
                          (+ left (funcall width-fn  (- right  left)))
 
                          (+ top  (funcall height-fn (- bottom top))))))))
 

	
 
(defun wg-scale-w-size (w width-scale height-scale)
 
  "Scale W's size by WIDTH-SCALE and HEIGHT-SCALE."
 
  (cl-labels
 
      ((wscale (width)  (truncate (* width  width-scale)))
 
       (hscale (height) (truncate (* height height-scale))))
 
    (wg-adjust-w-size w #'wscale #'hscale)))
 

	
 
(defun wg-restore-window (win)
 
  "Restore WIN in `selected-window'."
 
  (let ((selwin (selected-window))
 
        (buf (wg-find-buf-by-uid (wg-win-buf-uid win))))
 
    (if (not buf)
 
        (wg-restore-default-buffer)
 
      (when (wg-restore-buffer buf t)
 

	
 

	
 
(defun wg-restore-window-positions (win &optional window)
 
  "Restore various positions in WINDOW from their values in WIN."
 
  (let ((window (or window (selected-window))))
 
        ;; Restore various positions in WINDOW from their values in WIN
 
        ;; (wg-restore-window-positions win selwin)
 
        (let ((window (or selwin (selected-window))))
 
          (wg-with-slots win
 
              ((win-point wg-win-point)
 
               (win-start wg-win-start)
 
               (win-hscroll wg-win-hscroll))
 
            (set-window-start window win-start t)
 
            (set-window-hscroll window win-hscroll)
 
            (set-window-point
 
             window
 
             (cond ((not wg-restore-point) win-start)
 
                   ((eq win-point :max) (point-max))
 
                   (t win-point)))
 
      (when (>= win-start (point-max)) (recenter)))))
 
            (when (>= win-start (point-max)) (recenter))))
 

	
 
(defun wg-restore-window (win)
 
  "Restore WIN in `selected-window'."
 
  (let ((selwin (selected-window))
 
        (buf (wg-find-buf-by-uid (wg-win-buf-uid win))))
 
    (if (not buf)
 
        (wg-restore-default-buffer)
 
      (when (wg-restore-buffer buf t)
 
        (wg-restore-window-positions win selwin)
 
        (when wg-restore-window-dedicated-p
 
          (set-window-dedicated-p selwin (wg-win-dedicated win)))))
 
    (ignore-errors
 
      (set-window-prev-buffers
 
       selwin (wg-unpickel (wg-win-parameter win 'prev-buffers)))
 
      (set-window-next-buffers
 
       selwin (wg-unpickel (wg-win-parameter win 'next-buffers)))
 
      )))
 

	
 

	
 
(defun wg-window-point (ewin)
 
  "Return `point' or :max.  See `wg-restore-point-max'.
 
EWIN should be an Emacs window object."
 
  (let ((p (window-point ewin)))
 
    (if (and wg-restore-point-max (= p (point-max))) :max p)))
 

	
 
(defun wg-win-parameter (win parameter &optional default)
 
  "Return WIN's value for PARAMETER.
 
If PARAMETER is not found, return DEFAULT which defaults to nil.
 
SESSION nil defaults to the current session."
 
  (wg-aget (wg-win-parameters win) parameter default))
 

	
 
(defun wg-set-win-parameter (win parameter value)
 
  "Set WIN's value of PARAMETER to VALUE.
0 comments (0 inline, 0 general)