* bug#9970: 24.0.90; Commandify set-frame-{height,width}
@ 2011-11-06 10:54 Harald Hanche-Olsen
2019-08-18 23:50 ` Lars Ingebrigtsen
0 siblings, 1 reply; 6+ messages in thread
From: Harald Hanche-Olsen @ 2011-11-06 10:54 UTC (permalink / raw)
To: 9970
This is a feature request, not a bug report:
I suggest turning set-frame-width and set-frame-height into commands,
so that you can type, e.g., C-u 80 M-x set-frame-width RET in order to
set the width of the current frame to 80 characters. Without a prefix
character, the commands should prompt the user. (I see no reason to
allow the specification of a frame other than the current, or to
support the PRETEND arg, in interactive use.)
In GNU Emacs 24.0.90.1 (x86_64-apple-darwin11.2.0, NS apple-appkit-1138.23)
of 2011-10-20 on mack
Windowing system distributor `Apple', version 10.3.1138
configured using `configure '--with-ns''
- Harald
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#9970: 24.0.90; Commandify set-frame-{height,width}
2011-11-06 10:54 bug#9970: 24.0.90; Commandify set-frame-{height,width} Harald Hanche-Olsen
@ 2019-08-18 23:50 ` Lars Ingebrigtsen
2019-08-20 21:52 ` Juri Linkov
0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-18 23:50 UTC (permalink / raw)
To: Harald Hanche-Olsen; +Cc: 9970
Harald Hanche-Olsen <hanche@math.ntnu.no> writes:
> This is a feature request, not a bug report:
>
> I suggest turning set-frame-width and set-frame-height into commands,
> so that you can type, e.g., C-u 80 M-x set-frame-width RET in order to
> set the width of the current frame to 80 characters. Without a prefix
> character, the commands should prompt the user. (I see no reason to
> allow the specification of a frame other than the current, or to
> support the PRETEND arg, in interactive use.)
Sounds like a useful addition, so I've now added this to Emacs 27.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#9970: 24.0.90; Commandify set-frame-{height,width}
2019-08-18 23:50 ` Lars Ingebrigtsen
@ 2019-08-20 21:52 ` Juri Linkov
2019-08-21 20:05 ` Lars Ingebrigtsen
0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2019-08-20 21:52 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: Harald Hanche-Olsen, 9970
>> This is a feature request, not a bug report:
>>
>> I suggest turning set-frame-width and set-frame-height into commands,
>> so that you can type, e.g., C-u 80 M-x set-frame-width RET in order to
>> set the width of the current frame to 80 characters. Without a prefix
>> character, the commands should prompt the user. (I see no reason to
>> allow the specification of a frame other than the current, or to
>> support the PRETEND arg, in interactive use.)
>
> Sounds like a useful addition, so I've now added this to Emacs 27.
Maybe better to use (prefix-numeric-value current-prefix-arg)
to allow e.g. C-u C-u M-x set-frame-height RET
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#9970: 24.0.90; Commandify set-frame-{height,width}
2019-08-20 21:52 ` Juri Linkov
@ 2019-08-21 20:05 ` Lars Ingebrigtsen
[not found] ` <m1ft176jnx.fsf@yahoo.es>
0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-21 20:05 UTC (permalink / raw)
To: Juri Linkov; +Cc: Harald Hanche-Olsen, 9970
Juri Linkov <juri@linkov.net> writes:
> Maybe better to use (prefix-numeric-value current-prefix-arg)
> to allow e.g. C-u C-u M-x set-frame-height RET
Yup; good catch. I've now changed this.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#9970: 24.0.90; Commandify set-frame-{height,width}
[not found] ` <m1im5ulz0e.fsf@yahoo.es>
@ 2021-03-15 17:16 ` Juri Linkov
2021-03-16 0:30 ` Lars Ingebrigtsen
1 sibling, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2021-03-15 17:16 UTC (permalink / raw)
To: Daniel Martín; +Cc: Lars Ingebrigtsen, Harald Hanche-Olsen, 9970
reopen 9970
thanks
>>> Would it make sense to ask for the frame width and height using the
>>> minibuffer if no prefix argument is provided? Right now, if you try the
>>> command, the frame resizes to a somewhat arbitrary size, which may
>>> confuse some users.
>>
>> I guess that'd be a natural addition -- we have many commands that
>> either take a numerical prefix, or query the user if there isn't any
>> prefix.
>
> I've attached a patch that implements the idea. It offers the current
> width or height by default, so you can estimate better the new size
> you'd want. Thanks.
frame.el is preloaded as well, so frame.el would be a more
suitable place for this function.
> From 1d48a90b584207290d8785ac4b294b43cc5851b3 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <mardani29@yahoo.es>
> Date: Sun, 14 Mar 2021 12:33:00 +0100
> Subject: [PATCH] Add minibuffer input support to commands that set the frame
> size
>
> * lisp/subr.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.
> ---
> doc/lispref/frames.texi | 12 ++++++------
> etc/NEWS | 4 ++++
> lisp/subr.el | 8 ++++++++
> src/frame.c | 4 ++--
> 4 files changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
> index f4316b753d..cd2ff8f3b3 100644
> --- a/doc/lispref/frames.texi
> +++ b/doc/lispref/frames.texi
> @@ -1120,9 +1120,9 @@ Frame Size
> 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 @@ Frame Size
> 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
> diff --git a/etc/NEWS b/etc/NEWS
> index fa8784db59..08935dcce4 100644
> --- 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
>
> diff --git a/lisp/subr.el b/lisp/subr.el
> index ef0e5e6f78..692346c8ba 100644
> --- a/lisp/subr.el
> +++ b/lisp/subr.el
> @@ -2965,6 +2965,14 @@ goto-char--read-natnum-interactive
> (default (and (natnump number) number)))
> (list (read-number prompt (list default (point)))))))
>
> +(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)))))))
> +
> \f
> (defvar read-char-history nil
> "The default history for the `read-char-from-minibuffer' function.")
> diff --git a/src/frame.c b/src/frame.c
> index a62347c1fb..cfdf3b6193 100644
> --- a/src/frame.c
> +++ b/src/frame.c
> @@ -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 @@ DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 4,
> }
>
> 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
> --
> 2.28.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#9970: 24.0.90; Commandify set-frame-{height,width}
[not found] ` <m1im5ulz0e.fsf@yahoo.es>
2021-03-15 17:16 ` Juri Linkov
@ 2021-03-16 0:30 ` Lars Ingebrigtsen
1 sibling, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-16 0:30 UTC (permalink / raw)
To: Daniel Martín; +Cc: Harald Hanche-Olsen, 9970, Juri Linkov
Daniel Martín <mardani29@yahoo.es> writes:
> I've attached a patch that implements the idea. It offers the current
> width or height by default, so you can estimate better the new size
> you'd want. Thanks.
Looks good to me, so I've applied it to Emacs 28 (but moved the helper
to frame.el, as Juri suggested).
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-03-16 0:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-06 10:54 bug#9970: 24.0.90; Commandify set-frame-{height,width} Harald Hanche-Olsen
2019-08-18 23:50 ` Lars Ingebrigtsen
2019-08-20 21:52 ` Juri Linkov
2019-08-21 20:05 ` Lars Ingebrigtsen
[not found] ` <m1ft176jnx.fsf@yahoo.es>
[not found] ` <87k0qhmok6.fsf@gnus.org>
[not found] ` <m1im5ulz0e.fsf@yahoo.es>
2021-03-15 17:16 ` Juri Linkov
2021-03-16 0:30 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.