From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.bugs Subject: bug#48535: 28.0.50; ff-find-other-file no longer sets current-buffer? Date: Sun, 23 May 2021 14:56:57 -0700 Message-ID: <86lf85jeqe.fsf@stephe-leake.org> References: <86fsyhzh6a.fsf@stephe-leake.org> <86v97byesn.fsf_-_@stephe-leake.org> <86r1hzydyd.fsf@stephe-leake.org> <86tumtjvcv.fsf@stephe-leake.org> <86pmxhjgj8.fsf@stephe-leake.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29418"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt) To: 48535@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 23 23:58:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lkw6s-0007O3-Po for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 May 2021 23:58:11 +0200 Original-Received: from localhost ([::1]:60596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkw6r-00053Z-Sj for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 May 2021 17:58:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkw6k-00052e-Hk for bug-gnu-emacs@gnu.org; Sun, 23 May 2021 17:58:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lkw6k-0003g6-AO for bug-gnu-emacs@gnu.org; Sun, 23 May 2021 17:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lkw6k-0000UN-9N for bug-gnu-emacs@gnu.org; Sun, 23 May 2021 17:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Leake Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 May 2021 21:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48535 X-GNU-PR-Package: emacs Original-Received: via spool by 48535-submit@debbugs.gnu.org id=B48535.16218070241812 (code B ref 48535); Sun, 23 May 2021 21:58:02 +0000 Original-Received: (at 48535) by debbugs.gnu.org; 23 May 2021 21:57:04 +0000 Original-Received: from localhost ([127.0.0.1]:41905 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkw5n-0000TA-O2 for submit@debbugs.gnu.org; Sun, 23 May 2021 17:57:03 -0400 Original-Received: from gateway23.websitewelcome.com ([192.185.48.251]:49996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkw5k-0000Si-WE for 48535@debbugs.gnu.org; Sun, 23 May 2021 17:57:02 -0400 Original-Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway23.websitewelcome.com (Postfix) with ESMTP id F1F3241E2 for <48535@debbugs.gnu.org>; Sun, 23 May 2021 16:56:58 -0500 (CDT) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with SMTP id kw5ilChVUMGeEkw5ilBoL3; Sun, 23 May 2021 16:56:58 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stephe-leake.org; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:To:From:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8e8BfSptkMiXPIo9tin26NeHOaeDUuotewz9niyw8WM=; b=aSBBgKgODNiuyTZlNy0nK1djPN Z3YcoGo8EWfyb9IV0VM+ZAKBCkWjlieYFtYd6Y3A1SuQVnnAm2PD51qfXqNkD8WCNUbruEQqd2lbo jxfeo74QxkyxVWkZlh7wcvdx31xn0X/6GmIZ3ZDWMfD1gzpfXoEoC4fmigLmFnqRloX0iOY/edm/N YBFMt/5mi8yYa7cxX4TdVQtLk5snnPHxpaCNMq9als/MEekzLcZoG2LqI5o5pRWBm9Cy1AvyLOSW7 7d2RT4Z/fUcIyMWeVypWi6KOPv1+LbWj67L1tL5l7CkbtslsDoAWuKRwDZMSCmqCxAN6nue9WsoYr JsEytf0w==; Original-Received: from [76.77.182.20] (port=61840 helo=Takver4) by host2007.hostmonster.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lkw5i-001Pqp-BA for 48535@debbugs.gnu.org; Sun, 23 May 2021 15:56:58 -0600 In-Reply-To: <86pmxhjgj8.fsf@stephe-leake.org> (Stephen Leake's message of "Sun, 23 May 2021 14:18:03 -0700") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2007.hostmonster.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stephe-leake.org X-BWhitelist: no X-Source-IP: 76.77.182.20 X-Source-L: No X-Exim-ID: 1lkw5i-001Pqp-BA X-Source-Sender: (Takver4) [76.77.182.20]:61840 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 2 X-Source-Cap: c3RlcGhlbGU7c3RlcGhlbGU7aG9zdDIwMDcuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:207107 Archived-At: --=-=-= Content-Type: text/plain Stephen Leake writes: > Stephen Leake writes: > >> Stephen Leake writes: >> >>>> I've confirmed that disabling lexical-binding fixes the problem. >>> >>> On the other hand, re-enabling lexical-binding, and byte-compiling just >>> that file (which 'make' does), the problem does not come back. Sigh. >> >> I was confused; I was working in a 'good' commit, not the first 'bad' >> commit. >> >> Disabling lexical-binding in find-file.el does not fix the problem in >> the 'bad' commit. > > The attached patch fixes the problem, in master HEAD (c9655fcb47). actually attach the patch -- -- Stephe --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=find-file.diff diff --git a/lisp/find-file.el b/lisp/find-file.el index 6c3c0f123b..4fd4f4e06b 100644 --- a/lisp/find-file.el +++ b/lisp/find-file.el @@ -305,6 +305,10 @@ ff-find-other-file If optional IN-OTHER-WINDOW is non-nil, find the file in the other window. If optional IGNORE-INCLUDE is non-nil, ignore being on `#include' lines. +If optional EVENT is non-nil (default `last-nonmenu-event', move +point to the end position of that event before calling the +various ff-* hooks. + Variables of interest include: - `ff-case-fold-search' @@ -351,10 +355,16 @@ ff-find-other-file - `ff-file-created-hook' List of functions to be called if the other file has been created." (interactive (list current-prefix-arg nil last-nonmenu-event)) - (save-excursion + ;; We want to preserve point in the current buffer. But the point of + ;; ff-find-the-other-file is to make the the other file buffer + ;; current, so we can't use save-excursion here (see bug 48535). + (let ((start-buffer (current-buffer)) + (start-point (point))) (posn-set-point (event-end event)) (let ((ff-ignore-include ignore-include)) - (ff-find-the-other-file in-other-window)))) + (ff-find-the-other-file in-other-window)) + (with-current-buffer start-buffer + (goto-char start-point)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Support functions --=-=-=--