From 1b96e022b624d676d1457ff135000489c1a626f1 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 18 Aug 2019 16:50:08 -0700 Subject: [PATCH] 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). --- doc/lispref/frames.texi | 8 ++++++++ etc/NEWS | 5 +++++ src/frame.c | 16 ++++++++++++---- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 629cec3c5fe..618ea16fcf2 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -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 diff --git a/etc/NEWS b/etc/NEWS index 25c5ce658f0..23bf2b898a9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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. diff --git a/src/frame.c b/src/frame.c index d94de417e4d..50a7f138b81 100644 --- a/src/frame.c +++ b/src/frame.c @@ -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); -- 2.39.2