[Top][All Lists]

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

Re: $EDITOR to open at file end?

From: Bob Proulx
Subject: Re: $EDITOR to open at file end?
Date: Sun, 8 Mar 2015 18:18:52 -0600
User-agent: Mutt/1.5.23 (2014-03-12)

Robert Thorpe wrote:
> It sounds like you're using several computers in some way.  If you
> describe the setup that would be useful.

I have already described this.  And I have already gotten good answers
and good discussion.  I consider the original problem solved.

I am very familiar with emacsclient and already use it all of the
time.  I think the 'emacsclient -t' feature is a killer feature of

Among the different ways I read and respond to email is that I will
ssh into my desktop from somewhere else on the network.  Most of the
time that is using OpenSSH from a real system.  Sometimes that means
using putty.exe.  Sometimes that means using a tablet.

In the terminal I will run screen.  When working over a long WAN link
from an unreliable network location using screen is a great saver
after a dropped connection.  Screen with emacs is an awesome
combination after the default screen escape character of C-a has been
changed to C-z.  C-a is inconvenient for me as either an emacs or vi
user.  I also use C-z for job control all of the time too.  But I
don't usually use job control in screen.  In screen I would normally
use different windows in those times when I would normally use C-z and
job control.  Therefore using C-z for the screen escape makes the most
sense for me.  I also like having a hard status bar.  And the extended
terminal attributes is useful too.  Here would be a minimum.

  escape ^z^z
  hardstatus on
  hardstatus alwayslastline
  hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "

In a screen window I will run mutt.  I normally use mutt for all of my
email.  I may have more than 10,000 messages various mailboxes such as
mailing lists.  Mutt will open them in less than a second.  It is very
fast.  I know many people at this point will want to suggest using
imap.  Using imap slows that down quite significantly!  For me imap
just isn't as good as having real mailboxes available.

When replying to a message in mutt I of course use emacs to edit my
message.  Mutt prepares a template and quotes the previous message for
the reply.  I write the reply in a newly started emacs running in a
terminal environment.

This thought of starting a new emacs will scare some people that have
long emacs initialization that takes a long time to start.  I have
optimized my emacs init so that it doesn't take very long to start.  I
wrote about this on this list a couple of years ago.

  $ time emacs -f kill-emacs
  real    0m0.155s
  user    0m0.128s
  sys     0m0.024s

Emacs can really be quite fast!  Even if I force dropping all of the
caches and requiring everything to load from the file system (SSD)
then things are quite fast.  The SSD makes a large difference over
spinning disks here.  My SSD cold start is around 1.5 seconds and my
spinning disk cold start time is around 6-7 seconds.  But I don't
usually do cold starts except for testing.  Typical for me has the
caches being warm and speed is as above.

> The people on this list may know a way to deal with it using
> emacsclient.

In the past I have used emacs, screen, and other applications in this
following configuration.  Some people may like this.  I have a helper
script that I call emacs-screen:

  screen -X select 0
  emacsclient "$@"
  screen -X select $WINDOW

In screen $WINDOW is the window number.  "0" for the first window.
"1" for the next and so forth.  The above assumes emacs running in the
first window 0 and that emacs has server-start running an emacs
server.  Executing "screen -X select 0" tells screen to make window 0
the currently visible window.  Running emacsclient of course tells
emacs to visit that file.  After editing that file C-x # runs
server-edit causing emacsclient to exit.  "screen -X select $WINDOW"
tells screen to make the previous window, the one you started in,
visible again effectively returning you back to mutt.

This type of environment allows you to use an emacs server to edit
email with mutt and avoid the startup time.  Plus all of your
previously exiting visited buffers are still availble allowing an easy
cut and paste of text all around.  It is a good setup.  I hope people
reading this give it a try.  It's pretty cool!

I don't normally use it however.  As you can see the startup time
isn't a problem for me.  My emacs starts quite fast.  I don't miss
connecting to an always running emacs with all of the visited buffers
already there.  Actually I rather like the pristine cleanness of a
freshly started emacs.  Everything is clean and nice right at that
point.  I also don't like the need to have the exact environment up
and running in order to operate.  Not much hardship.  Here is the
setup for the above.  This starts up screen, runs emacs as the first
process in window 0, tells emacs to start a server.

  $ screen emacs -f server-start

This doesn't even talk about the killer feature "emacsclient -t".
When I am doing software development on a system and it is convenient
that it be *over there on that system* then I do all of the above of
starting an emacs with a server running.  Then I connect to it using
"emacsclient -t" outside of screen.  That attaches my terminal to the
currently running emacs.  I have a persistently running emacs client
with all of my state available to me for that development.  Using
screen is awesome if I want everything in one terminal.  But if I have
my large dual monitor desktop with lots of space then I will usually
run multiple terminals outside of screen.  It all depends upon what I
am wanting to do at the time.

Emacs 24 has some annoying mode line font features that become visible
when using "term screen-256color".  I would speak about them but I
have written much here already so will stop at this point.

Previously I used emacs-vm to read email.  Previous to using emacs-vm
I used rmail.  I don't want to offend anyone that is currently using
rmail but I found emacs-vm to be vastly superior.  I liked emacs-vm.
I used it for a long time.  But I like using mutt better.

Long, long ago I had tried gnus.  This was a long time ago and it was
glacially slow then.  I know that things have changed considerably and
trying gnus again is on my todo list one of these days.  I will
eventually get around to it.  Learning curve being that it is one must
learn to pace themselves! :-)


reply via email to

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