all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Steve Hafner <steve.b.hafner@gmail.com>
Cc: 12208@debbugs.gnu.org
Subject: bug#12208: yes-or-no-p escapes with-current-buffer
Date: Sat, 18 Aug 2012 15:15:30 +0200	[thread overview]
Message-ID: <502F9572.3040009@gmx.at> (raw)
In-Reply-To: <CAOy7MZLtLoe_qBVo=5373WoeO18SH4nT=ArDu4=7y3VPb+8OeQ@mail.gmail.com>

 > 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	other threads:[~2012-08-18 13:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-16  4:37 bug#12208: yes-or-no-p escapes with-current-buffer Steve Hafner
2012-08-16  9:38 ` martin rudalics
2012-08-16 20:36   ` Steve Hafner
2012-08-17 12:09     ` martin rudalics
2012-08-17 15:18       ` martin rudalics
2012-08-17 20:24         ` Steve Hafner
2012-08-18  2:55           ` Steve Hafner
2012-08-18 13:15             ` martin rudalics [this message]
2012-08-18 16:39               ` Steve Hafner
2012-08-18 17:38                 ` martin rudalics
2012-08-27  9:15               ` martin rudalics

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=502F9572.3040009@gmx.at \
    --to=rudalics@gmx.at \
    --cc=12208@debbugs.gnu.org \
    --cc=steve.b.hafner@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.