From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: best way to display alternate view of file Date: Wed, 19 Apr 2017 17:49:09 +0300 Message-ID: <838tmwcv16.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1492613376 10004 195.159.176.226 (19 Apr 2017 14:49:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 19 Apr 2017 14:49:36 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?utf-8?Q?Aur=C3=A9lien?= Aptel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 19 16:49:31 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d0qvC-0002R8-5v for ged-emacs-devel@m.gmane.org; Wed, 19 Apr 2017 16:49:30 +0200 Original-Received: from localhost ([::1]:48573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0qvH-00010g-RZ for ged-emacs-devel@m.gmane.org; Wed, 19 Apr 2017 10:49:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0quG-0000zM-KJ for emacs-devel@gnu.org; Wed, 19 Apr 2017 10:48:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d0quF-0003tO-Tm for emacs-devel@gnu.org; Wed, 19 Apr 2017 10:48:32 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0quF-0003tK-QY; Wed, 19 Apr 2017 10:48:31 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1110 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d0quF-00027M-5U; Wed, 19 Apr 2017 10:48:31 -0400 In-reply-to: (message from =?utf-8?Q?Aur=C3=A9lien?= Aptel on Wed, 19 Apr 2017 15:45:08 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:214121 Archived-At: > From: Aurélien Aptel > Date: Wed, 19 Apr 2017 15:45:08 +0200 > > I would like to use the regular mechanism (add a cons to the auto-load > list for .pcap files) but I don't actually want to display the raw > file, I want to use my function to show an "alternate" view of the > file. > > What's the idiomatic way to do a mode like this in Elisp? I don't understand the nature of your difficulty. The mode function can do anything with the buffer; Emacs won't display the buffer until the mode function does its thing and exits. So if your mode function produces an alternate view of the file, the raw view will never be seen. If the problem is that you want to produce the alternate view in another buffer, you could use buffer-swap-text, like Rmail and Tar mode do.