unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* error "Cannot switch buffers in (minibuffer | a dedicated) window"
@ 2007-12-17 22:27 Drew Adams
  2007-12-18 15:56 ` Richard Stallman
  2007-12-21  0:43 ` Stefan Monnier
  0 siblings, 2 replies; 7+ messages in thread
From: Drew Adams @ 2007-12-17 22:27 UTC (permalink / raw)
  To: Emacs-Devel

The code is `no_switch_window', in buffer.c.

I wonder if this needs to be treated as an error. What is the use case?

Wouldn't it make sense to just switch to the buffer in another window,
instead of raising an error? If it is important to provide feedback that
Emacs couldn't use the requested window, then the message could still be
displayed, but without raising an error.

Treating this as an error just slows users down and makes them repeat the
command from another window or change to a command that uses another window.
(Of course, the buffer switch is not necessarily from a command; it could
come from code that tries to switch buffers where it shouldn't.)

Am I missing something, or is this a gratuitous error that just gets in the
way?

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

* Re: error "Cannot switch buffers in (minibuffer | a dedicated) window"
  2007-12-17 22:27 error "Cannot switch buffers in (minibuffer | a dedicated) window" Drew Adams
@ 2007-12-18 15:56 ` Richard Stallman
  2007-12-18 16:29   ` Drew Adams
  2007-12-21  0:43 ` Stefan Monnier
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2007-12-18 15:56 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

    Wouldn't it make sense to just switch to the buffer in another window,
    instead of raising an error?

If you are trying to switch buffers in the minibuffer you probably
don't know you're in the minibuffer.  If you get an error you will
probably type C-g which will get you out of it.  Switching buffers in
another window and remaining in the minibuffer seems like a bad idea.

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

* RE: error "Cannot switch buffers in (minibuffer | a dedicated) window"
  2007-12-18 15:56 ` Richard Stallman
@ 2007-12-18 16:29   ` Drew Adams
  2007-12-19 10:12     ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2007-12-18 16:29 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>     Wouldn't it make sense to just switch to the buffer in another window,
>     instead of raising an error?
>
> If you are trying to switch buffers in the minibuffer you probably
> don't know you're in the minibuffer. If you get an error you will
> probably type C-g which will get you out of it.  Switching buffers in
> another window and remaining in the minibuffer seems like a bad idea.

Thanks for the explanation. I guess that makes sense.

I agree that in this situation you probably don't know you're in the
minibuffer.

I was thinking that it would therefore be reasonable to exit the minibuffer
automatically at that point (the current level, if recursive) - that's
another way to remedy the mismatch between where the user thinks s?he is and
where s?he is. That is, instead of leaving the user in the minibuffer and
making him hit C-g to exit and then hit `C-x b' again, just assume that was
his intention.

Just assume, that is, that the user wants to (1) switch to the buffer and
(2) exit the minibuffer. This assumes that the main intention is to switch
to the buffer, with the particular window for the buffer not having a great
importance.

This would be a bit more DWIM and a bit less hands-off. The current approach
has the advantage of just informing the user of the state of things, without
assuming anything or trying to remedy the situation.

(Again, however, if we did this, it might be good to reserve it for
interactive buffer switching.)

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

* Re: error "Cannot switch buffers in (minibuffer | a dedicated) window"
  2007-12-18 16:29   ` Drew Adams
@ 2007-12-19 10:12     ` Richard Stallman
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2007-12-19 10:12 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

    I was thinking that it would therefore be reasonable to exit the minibuffer
    automatically at that point (the current level, if recursive) - that's
    another way to remedy the mismatch between where the user thinks s?he is and
    where s?he is.

Maybe we could make this particular error exit the minibuffer.
It might be more convenient, but it is also somewhat of a kludge.
I'm not sure whether it is a good idea.

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

* Re: error "Cannot switch buffers in (minibuffer | a dedicated) window"
  2007-12-17 22:27 error "Cannot switch buffers in (minibuffer | a dedicated) window" Drew Adams
  2007-12-18 15:56 ` Richard Stallman
@ 2007-12-21  0:43 ` Stefan Monnier
  2007-12-21  5:29   ` error "Cannot switch buffers in (minibuffer | a dedicated)window" Drew Adams
  2008-02-13  7:18   ` pop-tag-mark - shouldn't it use pop-to-buffer instead of switch-to-buffer? Drew Adams
  1 sibling, 2 replies; 7+ messages in thread
From: Stefan Monnier @ 2007-12-21  0:43 UTC (permalink / raw)
  To: Drew Adams; +Cc: Emacs-Devel

> Am I missing something, or is this a gratuitous error that just gets
> in the way?

It's just a way to say "please get all authors to stop using
switch-to-buffer from their elisp package and replace them with calls to
pop-to-buffer".


        Stefan

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

* RE: error "Cannot switch buffers in (minibuffer | a dedicated)window"
  2007-12-21  0:43 ` Stefan Monnier
@ 2007-12-21  5:29   ` Drew Adams
  2008-02-13  7:18   ` pop-tag-mark - shouldn't it use pop-to-buffer instead of switch-to-buffer? Drew Adams
  1 sibling, 0 replies; 7+ messages in thread
From: Drew Adams @ 2007-12-21  5:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs-Devel

> > Am I missing something, or is this a gratuitous error that just gets
> > in the way?
> 
> It's just a way to say "please get all authors to stop using
> switch-to-buffer from their elisp package and replace them
> with calls to pop-to-buffer".

;-)

Good luck!  Starting with Emacs itself.

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

* pop-tag-mark - shouldn't it use pop-to-buffer instead of switch-to-buffer?
  2007-12-21  0:43 ` Stefan Monnier
  2007-12-21  5:29   ` error "Cannot switch buffers in (minibuffer | a dedicated)window" Drew Adams
@ 2008-02-13  7:18   ` Drew Adams
  1 sibling, 0 replies; 7+ messages in thread
From: Drew Adams @ 2008-02-13  7:18 UTC (permalink / raw)
  To: 'Emacs-Devel'; +Cc: 'Stefan Monnier'

From another thread:

> From: Stefan Monnier Sent: Thursday, December 20, 2007 4:43 PM
> Subject: Re: error "Cannot switch buffers in (minibuffer | a 
> dedicated) window"
> 
> > Am I missing something, or is this a gratuitous error that just gets
> > in the way?
> 
> It's just a way to say "please get all authors to stop using
> switch-to-buffer from their elisp package and replace them 
> with calls to pop-to-buffer".

A propos, shouldn't `pop-tag-mark' use `pop-to-buffer' here, instead of
`switch-to-buffer'? Otherwise, if you already have a window/frame open to
the marker's buffer, it doesn't reuse it.

(defun pop-tag-mark ()
  "Pop back to where \\[find-tag] was last invoked.

This is distinct from invoking \\[find-tag] with a negative argument
since that pops a stack of markers at which tags were found, not from
where they were found."
  (interactive)
  (if (ring-empty-p find-tag-marker-ring)
      (error "No previous locations for find-tag invocation"))
  (let ((marker (ring-remove find-tag-marker-ring 0)))
    (switch-to-buffer (or (marker-buffer marker)
                          (error "The marked buffer has been deleted")))
    (goto-char (marker-position marker))
    (set-marker marker nil nil)))





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

end of thread, other threads:[~2008-02-13  7:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-17 22:27 error "Cannot switch buffers in (minibuffer | a dedicated) window" Drew Adams
2007-12-18 15:56 ` Richard Stallman
2007-12-18 16:29   ` Drew Adams
2007-12-19 10:12     ` Richard Stallman
2007-12-21  0:43 ` Stefan Monnier
2007-12-21  5:29   ` error "Cannot switch buffers in (minibuffer | a dedicated)window" Drew Adams
2008-02-13  7:18   ` pop-tag-mark - shouldn't it use pop-to-buffer instead of switch-to-buffer? Drew Adams

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