From: "Drew Adams" <drew.adams@oracle.com>
Cc: emacs-devel@gnu.org
Subject: switch-buffer to use other window if dedicated window (was: Jumping to C source from *Help*)
Date: Thu, 8 Apr 2004 10:27:13 -0700 [thread overview]
Message-ID: <FDELKNEBLPKKDCEBEJCBEEFJCDAA.drew.adams@oracle.com> (raw)
In-Reply-To: <877jwqfmjb.fsf-monnier+emacs@alfajor.local>
Forgive me if this is not too germane or up-to-date.
To me, it makes sense for `switch-to-buffer' to use another window if the
selected window is dedicated.
FWIW, here's the redefinition of `switch-to-buffer' that I use (Emacs 20 -
sorry):
;; 1) Uses `read-buffer' in interactive spec.
;; 2) If current window is dedicated, then use another window.
;; NOTE: Emacs versions >= 19.34 signal an error if dedicated window,
;; instead of using another one. Don't know what the 19.28 version
did.
;; 3) `fit-frame-if-one-window' if `fit-frame-when-switch-to-p'.
(defun switch-to-buffer (buffer &optional norecord)
"Select buffer BUFFER in current window, unless the window is dedicated.
If current window is dedicated (`window-dedicated-p'), then another window
is used. BUFFER may be a buffer or its name.
Optional second arg NORECORD non-nil =>
Do not put BUFFER at front of list of recently selected buffers.
*WARNING*: This is NOT the way to work on another buffer temporarily
within a Lisp program! Use `set-buffer' instead, to avoid messing
with window-buffer correspondences.
`fit-frame-if-one-window' if `fit-frame-when-switch-to-p'."
(interactive
(list (read-buffer "Switch to buffer: " nil 'existing)))
(if (window-dedicated-p (selected-window))
(switch-to-buffer-other-window buffer)
(old-switch-to-buffer buffer norecord))
(fit-frame-if-one-window-and-cond fit-frame-when-switch-to-p))
[FYI -
Function `fit-frame-if-one-window-and-cond' shrink-wraps the frame of the
selected window if variable (user option) `fit-frame-when-switch-to-p' is
non-nil.
Function `read-buffer' reads the name of a buffer and returns it as a
string.
Prompts with first arg, PROMPT (a string).
The default buffer is named by the optional 2nd arg, DEFAULT, if a
string or buffer, or by `another-buffer' if nil.
Non-nil optional 3rd arg, EXISTING, means to allow only names of
existing buffers.]
- Drew
-----Original Message-----
From: emacs-devel-bounces+drew.adams=oracle.com@gnu.org
[mailto:emacs-devel-bounces+drew.adams=oracle.com@gnu.org]On Behalf Of
Stefan Monnier
Sent: Thursday, April 08, 2004 9:47 AM
To: Juri Linkov
Cc: emacs-devel@gnu.org
Subject: Re: Jumping to C source from *Help*
> - (pop-to-buffer (car location))
> + (switch-to-buffer (car location))
That signals an error when the *Help* buffer is on a dedicated window (as
is the case for me). I spend a lot of time getting rid of such misuses of
switch-to-buffer, so I strongly oppose this patch.
Of course, the right way to fix it might be to make switch-to-buffer
delegate to pop-to-buffer rather than signal an error. But last time
I suggested it, Richard did not like it.
Stefan
next prev parent reply other threads:[~2004-04-08 17:27 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-06 22:35 Jumping to C source from *Help* Stefan Monnier
2004-04-07 1:01 ` Juanma Barranquero
2004-04-07 19:44 ` Stefan Monnier
2004-04-08 0:35 ` Kim F. Storm
2004-04-08 6:12 ` Juri Linkov
2004-04-08 16:10 ` Kim F. Storm
2004-04-09 22:44 ` Richard Stallman
2004-04-08 16:46 ` Stefan Monnier
2004-04-08 17:27 ` Drew Adams [this message]
2004-04-09 22:44 ` Richard Stallman
2004-04-10 18:51 ` Kim F. Storm
2004-04-11 23:17 ` Stefan Monnier
2004-04-12 17:34 ` Glenn Morris
2004-04-14 18:01 ` Richard Stallman
2004-04-15 17:36 ` Glenn Morris
2004-04-19 18:20 ` Richard Stallman
2004-04-19 23:59 ` Kim F. Storm
2004-04-20 0:41 ` Glenn Morris
2004-04-20 16:05 ` Drew Adams
2004-04-20 20:47 ` Richard Stallman
2004-04-20 23:33 ` Glenn Morris
2004-04-20 23:48 ` Miles Bader
2004-04-20 22:04 ` Nick Roberts
2004-04-20 23:40 ` Glenn Morris
2004-04-21 10:21 ` Kim F. Storm
2004-04-21 15:38 ` Stefan Monnier
2004-04-13 17:44 ` Richard Stallman
2004-04-13 18:12 ` Stefan Monnier
2004-04-14 22:53 ` Richard Stallman
2004-04-15 13:58 ` Stefan Monnier
2004-04-15 16:27 ` Kim F. Storm
2004-04-15 16:08 ` Drew Adams
2004-04-16 18:08 ` Richard Stallman
2004-04-16 18:37 ` David Kastrup
2004-04-16 18:08 ` Richard Stallman
2004-04-16 18:39 ` Stefan Monnier
2004-04-17 19:46 ` Richard Stallman
2004-04-19 14:09 ` Stefan Monnier
2004-04-18 21:47 ` Richard Stallman
2004-04-19 14:12 ` Stefan Monnier
2004-04-08 6:19 ` Juri Linkov
2004-04-08 16:07 ` Kim F. Storm
2004-04-09 22:43 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=FDELKNEBLPKKDCEBEJCBEEFJCDAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).