* Re: Change in emacsclient behavior
2007-09-02 18:52 ` Juri Linkov
@ 2007-09-02 19:20 ` David Kastrup
2007-09-02 20:14 ` Juri Linkov
2007-09-02 23:20 ` Manoj Srivastava
2007-09-02 19:34 ` Tassilo Horn
` (4 subsequent siblings)
5 siblings, 2 replies; 38+ messages in thread
From: David Kastrup @ 2007-09-02 19:20 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
Juri Linkov <juri@jurta.org> writes:
>> Normally I don't use several frames, but for emacsclients I like
>> the new behavior. Making it depend on pop-up-frames wouldn't help
>> me, so I'm for the reversed behavior of the -c option, too.
>
> How about the following default behavior of emacsclient:
I don't think that it makes sense to fantasize a whole bunch of
behaviors for emacsclient: emacsclient should be modeled to mimic
Emacs itself as closely as possible with regard to command line
options and stuff: that way, one does not need half a million of info
pages to explain how clever it is.
> 1. When invoked without arguments, display the current frame (-c
> uses the current frame, but this could be customizable to display
> the initial frame or any of existing frames).
Initial frame seems reasonable.
> 2. When invoked with -e or --eval, display the current frame and eval the
> expression on this frame.
>
> 3. When invoked with one FILE argument, create a new frame with the file
> buffer.
>
> 4. When invoked with multiple FILE arguments, create either one frame with
> windows containing all specified files' buffers, or if `pop-up-frames' is
> non-nil, create as many frames as there are file arguments (starting a new
> Emacs session already does this).
Too much cleverness. Just do the same thing that is done on normal
Emacs startup.
> The reason that is usually it's undesirable to change the window
> configuration of the current frame when visiting new files.
That is no different from C-x C-f.
I can imagine one thing that could conceivably made to differentiate
between "C-x C-f"-like and "new Emacs session"-like behavior: if tty
and/or TERM indicate that emacsclient has been started from _within_
Emacs (for example, as an editor from a CVS command inside of an Emacs
shell or VC), then it does make more sense to treat this "C-x
C-f"-like than when emacsclient gets started from an independent
tty/terminal.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-02 19:20 ` David Kastrup
@ 2007-09-02 20:14 ` Juri Linkov
2007-09-02 20:34 ` David Kastrup
2007-09-03 18:26 ` Richard Stallman
2007-09-02 23:20 ` Manoj Srivastava
1 sibling, 2 replies; 38+ messages in thread
From: Juri Linkov @ 2007-09-02 20:14 UTC (permalink / raw)
To: David Kastrup; +Cc: emacs-devel
> I don't think that it makes sense to fantasize a whole bunch of
> behaviors for emacsclient: emacsclient should be modeled to mimic
> Emacs itself as closely as possible with regard to command line
> options and stuff: that way, one does not need half a million of info
> pages to explain how clever it is.
I agree that emacsclient should mimic emacs as much as possible.
Maybe even there should be a common wrapper (with a different name)
for emacs and emacsclient: running it will start emacs if it is
not started yet or connect to an existing Emacs server.
At least, command line options shouldn't be so different as now,
e.g. instead of -t, --tty better to use --no-window-system, -nw...
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-02 20:14 ` Juri Linkov
@ 2007-09-02 20:34 ` David Kastrup
2007-09-02 20:44 ` Tom Tromey
2007-09-03 18:26 ` Richard Stallman
1 sibling, 1 reply; 38+ messages in thread
From: David Kastrup @ 2007-09-02 20:34 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
Juri Linkov <juri@jurta.org> writes:
>> I don't think that it makes sense to fantasize a whole bunch of
>> behaviors for emacsclient: emacsclient should be modeled to mimic
>> Emacs itself as closely as possible with regard to command line
>> options and stuff: that way, one does not need half a million of info
>> pages to explain how clever it is.
>
> I agree that emacsclient should mimic emacs as much as possible.
> Maybe even there should be a common wrapper (with a different name)
> for emacs and emacsclient: running it will start emacs if it is
> not started yet or connect to an existing Emacs server.
emacsclient -a emacs
> At least, command line options shouldn't be so different as now,
> e.g. instead of -t, --tty better to use --no-window-system, -nw...
I want to be able to say something like
emacsclient -a emacs -f emerge-files-command file-a file-b file-c
and have it work as expected. It is not too hard to do if one leaves
the command line parsing mainly to emacs-server and have it set up
(and then consume) command-line-args-left. The ugly part is probably
rerouting kill-emacs (called in emerge-command-exit) within the Emacs
server.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-02 20:34 ` David Kastrup
@ 2007-09-02 20:44 ` Tom Tromey
0 siblings, 0 replies; 38+ messages in thread
From: Tom Tromey @ 2007-09-02 20:44 UTC (permalink / raw)
To: David Kastrup; +Cc: Juri Linkov, emacs-devel
>>>>> "David" == David Kastrup <dak@gnu.org> writes:
David> I want to be able to say something like
David> emacsclient -a emacs -f emerge-files-command file-a file-b file-c
David> and have it work as expected.
I've been wanting this for 'gdb --args' for a while now. Currently
I'm using a hack in shell-mode that looks for gdb and instead invokes
M-x gdb. This is nice but not perfect -- first of all, due to
longstanding habit I'm not much of a shell-mode user; and second, this
doesn't work in all the places where 'gdb --args' may work
(specifically I want to be able to be able to run gcc sub-processes
using the debugger, i.e., script it).
Tom
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-02 20:14 ` Juri Linkov
2007-09-02 20:34 ` David Kastrup
@ 2007-09-03 18:26 ` Richard Stallman
1 sibling, 0 replies; 38+ messages in thread
From: Richard Stallman @ 2007-09-03 18:26 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
I agree that emacsclient should mimic emacs as much as possible.
Maybe even there should be a common wrapper (with a different name)
for emacs and emacsclient: running it will start emacs if it is
not started yet or connect to an existing Emacs server.
We already have such a wrapper, as a script in etc.
At least, command line options shouldn't be so different as now,
e.g. instead of -t, --tty better to use --no-window-system, -nw...
That is a good idea. Would someone please implement it?
It is not too hard to do if one leaves
the command line parsing mainly to emacs-server and have it set up
(and then consume) command-line-args-left.
That is also a good implementation idea, if it works out.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-02 19:20 ` David Kastrup
2007-09-02 20:14 ` Juri Linkov
@ 2007-09-02 23:20 ` Manoj Srivastava
1 sibling, 0 replies; 38+ messages in thread
From: Manoj Srivastava @ 2007-09-02 23:20 UTC (permalink / raw)
To: emacs-devel
On Sun, 02 Sep 2007 21:20:57 +0200, David Kastrup <dak@gnu.org> said:
> Juri Linkov <juri@jurta.org> writes:
>>> Normally I don't use several frames, but for emacsclients I like the
>>> new behavior. Making it depend on pop-up-frames wouldn't help me,
>>> so I'm for the reversed behavior of the -c option, too.
>>
>> How about the following default behavior of emacsclient:
> I don't think that it makes sense to fantasize a whole bunch of
> behaviors for emacsclient: emacsclient should be modeled to mimic
> Emacs itself as closely as possible with regard to command line
> options and stuff: that way, one does not need half a million of info
> pages to explain how clever it is.
As an end user, would it still be possible to specify easily
whether one wants to
a) reuse an existing frame (which is something I do not often want --
existing frame is usually detached behind screen or sitting on
another window manager pane)
b) Pop up one frame per emacsclient invocation and work through files
one at a time in that frame (using C-x #), with the frame being
removed when all files are done) -- this is my preferred mode of
operation
c) have one frame pop up per file (That could be nice, for a few files).
I can get b) from current emacsclient; I used to get c) from
gnuclient, and the old emacsclient used to give me a).
manoj
--
What is irritating about love is that it is a crime that requires an
accomplice. Charles Baudelaire
Manoj Srivastava <srivasta@acm.org> <http://www.golden-gryphon.com/>
1024D/BF24424C print 4966 F272 D093 B493 410B 924B 21BA DABB BF24 424C
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-02 18:52 ` Juri Linkov
2007-09-02 19:20 ` David Kastrup
@ 2007-09-02 19:34 ` Tassilo Horn
2007-09-02 20:14 ` Juri Linkov
2007-09-03 15:31 ` Jeremy Maitin-Shepard
` (3 subsequent siblings)
5 siblings, 1 reply; 38+ messages in thread
From: Tassilo Horn @ 2007-09-02 19:34 UTC (permalink / raw)
To: emacs-devel
Juri Linkov <juri@jurta.org> writes:
Hi Juri,
>> Normally I don't use several frames, but for emacsclients I like the
>> new behavior. Making it depend on pop-up-frames wouldn't help me, so
>> I'm for the reversed behavior of the -c option, too.
>
> How about the following default behavior of emacsclient:
>
> 1. When invoked without arguments, display the current frame (-c uses
> the current frame, but this could be customizable to display the
> initial frame or any of existing frames).
>
> 2. When invoked with -e or --eval, display the current frame and eval
> the expression on this frame.
I don't quite understand what is the "current" frame. What if you have
several frames, none of which has the focus. Which one is current then?
The last visited one?
> 3. When invoked with one FILE argument, create a new frame with the
> file buffer.
>
> 4. When invoked with multiple FILE arguments, create either one frame
> with windows containing all specified files' buffers, or if
> `pop-up-frames' is non-nil, create as many frames as there are file
> arguments (starting a new Emacs session already does this).
Sounds good to me.
>> But then -c --current-frame would't make sense.
>
> One possible mnemonic for -c is --create-frame.
Agreed.
> BTW, does anyone know how to start a detached Emacs server so that
> after logout and login I could connect to it with emacsclient?
I use screen for that:
screen -d -m -S EmacsServer emacs -nw
Bye,
Tassilo
--
The air around Chuck Norris is always a balmy 78 degrees.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-02 19:34 ` Tassilo Horn
@ 2007-09-02 20:14 ` Juri Linkov
2007-09-03 19:15 ` Tassilo Horn
0 siblings, 1 reply; 38+ messages in thread
From: Juri Linkov @ 2007-09-02 20:14 UTC (permalink / raw)
To: emacs-devel
> I don't quite understand what is the "current" frame. What if you have
> several frames, none of which has the focus. Which one is current then?
> The last visited one?
It seems the "current" frame is the last created one.
>> BTW, does anyone know how to start a detached Emacs server so that
>> after logout and login I could connect to it with emacsclient?
>
> I use screen for that:
>
> screen -d -m -S EmacsServer emacs -nw
Thanks. I thought that it would be possible to do this without screens
somehow. I see there are two useful scripts in admin/notes/multi-tty.
Perhaps they should be placed in the bin/ directory with more suitable
names like `emacs-connect' and `emacs-preload'?
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-02 20:14 ` Juri Linkov
@ 2007-09-03 19:15 ` Tassilo Horn
0 siblings, 0 replies; 38+ messages in thread
From: Tassilo Horn @ 2007-09-03 19:15 UTC (permalink / raw)
To: emacs-devel
Juri Linkov <juri@jurta.org> writes:
Hi Juri,
>>> BTW, does anyone know how to start a detached Emacs server so that
>>> after logout and login I could connect to it with emacsclient?
>>
>> I use screen for that:
>>
>> screen -d -m -S EmacsServer emacs -nw
>
> Thanks. I thought that it would be possible to do this without
> screens somehow. I see there are two useful scripts in
> admin/notes/multi-tty. Perhaps they should be placed in the bin/
> directory with more suitable names like `emacs-connect' and
> `emacs-preload'?
Hey, nice! But they use screen, too. I don't know if it's ok to place
them there when they won't work if screen's not installed. But they
should definitely get a more prominent place where users can find them.
Maybe in etc/ and mention them in the docs?
Bye,
Tassilo
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-02 18:52 ` Juri Linkov
2007-09-02 19:20 ` David Kastrup
2007-09-02 19:34 ` Tassilo Horn
@ 2007-09-03 15:31 ` Jeremy Maitin-Shepard
2007-09-03 18:26 ` Richard Stallman
` (2 subsequent siblings)
5 siblings, 0 replies; 38+ messages in thread
From: Jeremy Maitin-Shepard @ 2007-09-03 15:31 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
Juri Linkov <juri@jurta.org> writes:
>> Normally I don't use several frames, but for emacsclients I like the new
>> behavior. Making it depend on pop-up-frames wouldn't help me, so I'm
>> for the reversed behavior of the -c option, too.
> How about the following default behavior of emacsclient:
> 1. When invoked without arguments, display the current frame (-c uses the
> current frame, but this could be customizable to display the initial frame
> or any of existing frames).
What does it mean to "display" a frame?
> 2. When invoked with -e or --eval, display the current frame and eval the
> expression on this frame.
Why is it even useful to "display" a frame before evaluating the
expression? I think it is important to have a way to evaluate an
expression without any other side effects. In particular, it is
important to be able to evaluate an expression without quitting out of a
minibuffer prompt. (I don't know if that problem still exists.)
[snip]
I think it is most important that emacsclient provides a sufficient
interface for achieving all possible desirable behavior. Users can then
create their own shell scripts, aliases, etc. that can be used with the
desired syntax. The actual syntax that the base emacsclient program
provides is of very marginal importance.
> BTW, does anyone know how to start a detached Emacs server so that after
> logout and login I could connect to it with emacsclient?
> I tried
> nohup emacs -nw -f server-start
> but it writes to nohup.out
> emacs: standard input is not a tty
> and exits. Then I tried with the -batch argument, but this
> doesn't work neither.
You can use screen.
--
Jeremy Maitin-Shepard
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-02 18:52 ` Juri Linkov
` (2 preceding siblings ...)
2007-09-03 15:31 ` Jeremy Maitin-Shepard
@ 2007-09-03 18:26 ` Richard Stallman
2007-09-03 20:37 ` Stefan Monnier
2007-09-04 23:08 ` Davis Herring
5 siblings, 0 replies; 38+ messages in thread
From: Richard Stallman @ 2007-09-03 18:26 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
1. When invoked without arguments, display the current frame (-c uses the
current frame, but this could be customizable to display the initial frame
or any of existing frames).
Ok.
2. When invoked with -e or --eval, display the current frame and eval the
expression on this frame.
Ok.
3. When invoked with one FILE argument, create a new frame with the file
buffer.
No. emacsclient should, by default, display files the same way C-x C-f does.
server.el should simply call find-file.
We already have lots of ways to customize C-x C-f, and we can add more
if users want them. If server.el simply calls find-file, all these
customization mechanisms will be available for it.
4. When invoked with multiple FILE arguments, create either one frame with
windows containing all specified files' buffers,
No, for the same reason.
or if `pop-up-frames' is
non-nil, create as many frames as there are file arguments (starting a new
Emacs session already does this).
That seems plausible for the case where `pop-up-frames' is non-nil.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-02 18:52 ` Juri Linkov
` (3 preceding siblings ...)
2007-09-03 18:26 ` Richard Stallman
@ 2007-09-03 20:37 ` Stefan Monnier
2007-09-03 23:46 ` Juri Linkov
2007-09-04 23:08 ` Davis Herring
5 siblings, 1 reply; 38+ messages in thread
From: Stefan Monnier @ 2007-09-03 20:37 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
> How about the following default behavior of emacsclient:
> 1. When invoked without arguments, display the current frame (-c uses the
> current frame, but this could be customizable to display the initial frame
> or any of existing frames).
> 2. When invoked with -e or --eval, display the current frame and eval the
> expression on this frame.
> 3. When invoked with one FILE argument, create a new frame with the file
> buffer.
> 4. When invoked with multiple FILE arguments, create either one frame with
> windows containing all specified files' buffers, or if `pop-up-frames' is
> non-nil, create as many frames as there are file arguments (starting a new
> Emacs session already does this).
I think most of those decisions are better placed in the user's .emacs than
on the emacsclient commandline.
Looking at the description above I always get nightmares of make-frame and
switch-to-buffer (the first having the problem of generating non-dedicated
frames, and the other having the problem of failing in several
circumstances and doing the wrong thing in others). If you want to obey
pop-up-frames, then please use display-buffer (or pop-to-buffer).
Stefan
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-02 18:52 ` Juri Linkov
` (4 preceding siblings ...)
2007-09-03 20:37 ` Stefan Monnier
@ 2007-09-04 23:08 ` Davis Herring
2007-09-05 20:02 ` Richard Stallman
5 siblings, 1 reply; 38+ messages in thread
From: Davis Herring @ 2007-09-04 23:08 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
> 1. When invoked without arguments, display the current frame (-c uses the
> current frame, but this could be customizable to display the initial frame
> or any of existing frames).
And if we're on a text link to a host that was previously running only
graphical Emacs? It seems there that it would be much more useful to
create a new tty frame where emacsclient was run.
Reading the rest of this list, I come to the conclusion that what UI
emacsclient should expose or create and what action it should take should
be entirely decoupled (up to, perhaps, some reasonable default UIs for
certain actions that are beyond the scope of this message). As a
disclaimer, I am not an expert in old or new emacsclient, or multi-tty in
general. However, it seems that a clean design for emacsclient can be had
that supports (almost) all uses, from remote or local terminals. I have
kept Emacs option names where they seemed relevant, but ignored extant
emacsclient convention entirely. So here goes:
For the UI, emacsclient can:
1. Create and become a tty for Emacs (with at least one frame).
2. Create and raise a graphical frame for Emacs on the current $DISPLAY.
3. Raise an existing graphical frame for Emacs on the current $DISPLAY, or
elsewhere if no such exists.
4. Try to raise an existing frame, or create one if it doesn't exist.
5. Become a pipe for Emacs (which may or may not produce any terminal
output).
2 and 4 should devolve to 1 if there is no suitable $DISPLAY available.
These choices can be expressed as options. I'd put #4 as the default, and
let --select give #3, --create give #2, -nw give #1, and -batch give #5.
Then there is the question of what to do. Call the frame newly created or
raised the "target" frame.
1. Do nothing (let the target frame show what it does or likes): no arguments
2. Visit some number of files (which may or may not create additional
frames, depending on `pop-up-frames' and/or --select): file arguments,
possibly with line/column numbers, etc.
3. Evaluate Lisp (in the target frame if not -batch; in some other frame
(TBD) otherwise). In the case of #5, that Lisp gets `emacsclient-pipe'
bound to a process object representing the pipe to emacsclient. This
operation is selected by --eval or perhaps -f for a simple function call.
Finally, of course, an emacsclient that does not become a tty or pipe (#2,
#3, #4) may wait or not on some signal from Emacs that editing is done;
whether the command that sends that signal destroys the frames that
emacsclient created (if any) is a user option completely outside the scope
of emacsclient.
Davis
--
This product is sold by volume, not by mass. If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-04 23:08 ` Davis Herring
@ 2007-09-05 20:02 ` Richard Stallman
2007-09-05 20:34 ` David Kastrup
0 siblings, 1 reply; 38+ messages in thread
From: Richard Stallman @ 2007-09-05 20:02 UTC (permalink / raw)
To: herring; +Cc: juri, emacs-devel
> 1. When invoked without arguments, display the current frame (-c uses the
> current frame, but this could be customizable to display the initial frame
> or any of existing frames).
And if we're on a text link to a host that was previously running only
graphical Emacs? It seems there that it would be much more useful to
create a new tty frame where emacsclient was run.
I don't think so. The point of emacsclient is to edit a file in your
existing Emacs. There is no reason why the way to display that file
should depend on where emacsclient was run.
For the UI, emacsclient can:
1. Create and become a tty for Emacs (with at least one frame).
2. Create and raise a graphical frame for Emacs on the current $DISPLAY.
3. Raise an existing graphical frame for Emacs on the current $DISPLAY, or
elsewhere if no such exists.
4. Try to raise an existing frame, or create one if it doesn't exist.
5. Become a pipe for Emacs (which may or may not produce any terminal
output).
These all seem useful in principle. 5 seems hard and I doubt it is
worth implementing. We don't necessarily have to implement all the
rest either.
2 and 4 should devolve to 1 if there is no suitable $DISPLAY available.
These choices can be expressed as options. I'd put #4 as the default, and
let --select give #3, --create give #2, -nw give #1, and -batch give #5.
I too think #4 is the right default. If we implement any others, the
user could select them with variables set in .emacs, or with
emacsclient options.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-05 20:02 ` Richard Stallman
@ 2007-09-05 20:34 ` David Kastrup
2007-09-07 6:30 ` Richard Stallman
0 siblings, 1 reply; 38+ messages in thread
From: David Kastrup @ 2007-09-05 20:34 UTC (permalink / raw)
To: rms; +Cc: juri, emacs-devel
Richard Stallman <rms@gnu.org> writes:
> For the UI, emacsclient can:
>
> 1. Create and become a tty for Emacs (with at least one frame).
> 2. Create and raise a graphical frame for Emacs on the current $DISPLAY.
> 3. Raise an existing graphical frame for Emacs on the current $DISPLAY, or
> elsewhere if no such exists.
> 4. Try to raise an existing frame, or create one if it doesn't exist.
> 5. Become a pipe for Emacs (which may or may not produce any terminal
> output).
>
> These all seem useful in principle. 5 seems hard and I doubt it is
> worth implementing.
It would make it possible to configure an Emacsclient invocation as a
$PAGER command.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-05 20:34 ` David Kastrup
@ 2007-09-07 6:30 ` Richard Stallman
2007-09-07 7:06 ` David Kastrup
0 siblings, 1 reply; 38+ messages in thread
From: Richard Stallman @ 2007-09-07 6:30 UTC (permalink / raw)
To: David Kastrup; +Cc: juri, emacs-devel
> 5. Become a pipe for Emacs (which may or may not produce any terminal
> output).
>
> These all seem useful in principle. 5 seems hard and I doubt it is
> worth implementing.
It would make it possible to configure an Emacsclient invocation as a
$PAGER command.
Sorry, I do not follow.
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Change in emacsclient behavior
2007-09-07 6:30 ` Richard Stallman
@ 2007-09-07 7:06 ` David Kastrup
2007-09-08 7:01 ` Richard Stallman
0 siblings, 1 reply; 38+ messages in thread
From: David Kastrup @ 2007-09-07 7:06 UTC (permalink / raw)
To: rms; +Cc: juri, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 809 bytes --]
Richard Stallman <rms@gnu.org> writes:
> > 5. Become a pipe for Emacs (which may or may not produce
> > any terminal output).
> >
> > These all seem useful in principle. 5 seems hard and I doubt
> > it is worth implementing.
>
> It would make it possible to configure an Emacsclient invocation
> as a $PAGER command.
>
> Sorry, I do not follow.
Executables like "man" use a pager configurable in $PAGER for their
output. Calling man in an Emacs shell session creates a lot of
garbage due to terminal problems. It would be much nicer if one could
configure something into $PAGER which just sucked up its stdin and
made it available in a separate Emacs buffer in view mode. In fact, I
_have_ something like that configured as a pager, namely the following
executable:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: emacs-pager --]
[-- Type: text/x-sh, Size: 264 bytes --]
#!/bin/sh
TMP=`mktemp -t emacs-pager.XXXXXX`
trap "rm $TMP* 2>/dev/null" 0
echo '-*- mode: view; auto-revert-interval: 1; mode: auto-revert-tail; view-exit-action: kill-buffer -*-' >"$TMP"
exec 5<&0 <&-
cat "$@" <&5 >>"$TMP" &
eval "${VISUAL:-${EDITOR}}" '"$TMP"'
[-- Attachment #3: Type: text/plain, Size: 403 bytes --]
Now this has several drawbacks: it takes a longer startup time, it
needs a temporary file, and it does not stop the data generating
process when the material will not get read to its end, anyway.
For example (a useless example, agreed),
yes|$PAGER
works well with $PAGER being less and/or more, but redirecting to a
temporary file is not so great.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
[-- Attachment #4: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 38+ messages in thread