Allow set-frame-height/set-frame-width to be used interactively

* doc/lispref/frames.texi (Frame Size): Document it.

* src/frame.c (Fset_frame_height):
(Fset_frame_width): Make into commands that use the numeric prefix
to set height/width (bug#9970).
This commit is contained in:
Lars Ingebrigtsen 2019-08-18 16:50:08 -07:00
parent b8c4a9e0f8
commit 1b96e022b6
3 changed files with 25 additions and 4 deletions

View file

@ -1111,6 +1111,10 @@ The optional fourth argument @var{pixelwise} non-@code{nil} means that
@code{frame-resize-pixelwise} is @code{nil}, some window managers may
refuse to truly honor the request if it does not increase/decrease the
frame height to a multiple of its character height.
When used interactively, this command will set the height of the
currently selected frame to the number of lines specified by the
numeric prefix.
@end defun
@defun set-frame-width frame width &optional pretend pixelwise
@ -1123,6 +1127,10 @@ The optional fourth argument @var{pixelwise} non-@code{nil} means that
@code{frame-resize-pixelwise} is @code{nil}, some window managers may
refuse to fully honor the request if it does not increase/decrease the
frame width to a multiple of its character width.
When used interactively, this command will set the width of the
currently selected frame to the number of columns specified by the
numeric prefix.
@end defun
None of these three functions will make a frame smaller than needed to

View file

@ -243,6 +243,11 @@ the call to 'desktop-read' in this hook, if you want the GUI settings
to be restored, or if desktop.el needs to interact with you during
restoration of the session.
+++
** The functions 'set-frame-height' and 'set-frame-width' are now
commands, and will set the currently selected frame to the height/
width specified by the numeric prefix.
+++
** New function 'logcount' calculates an integer's Hamming weight.

View file

@ -3491,7 +3491,8 @@ DEFUN ("frame-bottom-divider-width", Fbottom_divider_width, Sbottom_divider_widt
return make_fixnum (FRAME_BOTTOM_DIVIDER_WIDTH (decode_any_frame (frame)));
}
DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 4, 0,
DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 4,
"(list (selected-frame) current-prefix-arg)",
doc: /* Set text height of frame FRAME to HEIGHT lines.
Optional third arg PRETEND non-nil means that redisplay should use
HEIGHT lines but that the idea of the actual height of the frame should
@ -3500,7 +3501,10 @@ not be changed.
Optional fourth argument PIXELWISE non-nil means that FRAME should be
HEIGHT pixels high. Note: When `frame-resize-pixelwise' is nil, some
window managers may refuse to honor a HEIGHT that is not an integer
multiple of the default frame font height. */)
multiple of the default frame font height.
When called interactively, HEIGHT is the numeric prefix and the
currenly selected frame will be set to this height. */)
(Lisp_Object frame, Lisp_Object height, Lisp_Object pretend, Lisp_Object pixelwise)
{
struct frame *f = decode_live_frame (frame);
@ -3516,7 +3520,8 @@ multiple of the default frame font height. */)
return Qnil;
}
DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 4, 0,
DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 4,
"(list (selected-frame) current-prefix-arg)",
doc: /* Set text width of frame FRAME to WIDTH columns.
Optional third arg PRETEND non-nil means that redisplay should use WIDTH
columns but that the idea of the actual width of the frame should not
@ -3525,7 +3530,10 @@ be changed.
Optional fourth argument PIXELWISE non-nil means that FRAME should be
WIDTH pixels wide. Note: When `frame-resize-pixelwise' is nil, some
window managers may refuse to honor a WIDTH that is not an integer
multiple of the default frame font width. */)
multiple of the default frame font width.
When called interactively, WIDTH is the numeric prefix and the
currenly selected frame will be set to this width. */)
(Lisp_Object frame, Lisp_Object width, Lisp_Object pretend, Lisp_Object pixelwise)
{
struct frame *f = decode_live_frame (frame);