help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs bindings in other programs


From: Tim X
Subject: Re: Emacs bindings in other programs
Date: Fri, 23 Nov 2007 16:05:47 +1100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

dkcombs@panix.com (David Combs) writes:

> In article <87d4usupsu.fsf@lion.rapttech.com.au>,
> Tim X  <timx@nospam.dev.null> wrote:
>>
>>Note that you can call other X apps from within emacs as a sub-process, you
>>just can't run them 'within' emacs itself. The downside is that you don't ...
>
> Like in dired, "!" on a .ps-file will run ghostview (I think I reacall), on a
> .pdf will use either acrobat or xpdf, etc.
>
> For me, the problem is that when you do that, everything else
> in emacs is (or looks like it's) frozen.
>
> Problematic when you want to read through some doc, and
> while doing it, to pause while checking something out in some
> other buffer.  No can do, at least not by "!" alone.
>
> Would be nice if, say, a C-u ! put the new prog into
> background or something, letting you bounce back and forth
> between emacs and the app.
>

I think this is just a limitation in how dired does the command call. Emacs
can do synchronous and asynchronous processes. I believe other packages
that can be used to call a new process to run another program can do it
asynchronously and therefore don't block emacs. Not sure if/how you can
make dired do this automatically, but if, for example, you have the cursor
on a pdf file and hit !, you will be prompted (with a default of something
like xpdf) for the program. If you enter xpdf * &, rather than accepting
the default, emacs will do an asynchronous process call to run xpdf and you
will be able to switch between xpdf and emacs with no problems. 

It may be possible to make this behavior the default by customizing dired
or dired-x.

My issue isn't the sunchronous/asynchronous problem, its that once I have
(lets say) xpdf running, if I want to cut and copy bits into an emacs
buffer, I have to use that bloody awful rodent and not the familiar and
faster emacs keybindings. Same sort of issue with searching and other
operations. For this reason, I've written my own little converter utility
which takes the file type (*.doc, *.pdf, *.ps etc) and converts it to text
and displays it in an emacs buffer. You do lose some formatting, but I find
this is offset by the better integration into emacs. I use a defadvice on
view-file so that if I hit v in dired on one of these file types, it
automatically does the conversion - otherwise it just views the file as
normal. I've also added a call to browse-url for files ending in html or
htm, so if I hit v on an html file, it is rendered with w3m. If I want to
see the actual contents for any of the file types that are handled
specially, I just use enter rather than 'v'. 

Tim

-- 
tcross (at) rapttech dot com dot au


reply via email to

[Prev in Thread] Current Thread [Next in Thread]