unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* other-window-or-frame
@ 2006-01-05  4:28 Drew Adams
  2006-01-05 17:05 ` other-window-or-frame Kevin Rodgers
  2006-01-05 23:11 ` other-window-or-frame Richard M. Stallman
  0 siblings, 2 replies; 4+ messages in thread
From: Drew Adams @ 2006-01-05  4:28 UTC (permalink / raw)


If a frame is `one-window-p', command `other-window' silently does nothing.
It might be better to let it do `other-frame' in that case. The optional
second arg to `other-window' is not accessible interactively anyway, so what
about this:

1. Bind a new command to `C-x o', to replace `other-window'. It would do the
same thing except when `one-window-p' - in that case, it would do
`other-frame'.

2. Keep function `other-window' as is (with its second arg), for Lisp.

IOW (but with a better doc string):

 (defun other-window-or-frame (arg)
   "`other-frame', if `one-window-p'; otherwise, `other-window'."
   (interactive "p")
   (if (one-window-p) (other-frame arg) (other-window arg)))

 (define-key ctl-x-map "o" 'other-window-or-frame)

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

* Re: other-window-or-frame
  2006-01-05  4:28 other-window-or-frame Drew Adams
@ 2006-01-05 17:05 ` Kevin Rodgers
  2006-02-01 19:13   ` other-window-or-frame Kevin Rodgers
  2006-01-05 23:11 ` other-window-or-frame Richard M. Stallman
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2006-01-05 17:05 UTC (permalink / raw)


Drew Adams wrote:
> If a frame is `one-window-p', command `other-window' silently does nothing.
> It might be better to let it do `other-frame' in that case. The optional
> second arg to `other-window' is not accessible interactively anyway, so what
> about this:
> 
> 1. Bind a new command to `C-x o', to replace `other-window'. It would do the
> same thing except when `one-window-p' - in that case, it would do
> `other-frame'.
> 
> 2. Keep function `other-window' as is (with its second arg), for Lisp.
> 
> IOW (but with a better doc string):
> 
>  (defun other-window-or-frame (arg)
>    "`other-frame', if `one-window-p'; otherwise, `other-window'."
>    (interactive "p")
>    (if (one-window-p) (other-frame arg) (other-window arg)))
> 
>  (define-key ctl-x-map "o" 'other-window-or-frame)

Actually, now that you mention it, I've just added this to my .emacs:

(defadvice other-window (before one-window-p activate)
   "If there are no other windows, signal an error."
   (when (one-window-p)
     (error "No other windows")))

(defadvice other-frame (before one-frame-p activate)
   "If there are no other frames, signal an error."
   (when (= (length (frame-list)) 1)
     (error "No other frames")))

(setq debug-ignored-errors
       (cons "\\`No other \\(window\\|frame\\)s\\'" debug-ignored-errors))

-- 
Kevin

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

* Re: other-window-or-frame
  2006-01-05  4:28 other-window-or-frame Drew Adams
  2006-01-05 17:05 ` other-window-or-frame Kevin Rodgers
@ 2006-01-05 23:11 ` Richard M. Stallman
  1 sibling, 0 replies; 4+ messages in thread
From: Richard M. Stallman @ 2006-01-05 23:11 UTC (permalink / raw)
  Cc: emacs-devel

    If a frame is `one-window-p', command `other-window' silently does nothing.
    It might be better to let it do `other-frame' in that case.

Let's not consider this now.

I hope soon that Friedrich Delgado will get back in touch and we can
debug the GC probles and move on to make a pretest.

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

* Re: other-window-or-frame
  2006-01-05 17:05 ` other-window-or-frame Kevin Rodgers
@ 2006-02-01 19:13   ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2006-02-01 19:13 UTC (permalink / raw)


Kevin Rodgers wrote:
> Drew Adams wrote:
>> If a frame is `one-window-p', command `other-window' silently does 
>> nothing.
>> It might be better to let it do `other-frame' in that case. The optional
>> second arg to `other-window' is not accessible interactively anyway, 
>> so what
>> about this:
>>
>> 1. Bind a new command to `C-x o', to replace `other-window'. It would 
>> do the
>> same thing except when `one-window-p' - in that case, it would do
>> `other-frame'.
>>
>> 2. Keep function `other-window' as is (with its second arg), for Lisp.
>>
>> IOW (but with a better doc string):
>>
>>  (defun other-window-or-frame (arg)
>>    "`other-frame', if `one-window-p'; otherwise, `other-window'."
>>    (interactive "p")
>>    (if (one-window-p) (other-frame arg) (other-window arg)))
>>
>>  (define-key ctl-x-map "o" 'other-window-or-frame)
> 
> Actually, now that you mention it, I've just added this to my .emacs:
> 
> (defadvice other-window (before one-window-p activate)
>   "If there are no other windows, signal an error."
>   (when (one-window-p)
>     (error "No other windows")))
> 
> (defadvice other-frame (before one-frame-p activate)
>   "If there are no other frames, signal an error."
>   (when (= (length (frame-list)) 1)
>     (error "No other frames")))

Just to follow up: Experience proved that to be completely unsatisfactory
since the advice affects all calls to those functions.  This is better:

(defadvice other-window (before one-window-p activate)
   "When called interactively, signal an error if there are no other 
windows."
   (when (and (interactive-p) (one-window-p))
     (error "No other windows")))

(defadvice other-frame (before one-frame-p activate)
   "When called interactively, signal an error if there are no other 
frames."
   (when (and (interactive-p) (= (length (frame-list)) 1))
     (error "No other frames")))

> (setq debug-ignored-errors
>       (cons "\\`No other \\(window\\|frame\\)s\\'" debug-ignored-errors))

-- 
Kevin Rodgers

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

end of thread, other threads:[~2006-02-01 19:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-05  4:28 other-window-or-frame Drew Adams
2006-01-05 17:05 ` other-window-or-frame Kevin Rodgers
2006-02-01 19:13   ` other-window-or-frame Kevin Rodgers
2006-01-05 23:11 ` other-window-or-frame Richard M. Stallman

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).