]> git.eshelyaron.com Git - emacs.git/commitdiff
Add minibuffer input support to commands that set the frame size
authorDaniel Martín <mardani29@yahoo.es>
Tue, 16 Mar 2021 00:29:28 +0000 (01:29 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 16 Mar 2021 00:29:28 +0000 (01:29 +0100)
* lisp/frame.el (set-frame-property--interactive): Internal function to
produce the interactive form of `set-frame-width' and
`set-frame-height'.  Offer the current size as default.  (Bug#9970)
* src/frame.c (Fset_frame_height): Modify to call
`set-frame-property--interactive'.
(Fset_frame_width): Modify to call `set-frame-property--interactive'.
* doc/lispref/frames.texi (Frame Size): Update the manuals.
* etc/NEWS: Advertise the change (bug#9970).

doc/lispref/frames.texi
etc/NEWS
lisp/frame.el
src/frame.c

index f4316b753d833412a28e7c4560967555456e9ba8..cd2ff8f3b31d11d178f2bd33e72fa4429d347575 100644 (file)
@@ -1120,9 +1120,9 @@ The optional fourth argument @var{pixelwise} non-@code{nil} means that
 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.
+When used interactively, this command will ask the user for the number
+of lines to set the height of the currently selected frame.  You can
+also provide this value with a numeric prefix.
 @end defun
 
 @defun set-frame-width frame width &optional pretend pixelwise
@@ -1136,9 +1136,9 @@ The optional fourth argument @var{pixelwise} non-@code{nil} means that
 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.
+When used interactively, this command will ask the user for the number
+of columns to set the width of the currently selected frame.  You can
+also provide this value with a numeric prefix.
 @end defun
 
 None of these three functions will make a frame smaller than needed to
index 18b1252bcae6de05509fa76efc4d6e48cc78abe4..6fe98dbc1237c55b48c39afbf7bba89f8241388d 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -253,6 +253,10 @@ commands.  The new keystrokes are 'C-x x g' ('revert-buffer'),
 ('clone-buffer'), 'C-x x i' ('insert-buffer') and 'C-x x t'
 ('toggle-truncate-lines').
 
+---
+** Commands 'set-frame-width' and 'set-frame-height' can now get their
+input using the minibuffer.
+
 \f
 * Editing Changes in Emacs 28.1
 
index ce4de83b8c5132cfcc97bb091a77241bbf4157c3..409ce0563b5547624bc6db211c193bdbec06f305 100644 (file)
@@ -2733,6 +2733,14 @@ See also `toggle-frame-maximized'."
 (make-obsolete-variable
  'window-system-version "it does not give useful information." "24.3")
 
+(defun set-frame-property--interactive (prompt number)
+  "Get a value for `set-frame-width' or `set-frame-height', prompting with PROMPT.
+Offer NUMBER as default value, if it is a natural number."
+  (if (and current-prefix-arg (not (consp current-prefix-arg)))
+      (list (selected-frame) (prefix-numeric-value current-prefix-arg))
+    (let ((default (and (natnump number) number)))
+      (list (selected-frame) (read-number prompt (list default (point)))))))
+
 ;; Variables whose change of value should trigger redisplay of the
 ;; current buffer.
 ;; To test whether a given variable needs to be added to this list,
index a62347c1fb2a910b2514aef758efdbb13e854080..cfdf3b61938171dfcf2c1c8bb7882cfa4572da1d 100644 (file)
@@ -3595,7 +3595,7 @@ check_frame_pixels (Lisp_Object size, Lisp_Object pixelwise, int item_size)
 }
 
 DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 4,
-       "(list (selected-frame) (prefix-numeric-value current-prefix-arg))",
+       "(set-frame-property--interactive \"Frame height: \" (frame-height))",
        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
@@ -3620,7 +3620,7 @@ If FRAME is nil, it defaults to the selected frame.  */)
 }
 
 DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 4,
-       "(list (selected-frame) (prefix-numeric-value current-prefix-arg))",
+       "(set-frame-property--interactive \"Frame width: \" (frame-width))",
        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