From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: How does Emacs find the buffer for a file? Date: Sun, 16 Jun 2002 17:28:02 -0600 (MDT) Sender: emacs-devel-admin@gnu.org Message-ID: <200206162328.g5GNS2Z12590@aztec.santafe.edu> References: Reply-To: rms@gnu.org NNTP-Posting-Host: localhost.gmane.org X-Trace: main.gmane.org 1024270246 22974 127.0.0.1 (16 Jun 2002 23:30:46 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 16 Jun 2002 23:30:46 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17JjTq-0005yR-00 for ; Mon, 17 Jun 2002 01:30:46 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17Jjtn-0007s6-00 for ; Mon, 17 Jun 2002 01:57:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17JjTd-0002uF-00; Sun, 16 Jun 2002 19:30:33 -0400 Original-Received: from pele.santafe.edu ([192.12.12.119]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17JjRD-0002UW-00; Sun, 16 Jun 2002 19:28:04 -0400 Original-Received: from aztec.santafe.edu (aztec [192.12.12.49]) by pele.santafe.edu (8.11.6+Sun/8.11.6) with ESMTP id g5GNS3Q27611; Sun, 16 Jun 2002 17:28:03 -0600 (MDT) Original-Received: (from rms@localhost) by aztec.santafe.edu (8.10.2+Sun/8.9.3) id g5GNS2Z12590; Sun, 16 Jun 2002 17:28:02 -0600 (MDT) X-Authentication-Warning: aztec.santafe.edu: rms set sender to rms@aztec using -f Original-To: Kai.Grossjohann@CS.Uni-Dortmund.DE Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:4915 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:4915 When you do C-x C-f /some/file RET, then Emacs runs insert-file-contents and puts the output in some buffer. How does Emacs determine the buffer from the filename? Actually it creates a buffer and then runs insert-file-contents. So this question does not really make sense. Emacs does not determine a buffer, it uses the buffer it just created. The code is in find-file-noselect and find-file-noselect-1. There is a bug in Tramp, and I don't know how to start tracking it down. Tramp allows you to edit remote files. If you say C-x C-f /foo RET (editing the local file /foo), and then say C-x C-f /[user@host]/foo RET (editing a remote file, also named /foo, via Tramp), then the remote file contents are inserted into the buffer containing the local file /foo. Assuming Tramp uses the file-name-handler-alist mechanism, the only operation that it will handle is insert-file-contents. That handler should insert into the current buffer. It should never try to find the buffer to use. Basically, you need to make sure things are working with Tramp more or less the same way they are working for local files, aside from fetching the data of course. A problem like this would tend to come from a difference where the two paths ought to work the same way.