unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Federico Tedin <federicotedin@gmail.com>
To: juri@linkov.net
Cc: 32777@debbugs.gnu.org
Subject: bug#32777: 27.0.50; window-buffer gets wrong point
Date: Mon, 1 Oct 2018 23:07:41 -0300	[thread overview]
Message-ID: <CAA8GjPkfiaq4LCF8ZzWy7q9upECXVF2OQijT8=BnJQeema30PQ@mail.gmail.com> (raw)
In-Reply-To: <CAA8GjPnmVovapJ5TK=NKG2sN8h3ykEOfiHaMiaPA_b3cYMaO+w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

> It seems like the problem could be solved by modifying the code on
> simple.el, line 1713 onward. I'll check and see if I can fix it.

I've managed to fix the problem, I'm attaching a patch with my proposed changes.

[-- Attachment #2: minibuf.patch --]
[-- Type: text/x-patch, Size: 1409 bytes --]

From 6cb506a1f021888b5faf78090a4ab524fd8bb526 Mon Sep 17 00:00:00 2001
From: Federico Tedin <federicotedin@gmail.com>
Date: Mon, 1 Oct 2018 23:03:36 -0300
Subject: [PATCH] Fix M-n command completion for read-extended-command

* lisp/simple.el (read-extended-command): Ensure the function uses the
  apropiate window when looking for a command to suggest when user
  enters M-n after initial prompt. (Bug#32777)
---
 lisp/simple.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index e41630d4ed..1d129c3c99 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1710,9 +1710,10 @@ read-extended-command
 	     (lambda ()
 	       ;; Get a command name at point in the original buffer
 	       ;; to propose it after M-n.
-	       (with-current-buffer (window-buffer (minibuffer-selected-window))
-		 (and (commandp (function-called-at-point))
-		      (format "%S" (function-called-at-point)))))))
+	       (with-selected-window (minibuffer-selected-window)
+                 (with-current-buffer (window-buffer (selected-window))
+		   (and (commandp (function-called-at-point))
+		        (format "%S" (function-called-at-point))))))))
     ;; Read a string, completing from and restricting to the set of
     ;; all defined commands.  Don't provide any initial input.
     ;; Save the command read on the extended-command history list.
-- 
2.17.1


  reply	other threads:[~2018-10-02  2:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-19 22:55 bug#32777: 27.0.50; window-buffer gets wrong point Juri Linkov
2018-09-30  4:03 ` Federico Tedin
2018-10-02  2:07   ` Federico Tedin [this message]
2018-10-02  3:21     ` Eli Zaretskii
2018-10-02 12:31       ` Federico Tedin
2018-10-13  9:19         ` Eli Zaretskii
2018-10-13 13:08           ` martin rudalics
2018-10-15  7:56             ` martin rudalics
2018-12-21  0:18               ` Juri Linkov
2018-12-21  9:15                 ` martin rudalics
2018-12-21 16:02                   ` Eli Zaretskii
2018-12-23  9:40                     ` martin rudalics
2018-12-29  9:59                       ` martin rudalics
2018-12-29 23:10                         ` Juri Linkov
2018-12-30  9:49                           ` 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

  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='CAA8GjPkfiaq4LCF8ZzWy7q9upECXVF2OQijT8=BnJQeema30PQ@mail.gmail.com' \
    --to=federicotedin@gmail.com \
    --cc=32777@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /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).