bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11738: 24.1.50; Regression: `modify-frame-parameters' is broken for


From: Drew Adams
Subject: bug#11738: 24.1.50; Regression: `modify-frame-parameters' is broken for `left' & `top'
Date: Sat, 7 Jul 2012 08:34:48 -0700

ping.  This is a regression.

The frame position parameters (`left' and `top') are broken now.

Please restore the use of cons values, which are consistent and facilitate
programmatic manipulation of frames.

Consider also adding conversion functions such as these between the parameter
forms.  These are defined in `frame-fns.el' and have been in use for decades.

`frame-geom-spec-cons'
`frame-geom-value-cons'
`frame-geom-spec-numeric'
`frame-geom-value-numeric'

And consider adding incremental, wraparound frame movement functions such as
these, defined in `frame-cmds.el':

`move-frame-up'
`move-frame-down'
`move-frame-left'
`move-frame-right'

The definition of `*-right' or `*-down' shows the importance of supporting a
simple cons parameter value:

(defun move-frame-down (&optional increment frame)
  "Move FRAME (default: selected-frame) down by INCREMENT.
INCREMENT is in units of ten pixels.
Interactively, it is given by the prefix argument."
  (interactive "P")
  (setq increment (if increment
                      (prefix-numeric-value increment)
                    10)) ; 1 is too small
  (modify-frame-parameters
   frame
   (list (list 'top '+ (new-frame-position frame 'top increment)))))

(defun new-frame-position (frame type incr)
  "Return the new TYPE position of FRAME, incremented by INCR.
TYPE is `left' or `top'.
INCR is the increment to use when changing the position."
  (let ((new-pos
         (+ incr
            (cadr (frame-geom-value-cons 
                   type
                   (cdr (assq type (frame-parameters frame)))))))
        (display-dimension
         (if (eq 'left type)
             (available-screen-pixel-width t)
           (available-screen-pixel-height t)))
        (frame-dimension
         (if (eq 'left type)
             (frame-pixel-width frame)
           (frame-pixel-height frame))))
    (if (not move-frame-wrap-within-display-flag)
        new-pos
      (when (< new-pos (- frame-dimension))
        (setq new-pos display-dimension))
      (when (> new-pos display-dimension)
        (setq new-pos (- frame-dimension)))
      new-pos)))

http://www.emacswiki.org/emacs/download/frame-fns.el
http://www.emacswiki.org/emacs/download/frame-cmds.el


> ping.
> 
> > emacs -Q
> > In *scratch*:
> > (setq new (- (frame-parameter nil 'left) 10))
> > (setq new `(left + ,new))
> > (modify-frame-parameters nil (list new))
> >  
> > IOW, try to set `left' or `top' to a value that is a cons 
> > whose car is `left' or `top', whose cadr is `+' or `-',
> > and whose caddr is some new value.  Nothing happens.
> > 
> > This is a regression wrt ALL previous Emacs versions (well, ever
> > since we had frames).  It is important that the cons form of these
> > parameter values continue to be accepted, as it has always been.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]