bug#27717: other-window when there is no other window

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#27717: other-window when there is no other window

積丹尼 Dan Jacobson
C-x o runs the command other-window.

Alas, if there is no other window, it does nothing.

It doesn't even print a message "no other window". BUG!

Better yet in this case would be just switch to an other buffer (the
same buffer that switch-to-buffer asks the user about, but without
asking the user.)

And only if there is also no other buffer, then print the message.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#27717: other-window when there is no other window

martin rudalics
 > C-x o runs the command other-window.
 >
 > Alas, if there is no other window, it does nothing.
 >
 > It doesn't even print a message "no other window". BUG!
 >
 > Better yet in this case would be just switch to an other buffer (the
 > same buffer that switch-to-buffer asks the user about, but without
 > asking the user.)
 >
 > And only if there is also no other buffer, then print the message.

The documentation of ‘other-window’ contains the sentence "COUNT zero
means do not skip any window, so select the selected window."  which
clearly indicates that "doing nothing" is a valid action in this case.
C-x 5 o behaves in a similar way.

Admittedly, saying that ‘other-window’ does "Select another window in
cyclic ordering of windows." is misleading.

martin




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#27717: other-window when there is no other window

積丹尼 Dan Jacobson
In reply to this post by 積丹尼 Dan Jacobson
>>>>> "mr" == martin rudalics <[hidden email]> writes:

mr> The documentation of ‘other-window’ contains the sentence "COUNT zero
mr> means do not skip any window, so select the selected window."  which
mr> clearly indicates that "doing nothing" is a valid action in this case.

"In an interactive call, COUNT is the numeric prefix argument."

All I know is the user did C-x o, not C-u 0 C-x o.

So I would hope the program would distinguish the two.




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#27717: other-window when there is no other window

Eli Zaretskii
> From: 積丹尼 Dan Jacobson
> <[hidden email]>
> Date: Sun, 16 Jul 2017 23:13:33 +0800
> Cc: [hidden email]
>
> "In an interactive call, COUNT is the numeric prefix argument."
>
> All I know is the user did C-x o, not C-u 0 C-x o.
>
> So I would hope the program would distinguish the two.

If your ring has exactly one slot, then going to the next will end up
right where you started.  There's nothing odd about that, and no
special reason to signal an error or output a message.  You can
instantly know what happened without any message.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#27717: other-window when there is no other window

積丹尼 Dan Jacobson
In reply to this post by 積丹尼 Dan Jacobson
>>>>> "EZ" == Eli Zaretskii <[hidden email]> writes:

EZ> If your ring has exactly one slot, then going to the next will end up
EZ> right where you started.  There's nothing odd about that, and no
EZ> special reason to signal an error or output a message.  You can
EZ> instantly know what happened without any message.

OK then don't print a message. But I hope you will implement my ideas
when the ring has more than one slot.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#27717: other-window when there is no other window

Marcin Borkowski-3
In reply to this post by 積丹尼 Dan Jacobson

On 2017-07-15, at 21:48, 積丹尼 Dan Jacobson <[hidden email]> wrote:

> C-x o runs the command other-window.
>
> Alas, if there is no other window, it does nothing.
>
> It doesn't even print a message "no other window". BUG!
>
> Better yet in this case would be just switch to an other buffer (the
> same buffer that switch-to-buffer asks the user about, but without
> asking the user.)
>
> And only if there is also no other buffer, then print the message.

How about this

http://mbork.pl/2017-02-26_other-window-or-switch-buffer

and that

http://mbork.pl/2017-06-12_smart-next-window-or-buffer

?

Best,

--
Marcin Borkowski



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#27717: other-window when there is no other window

積丹尼 Dan Jacobson
In reply to this post by 積丹尼 Dan Jacobson
>>>>> "MB" == Marcin Borkowski <[hidden email]> writes:

MB> How about this

MB> http://mbork.pl/2017-02-26_other-window-or-switch-buffer

Something's wrong.

I tried to modify this from your blog post,

(defun other-window-or-switch-buffer ()
  "Call `other-window' if more than one window is visible, switch
to next buffer otherwise."
  (interactive)
  (if (one-window-p)
          (switch-to-buffer nil)
        (other-window 1)))
(global-set-key "\C-xb" #'other-window-or-switch-buffer)

but there is something wrong with the ASCII or something.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#27717: other-window when there is no other window

martin rudalics
 > (global-set-key "\C-xb" #'other-window-or-switch-buffer)
 >
 > but there is something wrong with the ASCII or something.

Try adding a space to get "\C-x b".

martin



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#27717: other-window when there is no other window

積丹尼 Dan Jacobson
In reply to this post by 積丹尼 Dan Jacobson
OK. I think this would be a great redefinition of C-x o:

(defun other-window-or-switch-buffer ()
  "Call `other-window' if more than one window is visible, switch
to next buffer otherwise."
  (interactive)
  (if (one-window-p)
          (switch-to-buffer nil)
        (other-window 1)))
(global-set-key (kbd "C-x o") 'other-window-or-switch-buffer)

(I don't use frames. So don't know much about that part.)




Loading...