From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#65308: (find-file) botches buffer-file-name in -batch mode Date: Tue, 15 Aug 2023 15:26:37 +0300 Message-ID: <83jztwa3uq.fsf@gnu.org> References: <5a188f33a3580e9046a28ba6bd527ff20d54366d.camel@yandex.ru> <83leeca4xo.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26833"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65308-done@debbugs.gnu.org To: Konstantin Kharlamov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 15 14:27:29 2023 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 1qVt8z-0006ip-BW for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Aug 2023 14:27:29 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVt8f-00065j-DZ; Tue, 15 Aug 2023 08:27:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qVt8Z-00065J-Jp for bug-gnu-emacs@gnu.org; Tue, 15 Aug 2023 08:27:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qVt8Y-0000aZ-LT for bug-gnu-emacs@gnu.org; Tue, 15 Aug 2023 08:27:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qVt8Y-000415-GK for bug-gnu-emacs@gnu.org; Tue, 15 Aug 2023 08:27:02 -0400 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Aug 2023 12:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 65308 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Mail-Followup-To: 65308@debbugs.gnu.org, eliz@gnu.org, Hi-Angel@yandex.ru Original-Received: via spool by 65308-done@debbugs.gnu.org id=D65308.169210240215410 (code D ref 65308); Tue, 15 Aug 2023 12:27:02 +0000 Original-Received: (at 65308-done) by debbugs.gnu.org; 15 Aug 2023 12:26:42 +0000 Original-Received: from localhost ([127.0.0.1]:35153 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVt8E-00040T-BS for submit@debbugs.gnu.org; Tue, 15 Aug 2023 08:26:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56002) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVt8C-00040D-A6 for 65308-done@debbugs.gnu.org; Tue, 15 Aug 2023 08:26:41 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qVt87-0000XJ-1F; Tue, 15 Aug 2023 08:26:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=9xy3KIgiiVzwa3ewz7dQ/BYkh/MiL6AYmXHLQY3lRbE=; b=OLBn6P3MlRdvWMD1Uwl3 x+Yx8t8gGvfuXwMXADwV1E6LakpQHRPFpmLtxHZ/RG0RKyokUZzllfzdgc0GUj31zIi+u3CmTPTBL vptEZtOBzAPpCWKQze8AOBca4iWmn68w8Pmd1aj8Ijv2G4E9WfuAJPJXSTBDcdh9jMEJfyEdDZ5BS NxZfovfNYQD3+o4cHApw7EqrMjkPLItAIaGrqi2SaGvCqxp/Nr52WeTroxO7v0EFpezgTR/wZbQfN u2f+RI8v2DOUOaeEWwmFmS0jhA/gwHJiZ2zO/KG18bvuT7AyQ+OfPkgThYw1ZWpcFM3kZ8r1Laeu0 OxWlDhkiV5h7vw==; In-Reply-To: (message from Konstantin Kharlamov on Tue, 15 Aug 2023 15:17:00 +0300) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:267483 Archived-At: > From: Konstantin Kharlamov > Cc: 65308@debbugs.gnu.org > Date: Tue, 15 Aug 2023 15:17:00 +0300 > > On Tue, 2023-08-15 at 15:03 +0300, Eli Zaretskii wrote: > > There's no bug here.  To get what you want, run the command-line > > arguments through expand-file-name _before_ calling find-file. > > Oh, okay, thank you, I see. I settled with calling a `(kill-buffer)` > after `(save-buffer)`, which I guess works because each time the buffer > is killed we get back to the *scratch* buffer that has the original > "current directory". Yes, that will work, as will using save-current-buffer etc. But please note that relying on the default-directory of some random buffer when using relative file names is always fraught with surprises in Emacs, which is why I suggested to use expand-file-name instead. Closing.