all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* best way to display alternate view of file
@ 2017-04-19 13:45 Aurélien Aptel
  2017-04-19 13:49 ` Kaushal Modi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Aurélien Aptel @ 2017-04-19 13:45 UTC (permalink / raw)
  To: Emacs development discussions

Hi,

I'm working on a mode to view network traces. So far I have a function
that takes a trace file name and displays the result of the trace
analysis (throught wireshark cli tool).

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?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: best way to display alternate view of file
  2017-04-19 13:45 best way to display alternate view of file Aurélien Aptel
@ 2017-04-19 13:49 ` Kaushal Modi
  2017-04-19 14:49 ` Eli Zaretskii
  2017-04-19 15:01 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Kaushal Modi @ 2017-04-19 13:49 UTC (permalink / raw)
  To: Aurélien Aptel, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 671 bytes --]

On Wed, Apr 19, 2017, 9:45 AM Aurélien Aptel <aurelien.aptel+emacs@gmail.com>
wrote:

> Hi,
>
> I'm working on a mode to view network traces. So far I have a function
> that takes a trace file name and displays the result of the trace
> analysis (throught wireshark cli tool).
>
> 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?
>

Something like this? https://emacs.stackexchange.com/a/17009/115

> --

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1251 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: best way to display alternate view of file
  2017-04-19 13:45 best way to display alternate view of file Aurélien Aptel
  2017-04-19 13:49 ` Kaushal Modi
@ 2017-04-19 14:49 ` Eli Zaretskii
  2017-04-19 15:01 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2017-04-19 14:49 UTC (permalink / raw)
  To: Aurélien Aptel; +Cc: emacs-devel

> From: Aurélien Aptel <aurelien.aptel+emacs@gmail.com>
> 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.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: best way to display alternate view of file
  2017-04-19 13:45 best way to display alternate view of file Aurélien Aptel
  2017-04-19 13:49 ` Kaushal Modi
  2017-04-19 14:49 ` Eli Zaretskii
@ 2017-04-19 15:01 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2017-04-19 15:01 UTC (permalink / raw)
  To: emacs-devel

> What's the idiomatic way to do a mode like this in Elisp?

I don't think there's one idiomatic way to do this.
- For HTML and Info we have commands that create (and display) a separate
  buffer containing the rendering.
- For doc-view-mode and hexl-mode we have commands we swap between the
  two views within the same buffer (usually using C-c C-c to go back to
  the "source", but it could probably be used more generally as "swap").
- In nhexl-mode, the user-view is similar to hexl-mode, but the buffer
  is not modified (the rendering is done via overlays and `display`
  text properties).
The first option is usually easier.


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-19 15:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-19 13:45 best way to display alternate view of file Aurélien Aptel
2017-04-19 13:49 ` Kaushal Modi
2017-04-19 14:49 ` Eli Zaretskii
2017-04-19 15:01 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.