bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12208: yes-or-no-p escapes with-current-buffer


From: martin rudalics
Subject: bug#12208: yes-or-no-p escapes with-current-buffer
Date: Sat, 18 Aug 2012 15:15:30 +0200

> Actually, I'm coming up with a few problems. I applied your patch to
> Git sources, and evaluating from buffer1 leaves the point at position
> 2.  Things seem to work correctly in buffer2, though.
>
> And trying yes-or-no-p again, the behavior is the same as in my original post:
>
>
> (let ((form
>        "(with-current-buffer \"*buffer1*\"
>   (goto-char (point-min))
>   (yes-or-no-p \"\")
>   (setq x (1+ x))
>   (insert (format \"%s\" x)))"))
>   (setq x 0)
>   (switch-to-buffer (get-buffer-create "*buffer1*"))
>   (insert form)
>   (split-window)
>   (other-window 1)
>   (switch-to-buffer (get-buffer-create "*buffer2*"))
>   (insert form)
>   (other-window 1))

Sorry, the patch worked only when the selected window did not change.
Please try the one below.

Thanks, martin


=== modified file 'src/window.c'
--- src/window.c        2012-08-18 06:06:39 +0000
+++ src/window.c        2012-08-18 13:09:15 +0000
@@ -5889,7 +5889,13 @@
     }

   if (!NILP (new_current_buffer))
-    Fset_buffer (new_current_buffer);
+    {
+      Fset_buffer (new_current_buffer);
+      /* If the new current buffer doesn't appear in the selected
+        window, go to its old point.  */
+      if (!EQ (XWINDOW (data->current_window)->buffer, new_current_buffer))
+       Fgoto_char (make_number (old_point));
+    }

   Vminibuf_scroll_window = data->minibuf_scroll_window;
   minibuf_selected_window = data->minibuf_selected_window;







reply via email to

[Prev in Thread] Current Thread [Next in Thread]