unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#67452: 30.0.50; [PATCH] Make split-root-window functions handle argument
@ 2023-11-26  8:42 Cy
  2023-11-26 11:01 ` Eli Zaretskii
       [not found] ` <handler.67452.D67452.17012674078751.notifdone@debbugs.gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Cy @ 2023-11-26  8:42 UTC (permalink / raw)
  To: 67452

[-- Attachment #1: Type: text/plain, Size: 325 bytes --]

Hello,

I noticed the split-root-window-below and split-root-window-right 
commands fail when passing an argument using C-u:

split-root-window-right: Wrong type argument: number-or-marker-p, (4)

I have edited these functions to remedy this error, and attached a 
patch. I hope that the changes are satisfactory.

Best,

Cy

[-- Attachment #2: 0001-Make-split-root-window-functions-handle-argument.patch --]
[-- Type: text/x-patch, Size: 1443 bytes --]

From e8f3751a085962c85e5f360469ce00229f4ea60f Mon Sep 17 00:00:00 2001
From: Cy <cycoding23@gmail.com>
Date: Sun, 26 Nov 2023 00:34:25 -0800
Subject: [PATCH] Make split-root-window functions handle argument

* lisp/window.el (split-root-window-below, split-root-window-right): Handle prefix argument passed by C-u
---
 lisp/window.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/window.el b/lisp/window.el
index 0c5ccf167dc..22ed8cc2bdf 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5735,7 +5735,8 @@ amount of redisplay; this is convenient on slow terminals."
 The current window configuration is retained in the top window,
 the lower window takes up the whole width of the frame.  SIZE is
 handled as in `split-window-below'."
-  (interactive "P")
+  (interactive (when current-prefix-arg
+                 (prefix-numeric-value current-prefix-arg)))
   (split-window-below size (frame-root-window)))
 
 (defun split-window-right (&optional size window-to-split)
@@ -5775,7 +5776,8 @@ The current window configuration is retained within the left
 window, and a new window is created on the right, taking up the
 whole height of the frame.  SIZE is treated as by
 `split-window-right'."
-  (interactive "P")
+  (interactive (when current-prefix-arg
+                 (prefix-numeric-value current-prefix-arg)))
   (split-window-right size (frame-root-window)))
 \f
 ;;; Balancing windows.
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#67452: 30.0.50; [PATCH] Make split-root-window functions handle argument
  2023-11-26  8:42 bug#67452: 30.0.50; [PATCH] Make split-root-window functions handle argument Cy
@ 2023-11-26 11:01 ` Eli Zaretskii
  2023-11-27  9:20   ` martin rudalics
       [not found] ` <handler.67452.D67452.17012674078751.notifdone@debbugs.gnu.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-11-26 11:01 UTC (permalink / raw)
  To: Cy, martin rudalics; +Cc: 67452

> Date: Sun, 26 Nov 2023 00:42:54 -0800
> From: Cy <cycoding23@gmail.com>
> 
> I noticed the split-root-window-below and split-root-window-right 
> commands fail when passing an argument using C-u:
> 
> split-root-window-right: Wrong type argument: number-or-marker-p, (4)
> 
> I have edited these functions to remedy this error, and attached a 
> patch. I hope that the changes are satisfactory.

I guess we should do this for consistency with other split-window-*
commands?  Martin, any reasons the split-root-window-* commands didn't
follow the example of the corresponding split-window-* commands?

In any case, to make the split-root-window-* commands support C-u we
just need to change the interactive spec from "P" to "p", there's no
need for anything more complex.

Thanks.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#67452: 30.0.50; [PATCH] Make split-root-window functions handle argument
  2023-11-26 11:01 ` Eli Zaretskii
@ 2023-11-27  9:20   ` martin rudalics
  2023-11-29 14:16     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: martin rudalics @ 2023-11-27  9:20 UTC (permalink / raw)
  To: Eli Zaretskii, Cy; +Cc: 67452, hugo

 > I guess we should do this for consistency with other split-window-*
 > commands?  Martin, any reasons the split-root-window-* commands didn't
 > follow the example of the corresponding split-window-* commands?

No idea.  Maybe Hugo Heagren can tell.

 > In any case, to make the split-root-window-* commands support C-u we
 > just need to change the interactive spec from "P" to "p", there's no
 > need for anything more complex.

I think so.  Here 'split-window-below' and 'split-window-right' use

   (let* ((size (and size (prefix-numeric-value size)))

maybe to "just work" when being passed an invalid SIZE argument but I
don't remember the details.

martin





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#67452: 30.0.50; [PATCH] Make split-root-window functions handle argument
  2023-11-27  9:20   ` martin rudalics
@ 2023-11-29 14:16     ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2023-11-29 14:16 UTC (permalink / raw)
  To: martin rudalics; +Cc: hugo, 67452-done, cycoding23

> Date: Mon, 27 Nov 2023 10:20:36 +0100
> Cc: 67452@debbugs.gnu.org, hugo@heagren.com
> From: martin rudalics <rudalics@gmx.at>
> 
>  > I guess we should do this for consistency with other split-window-*
>  > commands?  Martin, any reasons the split-root-window-* commands didn't
>  > follow the example of the corresponding split-window-* commands?
> 
> No idea.  Maybe Hugo Heagren can tell.
> 
>  > In any case, to make the split-root-window-* commands support C-u we
>  > just need to change the interactive spec from "P" to "p", there's no
>  > need for anything more complex.
> 
> I think so.  Here 'split-window-below' and 'split-window-right' use
> 
>    (let* ((size (and size (prefix-numeric-value size)))
> 
> maybe to "just work" when being passed an invalid SIZE argument but I
> don't remember the details.

Thanks, I've now installed the change on the emacs-29 branch, using
the "p" interactive spec, and I'm closing this bug.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#67452: 30.0.50; [PATCH] Make split-root-window functions handle argument
       [not found] ` <handler.67452.D67452.17012674078751.notifdone@debbugs.gnu.org>
@ 2023-12-24 17:41   ` Juri Linkov
  2023-12-25 13:00     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2023-12-24 17:41 UTC (permalink / raw)
  To: 67452

> Thanks, I've now installed the change on the emacs-29 branch, using
> the "p" interactive spec, and I'm closing this bug.

The commit cd477bf07d8 broke normal use of split-root-window commands
without arguments:

0. emacs-29 -Q
1. C-x 2
2. C-x w 3

Debugger entered--Lisp error: (error "Window #<window 7> too small for splitting")
  error("Window %s too small for splitting" #<window 7>)
  split-window(#<window 7> 1 t)
  split-window-right(1 #<window 7>)
  split-root-window-right(1)
  funcall-interactively(split-root-window-right 1)
  command-execute(split-root-window-right)

because the "p" interactive spec uses SIZE=1.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#67452: 30.0.50; [PATCH] Make split-root-window functions handle argument
  2023-12-24 17:41   ` Juri Linkov
@ 2023-12-25 13:00     ` Eli Zaretskii
  2023-12-30  7:43       ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-12-25 13:00 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 67452

> From: Juri Linkov <juri@linkov.net>
> Date: Sun, 24 Dec 2023 19:41:37 +0200
> 
> > Thanks, I've now installed the change on the emacs-29 branch, using
> > the "p" interactive spec, and I'm closing this bug.
> 
> The commit cd477bf07d8 broke normal use of split-root-window commands
> without arguments:
> 
> 0. emacs-29 -Q
> 1. C-x 2
> 2. C-x w 3
> 
> Debugger entered--Lisp error: (error "Window #<window 7> too small for splitting")
>   error("Window %s too small for splitting" #<window 7>)
>   split-window(#<window 7> 1 t)
>   split-window-right(1 #<window 7>)
>   split-root-window-right(1)
>   funcall-interactively(split-root-window-right 1)
>   command-execute(split-root-window-right)
> 
> because the "p" interactive spec uses SIZE=1.

Thanks, should be fixed now on the emacs-29 branch.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#67452: 30.0.50; [PATCH] Make split-root-window functions handle argument
  2023-12-25 13:00     ` Eli Zaretskii
@ 2023-12-30  7:43       ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2023-12-30  7:43 UTC (permalink / raw)
  To: juri; +Cc: 67452-done

> Cc: 67452@debbugs.gnu.org
> Date: Mon, 25 Dec 2023 15:00:49 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: Juri Linkov <juri@linkov.net>
> > Date: Sun, 24 Dec 2023 19:41:37 +0200
> > 
> > > Thanks, I've now installed the change on the emacs-29 branch, using
> > > the "p" interactive spec, and I'm closing this bug.
> > 
> > The commit cd477bf07d8 broke normal use of split-root-window commands
> > without arguments:
> > 
> > 0. emacs-29 -Q
> > 1. C-x 2
> > 2. C-x w 3
> > 
> > Debugger entered--Lisp error: (error "Window #<window 7> too small for splitting")
> >   error("Window %s too small for splitting" #<window 7>)
> >   split-window(#<window 7> 1 t)
> >   split-window-right(1 #<window 7>)
> >   split-root-window-right(1)
> >   funcall-interactively(split-root-window-right 1)
> >   command-execute(split-root-window-right)
> > 
> > because the "p" interactive spec uses SIZE=1.
> 
> Thanks, should be fixed now on the emacs-29 branch.

No further comments, so I presume the bug was fixed, and I'm closing
it.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-12-30  7:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-26  8:42 bug#67452: 30.0.50; [PATCH] Make split-root-window functions handle argument Cy
2023-11-26 11:01 ` Eli Zaretskii
2023-11-27  9:20   ` martin rudalics
2023-11-29 14:16     ` Eli Zaretskii
     [not found] ` <handler.67452.D67452.17012674078751.notifdone@debbugs.gnu.org>
2023-12-24 17:41   ` Juri Linkov
2023-12-25 13:00     ` Eli Zaretskii
2023-12-30  7:43       ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).