[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: Fri, 6 Mar 2015 17:48:56 -0700
User-agent: Mutt/1.5.23 (2014-03-12)

Emanuel Berg wrote:
> Alexis writes:
> >> Is there another way to instruct emacs explicitly
> >> to open the file and go to the bottom of the file?
> >
> > Here's another possible kludge:
> >
> >    $ emacs -Q --eval "(add-hook 'find-file-hook
> > (lambda () (goto-char (point-max))))"
> >
> > :-)

Thanks for the suggestion.  However that -Q is a little harsh.  And
rewriting find-file so that every use of it thereafter jumps to the
end of the file is double harsh.  It does answer the question very
literally however.  Perhaps I should have clarified that everything
else should remain normal. (chuckle) :-)

> I think you can remove that smiley, because that is
> exactly it (or one of many "exactly it" I should say),
> only I got the impression that the OP wanted this for
> opening a specific file, not every file,

To avoid being vague I wanted this for an EDITOR setting for use with
mutt when logging in over ssh to a remote server.  This works.  But
the 999999 just feels like hack.

In the .mutt/muttrc file:
  set editor="emacs +999999"

> and besides he is likely to want his initialization intact (i.e.,
> not the -Q option which I suspected is a leftover from testing the
> command).

Right.  Use of -Q is right out! :-)

> So: 
>     emacs FILE --eval "(goto-char (point-max))"

Something like that sort'a works.  It leads me to an acceptable
answer.  Obviously I was hoping to use a "string with options"
followed by the filename in a configuration.  This requires the
configuration both before and after FILE.  I can get there however by
using a helper script.  I will call it muttemacs and have it do
something similar to this (written in compact form):

  test $# -ne 1 && { echo "Error: too many arguments" 1>&2; exit 1 ;}
  exec emacs "$file" --eval "(goto-char (point-max))"

> In situations like these it is common to say that it
> is better to keep Emacs up all the time and open files
> from, not with, Emacs. So, let me tell you that it is
> better to keep Emacs up all the time and open files
> from, not with, Emacs. :)

I knew someone would suggest to use an emacs-server with emacsclient
and screen/tmux and other types of suggestions.  But I didn't know how
to head that off.  Yes I am very much aware of them.  I almost always
run emacs inside of a screen session already.  I know I can set up to
automatically switch screen windows to the running emacs server
window.  All old stuff.  But that has nothing to do with wanting this
setup.  Doing that just doesn't make sense in the way I need it to
work.  I hadn't mentioned mutt before for fear people would suggest
running gnus or emacs-vm instead.  But in the end we all like what we
like.  And as an fyi heads up to anyone that cares I am losing network
connectivity to my servers in the next two weeks.  Everything needs to
pick up and move elsewhere.  Which is why I am making these changes.
It is causing me to rework much of the way I do things.  I am trying
to keep ahead of things and to remain functional through the upcoming


reply via email to

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