* CVS Emacs switch-to-buffer issue.
@ 2004-11-08 3:12 Rob Kramer
2004-11-08 4:08 ` Rob Kramer
0 siblings, 1 reply; 2+ messages in thread
From: Rob Kramer @ 2004-11-08 3:12 UTC (permalink / raw)
Hi,
This weekend I've been trying to figure out what's wrong with my much
beloved cycle-buffer.el on Emacs CVS. Not a trivial task for a elisp
newbie! See my original mail on the issue below.
The problem seems to boil down to a change in the switch-to-buffer
implementation somewhere along the line:
DEFUN ("switch-to-buffer", Fswitch_to_buffer, Sswitch_to_buffer, 1, 2,
<snip>
{
char *err;
+ if (EQ (buffer, Fwindow_buffer (selected_window)))
+ /* Basically a NOP. Avoid signalling an error if the selected window
+ is dedicated, or a minibuffer, ... */
+ return Fset_buffer (buffer);
err = no_switch_window (selected_window);
if (err) error (err);
return switch_to_buffer_1 (buffer, norecord);
}
The buffer check is new here, and causes cycle-buffer to fail because it
depends on (switch-to-buffer (current-buffer)) to result in a
record_buffer().
revision 1.434
date: 2003/07/15 19:32:05; author: monnier; state: Exp; lines: +14 -1
(copy_overlays): Use EMACS_INT for positions.
(Fswitch_to_buffer): Don't signal an error when switching to the same
buffer in a dedicated window.
If I remove this statement, or change (switch-to-buffer (current-buffer)) in
cycle-buffer to:
;; force record_buffer (current-buffer)
(setq tmpbuf (current-buffer))
(switch-to-buffer (other-buffer) t)
(switch-to-buffer tmpbuf)
then it works.
The elisp solution is a hack. Is there an official way to do this? Should
the test in buffer.c above do a buffer_record() before returning?
Next, to figure out why desktop.el doesn't auto-save my desktop anymore..
Cheers,
Rob
Subject: cycle-buffer with emacs HEAD
From: Rob Kramer <robk@starhub.net.sg>
Date: Friday 29 October 2004 13:02:43
Groups:gnu.emacs.help
Hia,
I've been using cycle-buffer.el for ages as my buffer switching mechanism,
but it doesn't work quite right on CVS emacs. This is not recent, it's
never worked with post-21.3 CVS versions. It's very difficult to describe
the problem, but it comes down to cycle-buffer switching to the wrong
buffer sometimes.
An indication of the problem is in the switcher status bar, which normally
looks something like:
device.h devicestore.cc [Makefile] foo.cc device.cc
Where the bracketed buffer is currently selected. On CVS emacs, it looks
like:
device.h devicestore.cc [Makefile] [] foo.cc device.cc
..and will often pick the wrong buffer, which is very annoying.
Does anyone else use cycle-buffer? The (most recent I can find) version I'm
using is at http://www.bookshelf.jp/elc/cycle-buffer.el, which is pretty
old already.
I know almost nothing of emacs-lisp, but could pick it up if someone can
tell me where to start looking for this problem..
I'm surprised cycle-buffer seems unmaintained. Are there better ones out
there?
Cheers,
Rob
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: CVS Emacs switch-to-buffer issue.
2004-11-08 3:12 CVS Emacs switch-to-buffer issue Rob Kramer
@ 2004-11-08 4:08 ` Rob Kramer
0 siblings, 0 replies; 2+ messages in thread
From: Rob Kramer @ 2004-11-08 4:08 UTC (permalink / raw)
Reply to self..
> The elisp solution is a hack. Is there an official way to do this? Should
> the test in buffer.c above do a buffer_record() before returning?
The patch below makes switch-to-buffer record_buffer again if switching to
current-buffer. Don't know if it makes any sense to do things this way, but
it solves my problem...
Cheers,
Rob
RCS file: /cvsroot/emacs/emacs/src/buffer.c,v
retrieving revision 1.465
diff -u -3 -p -r1.465 buffer.c
--- src/buffer.c 26 Oct 2004 09:45:16 -0000 1.465
+++ src/buffer.c 8 Nov 2004 03:56:49 -0000
@@ -1684,9 +1684,16 @@ the window-buffer correspondences. */)
char *err;
if (EQ (buffer, Fwindow_buffer (selected_window)))
- /* Basically a NOP. Avoid signalling an error if the selected window
- is dedicated, or a minibuffer, ... */
- return Fset_buffer (buffer);
+ {
+ /* Basically a NOP. Avoid signalling an error if the selected window
+ is dedicated, or a minibuffer, ... */
+ register Lisp_Object buf = Fset_buffer (buffer);
+
+ if (!NILP (buf) && NILP (norecord))
+ record_buffer (buf);
+
+ return buf;
+ }
err = no_switch_window (selected_window);
if (err) error (err);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-11-08 4:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-08 3:12 CVS Emacs switch-to-buffer issue Rob Kramer
2004-11-08 4:08 ` Rob Kramer
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).