From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Return values of (find-file-noselect), etc. Date: Tue, 08 Jan 2019 13:07:07 -0500 Message-ID: References: <71340fe0-7373-f407-3bc7-7a2dcaf6b3b3@gmail.com> <375db42e-f62d-c3c7-518a-627190b30617@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1546970764 1420 195.159.176.226 (8 Jan 2019 18:06:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 8 Jan 2019 18:06:04 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 08 19:06:00 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggvlH-0000F6-LH for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Jan 2019 19:05:59 +0100 Original-Received: from localhost ([127.0.0.1]:37458 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggvnN-00068N-NP for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Jan 2019 13:08:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggvmf-00064k-2d for help-gnu-emacs@gnu.org; Tue, 08 Jan 2019 13:07:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ggvmd-000426-5X for help-gnu-emacs@gnu.org; Tue, 08 Jan 2019 13:07:24 -0500 Original-Received: from [195.159.176.226] (port=36084 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ggvmb-0003h5-8A for help-gnu-emacs@gnu.org; Tue, 08 Jan 2019 13:07:22 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1ggvkM-0007Ur-1b for help-gnu-emacs@gnu.org; Tue, 08 Jan 2019 19:05:02 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 15 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:u5vLdu/zcQjB3iH25wXnVcMAYVs= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:119090 Archived-At: >>> Either way, that's not what I'm seeing. Should this be recorded as a bug? >> I think it's a bug for a major mode function to change the current >> buffer, so what you're seeing is likely the result of find-file-noselect >> not protecting itself against such misbehaving major modes ;-) > Hmmm. I suppose I could make (cpio-mode) a function instead of a mode, I think using buffer-swap-text, you should be able to fairly easily make it so that cpio-mode is a proper major mode (e.g. doesn't change current-buffer) and yet moves the current buffer's contents to some auxiliary buffer and puts the dired-style interface in the current buffer. (and setup a change-major-mode-hook to reverse this if the user decides to change the major mode to something else like fundamental-mode). Stefan